8000 Implement lexer by rpiaggio · Pull Request #861 · gemini-hlsw/clue · GitHub
[go: up one dir, main page]

Skip to content

Implement lexer - #861

Closed
rpiaggio wants to merge 1 commit into
mainfrom
gql-lexer
Closed

rpiaggio wants to merge 1 commit into
mainfrom
gql-lexer

Conversation

@rpiaggio
Copy link
Copy Markdown
Collaborator

Replaces the string manipulation in the gql macro with a small lexer for the GraphQL
lexical grammar (spec §2.1: punctuators, names, numbers, strings incl. block strings and
escapes, comments) and does the spliced-subquery caller-check on tokens.

Fixes two holes in the previous approach: the operation header was located by the first
(, so a fragment with field arguments placed before the operation was mistaken for it
(or, with a brace guard, hid it), losing the declared variables and falsely rejecting a
spliced subquery; and strings/comments were not understood at all.

Behavior change: a lexical error in a gql document (unterminated string, stray character)
is now a compile error. GraphQLDocument.unsafeFromString remains the escape hatch.

Groundwork for #853, which will add the unused-variable/fragment warnings as token walks.

@rpiaggio rpiaggio changed the title implement lexer Implement lexer Sep 10, 2026
@mergify mergify Bot added the core label Sep 10, 2026
@mergify
mergify Bot commented Sep 10, 2026
Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@rpiaggio
Copy link
Copy Markdown
Collaborator Author

Closing this PR in favor of #864. Even if we have to pull grackle-core, it's a better option than having our own implementation.

@rpiaggio rpiaggio closed this Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0