In different contexts within Alex's surface syntax, something like
"2340898" might be a string of characters or a number. The contexts are
are only distinguished at the grammar level, not the token level, so
this more or less (we could very layer-violation-y tricks) precludes
lexing entire number literals.
Instead of a number token, we have a digit token. This we treat as
"sub-token", making a DIGIT | CHAR non-terminal we use everywhere we
want to parse a character.
For number literals, we just parse a non-empty string of numbers, and
the left recursion makes the * 10 elegant.
In different contexts within Alex's surface syntax, something like "2340898" might be a string of characters or a number. The contexts are are only distinguished at the grammar level, not the token level, so this more or less (we could very layer-violation-y tricks) precludes lexing entire number literals.
Instead of a number token, we have a digit token. This we treat as "sub-token", making a
DIGIT | CHAR
non-terminal we use everywhere we want to parse a character.For number literals, we just parse a non-empty string of numbers, and the left recursion makes the
* 10
elegant.Fixes #197