diff --git a/src/utils.jl b/src/utils.jl index fca04ac2..5e2c5743 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -657,7 +657,7 @@ function valid_escaped_seq(s::AbstractString) if popfirst!(a) == '\\' c = popfirst!(a) if c === 'x' || c === 'u' || c === 'U' - maxiter = c === 'x' ? 2 : c === 'u' ? 4 : 5 + maxiter = c === 'x' ? 2 : c === 'u' ? 4 : 8 0 < length(a) <= maxiter || return false n = 0 while !isempty(a) diff --git a/test/parser.jl b/test/parser.jl index 3c3ed204..4440ed8e 100644 --- a/test/parser.jl +++ b/test/parser.jl @@ -994,6 +994,7 @@ end""" |> test_expr @test test_expr(raw"'\u2222'") @test test_expr(raw"'\U2222'") @test test_expr(raw"'\U22222'") + @test test_expr(raw"'\U00000001'") @test CSTParser.parse(raw"'\200'").head == :errortoken @test CSTParser.parse(raw"'\300'").head == :errortoken @@ -1009,6 +1010,7 @@ end""" |> test_expr @test CSTParser.parse(raw"'\u222ää'").head == :errortoken @test CSTParser.parse(raw"'\x222ää'").head == :errortoken @test CSTParser.parse(raw"'\U222ää'").head == :errortoken + @test CSTParser.parse(raw"'\U10000001'").head == :errortoken for c in rand(Char, 1000) @test test_expr(string("'", c, "'")) end