Skip to content

Commit cdb96fb

Browse files
committed
Fixing parsing of larger UTF-8 code points
1 parent 79e7539 commit cdb96fb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lua-parser/parser.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,10 @@ local G = { V"Lua",
423423
+ P"u" * expect("{", "OBraceUEsc")
424424
* expect(C(xdigit^1), "DigitUEsc") * Cc(16)
425425
* expect("}", "CBraceUEsc")
426-
/ tonumber / string.char -- true max is \u{10FFFF}
426+
/ tonumber
427+
/ (utf8 and utf8.char or string.char) -- true max is \u{10FFFF}
428+
-- utf8.char needs Lua 5.3
429+
-- string.char works only until \u{FF}
427430

428431
+ throw("EscSeq")
429432
);

0 commit comments

Comments
 (0)