Skip to content

Commit 3a56484

Browse files
authored
Merge pull request #286 from julia-vscode/sp/fix-long-char-parse
fix parsing of long chars
2 parents 6154d19 + 9f60731 commit 3a56484

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ function valid_escaped_seq(s::AbstractString)
657657
if popfirst!(a) == '\\'
658658
c = popfirst!(a)
659659
if c === 'x' || c === 'u' || c === 'U'
660-
maxiter = c === 'x' ? 2 : c === 'u' ? 4 : 5
660+
maxiter = c === 'x' ? 2 : c === 'u' ? 4 : 8
661661
0 < length(a) <= maxiter || return false
662662
n = 0
663663
while !isempty(a)

test/parser.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,7 @@ end""" |> test_expr
994994
@test test_expr(raw"'\u2222'")
995995
@test test_expr(raw"'\U2222'")
996996
@test test_expr(raw"'\U22222'")
997+
@test test_expr(raw"'\U00000001'")
997998

998999
@test CSTParser.parse(raw"'\200'").head == :errortoken
9991000
@test CSTParser.parse(raw"'\300'").head == :errortoken
@@ -1009,6 +1010,7 @@ end""" |> test_expr
10091010
@test CSTParser.parse(raw"'\u222ää'").head == :errortoken
10101011
@test CSTParser.parse(raw"'\x222ää'").head == :errortoken
10111012
@test CSTParser.parse(raw"'\U222ää'").head == :errortoken
1013+
@test CSTParser.parse(raw"'\U10000001'").head == :errortoken
10121014
for c in rand(Char, 1000)
10131015
@test test_expr(string("'", c, "'"))
10141016
end

0 commit comments

Comments
 (0)