Found during automated review of PR #399 (all confirmed pre-existing on main — the PR does not change them):
- Bare
\r inside a --[[ ]] comment does not advance the line counter. Lexer.tokenize("--[[a\rb]]\rx") reports x at line 2; PUC's read_long_string → inclinenumber counts it, so x is line 3. scan_long_string has ?\r clauses; the multi-line comment scanner does not.
- Bare
\r inside a short string is accepted as a literal character. "s='a\rb' x" lexes; PUC's read_string raises "unfinished string" for both \n and \r. The line counter also doesn't advance, so line numbers drift in CR-only-EOL files.
\ddd decimal escapes are cut short instead of rejected. "\256" lexes as \25 followed by literal 6; PUC raises "decimal escape too large". (read_decimal_escape/3 stops before the value can exceed 255, which also made the old value > 255 guard dead code.)
All three are byte-level lexer conformance issues; worth fixing together while the scanners are warm from #399.
🤖 Filed from an automated review pass.
Found during automated review of PR #399 (all confirmed pre-existing on main — the PR does not change them):
\rinside a--[[ ]]comment does not advance the line counter.Lexer.tokenize("--[[a\rb]]\rx")reportsxat line 2; PUC'sread_long_string→inclinenumbercounts it, soxis line 3.scan_long_stringhas?\rclauses; the multi-line comment scanner does not.\rinside a short string is accepted as a literal character."s='a\rb' x"lexes; PUC'sread_stringraises "unfinished string" for both\nand\r. The line counter also doesn't advance, so line numbers drift in CR-only-EOL files.\ddddecimal escapes are cut short instead of rejected."\256"lexes as\25followed by literal6; PUC raises "decimal escape too large". (read_decimal_escape/3stops before the value can exceed 255, which also made the oldvalue > 255guard dead code.)All three are byte-level lexer conformance issues; worth fixing together while the scanners are warm from #399.
🤖 Filed from an automated review pass.