jison
jison copied to clipboard
Escaping $1
I have an action with $1.replace(/['"](.+)['"]/, '$1' )
. How do I escape the $1
? The only solution I found is to use \u0024
instead of $
, but that's a bit hacky.
I did this by defining a constant in a codeblock like shown below.
Sill pretty hacky, but I tried al sorts of escape sequences, none of them worked.
%{
var dollar = "$";
%}
... lex
%%
rule : a + b { return dollar + "1"; }
;