Repository navigation
fix(lexer): accept identifiers that start with digits - #1201
Merged
jknack merged 1 commit intoOct 23, 2026
Merged
Conversation
jknack
approved these changes
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1078
{{24HrServicePh}}fails to parse withfound: '{{', expected: '<EOF>'while handlebars.js renders it fine. The lexer tokenizes24HrServicePhas PATH, butsexpr(the statement head forvar, blocks, subexpressions) only accepts QID - PATH is only allowed in partial names via pexpr.Rather than widening every parser rule that consumes sexpr.QID() (the visitor calls it in about 10 places, so a PATH alternative would need null-handling throughout), this change teaches the ID lexer fragment to accept digit-leading identifiers:
[0-9]+ ID_START ID_SUFFIX*.24HrServicePhnow lexes as QID, which sexpr, refParam, and END_BLOCK nameEnd already accept.Pure numeric literals are unaffected:
24and24.5contain no ID_START after the digits, so they still match NUMBER. Verified:{{24Hr}}renders the context value,{{#if 24Hr}}blocks work,{{foo 24}}/{{foo 24.5}}still parse as number params.Tests: new Issue1078 class covering the variable case, a block-helper case, and numeric literal parameters. Module suite: 1043 tests, zero regressions (the 3 DateFormatTest failures are a pre-existing locale issue, identical on a clean master checkout).
One scoping note: bare
{{24}}as a standalone expression still fails (NUMBER was never a sexpr head, same on 4.5.5) - that is a different grammar question and out of scope here.