Escaped characters in Dart multiline string are now handled correctly

This commit is contained in:
Maikel Steneker
2020-08-27 13:21:36 +02:00
parent 74a9950128
commit 7740e47292
4 changed files with 17 additions and 0 deletions

View File

@ -373,6 +373,7 @@ MultiLineString
fragment
StringContentTDQ
: ~('\\' | '"' | '$')
| '\\' ~('\n' | '\r')
| '"' ~'"' | '""' ~'"'
| StringInterpolation
;
@ -380,6 +381,7 @@ StringContentTDQ
fragment
StringContentTSQ
: ~('\\' | '\'' | '$')
| '\\' ~('\n' | '\r')
| '\'' ~'\'' | '\'\'' ~'\''
| StringInterpolation
;

View File

@ -59,6 +59,11 @@ public class DartTokenizerTest extends CpdTextComparisonTest {
doTest("string_interpolation");
}
@Test
public void testEscapedDollar() {
doTest("escaped_dollar");
}
@Test
public void testRegex() {
doTest("regex");

View File

@ -0,0 +1,3 @@
var multiLineStringWithDollar = """
\$
""";

View File

@ -0,0 +1,7 @@
[Image] or [Truncated image[ Bcol Ecol
L1
[var] 1 3
[multiLineStringWithDollar] 5 29
[=] 31 31
["""\n \\$\n """] 33 9
EOF