Skip to content

fix(lexers): handle escapes in protobuf strings and qualified extends - #1503

Merged
github-actions[bot] merged 1 commit into
alecthomas:masterfrom
stefanvanburen:svanburen/protobuf-string-escapes
Nov 18, 2026
Merged

github-actions[bot] merged 1 commit into
alecthomas:masterfrom
stefanvanburen:svanburen/protobuf-string-escapes

Conversation

@stefanvanburen

Copy link
Copy Markdown
Contributor

A couple more protobuf lexer fixes, following up on #1253. String literals were matched with ".*?", so something like [default = "say \"hi\""] ended the string at the escaped quote and left an Error token for the trailing \; strings now consume backslash escapes (and stop at a newline). Separately, extend .google.protobuf.MessageOptions lexed the leading . as an operator — the extendee is now a single NameClass.

Added both cases to the existing proto2 testdata. (Same deal as last time — found these with claude while comparing against tree-sitter-proto.)

String literals matched `".*?"`, so an escaped quote ended the string
early and left the real closing quote as an `Error` token. Strings now
consume backslash escapes and stop at a newline.

`extend .foo.Bar` lexed the leading dot as an operator and the rest as
a plain name; the extendee is now a single `NameClass` token.
@stefanvanburen
stefanvanburen marked this pull request as ready for review November 18, 2026 21:15
@github-actions
github-actions Bot merged commit 2d34385 into alecthomas:master Nov 18, 2026
5 checks passed
@stefanvanburen
stefanvanburen deleted the svanburen/protobuf-string-escapes branch November 18, 2026 21:37
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.

1 participant