This commit is contained in:
damirka 2021-06-02 14:53:32 +03:00
parent eaadb29448
commit ecff3d6f2b
3 changed files with 18 additions and 2 deletions

View File

@ -299,7 +299,11 @@ impl Token {
if input[i] == b'x' {
hex = true;
} else if input[i] == b'u' {
unicode = true;
if input[i + 1] == b'{' {
unicode = true;
} else {
return (0, None);
}
} else {
escaped = true;
}

View File

@ -9,4 +9,9 @@ outputs:
- " --> test:1:1\n |\n 1 | 'abcdefg'\n | ^\n |\n = unexpected token: '''"
- " --> test:1:1\n |\n 1 | '\\t\\t'\n | ^\n |\n = unexpected token: '''"
- " --> test:1:1\n |\n 1 | '\\u{bbbbb}\\u{aaaa}'\n | ^\n |\n = unexpected token: '''"
- " --> test:1:1\n |\n 1 | '\\u123'\n | ^\n |\n = unexpected token: '''"
- " --> test:1:1\n |\n 1 | '\\u1' // panic\n | ^\n |\n = unexpected token: '''"
- " --> test:1:1\n |\n 1 | '\\u00000000' // should error\n | ^\n |\n = unexpected token: '''"
- " --> test:1:1\n |\n 1 | '\\u01000000' // should error\n | ^\n |\n = unexpected token: '''"
- " --> test:1:1\n |\n 1 | '\\u9999999' // should error\n | ^\n |\n = unexpected token: '''"
- " --> test:1:1\n |\n 1 | '😭😂😘'\n | ^\n |\n = unexpected token: '''"

View File

@ -17,4 +17,11 @@ expectation: Fail
'\u{bbbbb}\u{aaaa}'
'😭😂😘'
'\u123'
'\u1' // should error
'\u00000000' // should error
'\u01000000' // should error
'\u9999999' // should error
'😭😂😘'