Skip to content
Snippets Groups Projects
Commit 4e92d34e authored by Mick Jordan's avatar Mick Jordan
Browse files

parse escapes in `xxx` correctly

parent c6654fd0
Branches
No related tags found
No related merge requests found
...@@ -65,6 +65,7 @@ public class ParserGeneration { ...@@ -65,6 +65,7 @@ public class ParserGeneration {
"simplified unary and binary operations", "simplified unary and binary operations",
"allow unary ! in normal expressions", "allow unary ! in normal expressions",
"added \\a, \\v and \\` escape sequences", "added \\a, \\v and \\` escape sequences",
"added octal escape sequences for strings" "added octal escape sequences for strings",
"handles escapes in `xxx` form"
}; };
} }
...@@ -687,11 +687,23 @@ DD : '..' ('0'..'9')+ ; ...@@ -687,11 +687,23 @@ DD : '..' ('0'..'9')+ ;
ID ID
: '.'* ID_NAME : '.'* ID_NAME
| '.' | '.'
| '`' ( ESC_SEQ | ~('\\'|'`') )* '`' { setText(getText().substring(1, getText().length()-1)); } | '`' BACKTICK_NAME
; ;
OP : '%' OP_NAME+ '%' ; OP : '%' OP_NAME+ '%' ;
fragment BACKTICK_NAME
@init { final StringBuilder buf = new StringBuilder(); }
: (
(
ESCAPE[buf]
| i = ~( '\\' | '`' ) { buf.appendCodePoint(i); }
)*
'`'
{ setText(buf.toString()); }
)
;
STRING STRING
@init { final StringBuilder buf = new StringBuilder(); } @init { final StringBuilder buf = new StringBuilder(); }
: ( : (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment