This is an automated email from the ASF dual-hosted git repository. joshtynjala pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit 00d9cb21560f03325c0d3d91b4d3fef229933586 Author: Chris Feger <christopherfe...@yahoo.com> AuthorDate: Mon Nov 21 14:31:04 2022 -0700 Add raw string literals --- .../compiler/internal/parsing/as/RawASTokenizer.lex | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/compiler/src/main/jflex/org/apache/royale/compiler/internal/parsing/as/RawASTokenizer.lex b/compiler/src/main/jflex/org/apache/royale/compiler/internal/parsing/as/RawASTokenizer.lex index d9f72faff..580c8739d 100644 --- a/compiler/src/main/jflex/org/apache/royale/compiler/internal/parsing/as/RawASTokenizer.lex +++ b/compiler/src/main/jflex/org/apache/royale/compiler/internal/parsing/as/RawASTokenizer.lex @@ -47,7 +47,7 @@ import org.apache.royale.compiler.constants.IASKeywordConstants; */ private enum StringKind { - CHAR, STRING + CHAR, STRING, RAW } private StringKind stringKind; @@ -312,12 +312,19 @@ REGEX_CLASS="[" ({REGEX_ESCAPE}|[^\n\r\]\\])* "]" yybegin(STRINGLITERAL); } +<YYINITIAL> "@\"" +{ + startAggregate(); + stringKind = StringKind.RAW; + yybegin(STRINGLITERAL); +} + // String handling for both double and single quoted strings <STRINGLITERAL> "\"" { continueAggregate(); - if (stringKind == StringKind.STRING) + if (stringKind == StringKind.STRING || stringKind == StringKind.RAW) { yybegin(YYINITIAL); return buildAggregateToken(TOKEN_LITERAL_STRING); @@ -336,7 +343,10 @@ REGEX_CLASS="[" ({REGEX_ESCAPE}|[^\n\r\]\\])* "]" <STRINGLITERAL> "\\" { - yybegin(ESCAPE_SEQUENCE); + if (stringKind != StringKind.RAW) + { + yybegin(ESCAPE_SEQUENCE); + } } <STRINGLITERAL> {LINE_TERMINATOR}+