Merge branch 'pr-1803'
This commit is contained in:
@ -20,5 +20,7 @@ This is a {{ site.pmd.release_type }} release.
|
||||
|
||||
### External Contributions
|
||||
|
||||
* [#1803](https://github.com/pmd/pmd/pull/1803): \[dart] \[cpd] Dart escape sequences - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
|
||||
{% endtocmaker %}
|
||||
|
||||
|
@ -344,8 +344,8 @@ booleanLiteral
|
||||
stringLiteral: SingleLineString;
|
||||
//stringLiteral: SingleLineString;
|
||||
SingleLineString
|
||||
: '"' (~["] | '\\"')* '"'
|
||||
| '\'' (~['] | '\\\'')* '\''
|
||||
: '"' (~[\\"] | '\\\\' | ESCAPE_SEQUENCE | '\\"')* '"'
|
||||
| '\'' (~[\\'] | '\\\\' | ESCAPE_SEQUENCE | '\\\'')* '\''
|
||||
// | 'r\'' (~('\'' | NEWLINE))* '\'' // TODO
|
||||
// | 'r"' (~('\'' | NEWLINE))* '"'
|
||||
;
|
||||
@ -369,6 +369,7 @@ ESCAPE_SEQUENCE
|
||||
| '\\x' HEX_DIGIT HEX_DIGIT
|
||||
| '\\u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
|
||||
| '\\u{' HEX_DIGIT_SEQUENCE '}'
|
||||
| '\\$'
|
||||
;
|
||||
fragment
|
||||
HEX_DIGIT_SEQUENCE
|
||||
|
@ -31,6 +31,8 @@ public class DartTokenizerTest extends AbstractTokenizerTest {
|
||||
public static Collection<Object[]> data() {
|
||||
return Arrays.asList(
|
||||
new Object[] { "comment.dart", 5 },
|
||||
new Object[] { "escape_sequences.dart", 13 },
|
||||
new Object[] { "escaped_backslash.dart", 14 },
|
||||
new Object[] { "escaped_string.dart", 17 },
|
||||
new Object[] { "increment.dart", 185 },
|
||||
new Object[] { "imports.dart", 1 }
|
||||
|
@ -0,0 +1,3 @@
|
||||
var newline = '\n';
|
||||
var dollar = '$';
|
||||
var escaped_dollar = "\$";
|
@ -0,0 +1,2 @@
|
||||
var separator = '\\';
|
||||
var separators = const ['/', '\\'];
|
Reference in New Issue
Block a user