File tree Expand file tree Collapse file tree
parser/testdata/01460_allow_dollar_and_number_in_identifier Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -766,6 +766,22 @@ func (l *Lexer) readNumberOrIdent() Item {
766766 }
767767 }
768768
769+ // Check if directly followed by letter (identifier like 1alias1name1)
770+ // Exclude exponent (e/E followed by digit/+/-) and base prefixes (0x, 0b, 0o)
771+ if unicode .IsLetter (l .ch ) {
772+ val := sb .String ()
773+ isExponent := (l .ch == 'e' || l .ch == 'E' ) && (unicode .IsDigit (l .peekChar ()) || l .peekChar () == '+' || l .peekChar () == '-' )
774+ isBasePrefix := val == "0" && (l .ch == 'x' || l .ch == 'X' || l .ch == 'b' || l .ch == 'B' || l .ch == 'o' || l .ch == 'O' )
775+ if ! isExponent && ! isBasePrefix {
776+ // This is an identifier that starts with digits (e.g., 1alias1name1)
777+ for isIdentChar (l .ch ) {
778+ sb .WriteRune (l .ch )
779+ l .readChar ()
780+ }
781+ return Item {Token : token .IDENT , Value : sb .String (), Pos : pos }
782+ }
783+ }
784+
769785 // Not an identifier, continue as number
770786 // But we already consumed the digits, so continue from here
771787 // Handle underscore separators in numbers (only if followed by a digit)
Original file line number Diff line number Diff line change 1- {
2- "explain_todo" : {
3- "stmt2" : true
4- }
5- }
1+ {}
You can’t perform that action at this time.
0 commit comments