How to lex numbers, dots/periods, and range operators all at the same time.
(... and catch errors with malformed literals.)
The question "How do I parse floating point numbers, and single periods/dots and I need a range operator which is two dots at the same time?" comes up so frequently, that I decided to publish the lexical rules from the commercial grade lexer in the JavaFX compiler, with the blessings of Sun Microsystems, as the compiler is open source. See JavaFX for more details of the JavaFX project.
...
Info | ||
---|---|---|
| ||
Note the use of fragment rules with no body to define the token types that the main FLOATING_POINT_LITERAL uses. |
...