Skip to content

Fix parser source locations after multibyte input - #5771

Merged
rmosolgo merged 1 commit into
rmosolgo:masterfrom
ydah:fix-parser-multibyte-locations
Oct 7, 2026
Merged

rmosolgo merged 1 commit into
rmosolgo:masterfrom
ydah:fix-parser-multibyte-locations

Conversation

@ydah

@ydah ydah commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

The parser receives byte offsets from the lexer, but cached newline positions used character offsets. Multibyte comments and strings could therefore shift AST locations and validation errors. AST columns also differed from character-based parse error columns.

Store newline positions as byte offsets and count UTF-8 characters within the containing line. Correct the final-line calculation when the input has no trailing newline.

@rmosolgo rmosolgo added this to the 2.6.12 milestone Oct 7, 2026
@rmosolgo

rmosolgo commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Thanks for fixing this! Does the C Parser need a fix for this too?

@rmosolgo
rmosolgo merged commit 61759ed into rmosolgo:master Oct 7, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants