Add NewLazyLexer and MustNewLazyLexer which accept a function that
returns the rules for the lexer. This allows us to defer the rules
definitions until they're needed.
Lexers in a, g, s, and x packages have been updated to use the new lazy
lexer.
Using these examples:
~~~
0x21
1_000
1e3
~~~
Several languages failed that support these syntax. Here are ones I found:
Lexer | 0x21 | 1_000 | 1e3
-----------|------|-------|-----
C# | fail | fail | fail
Go | | fail |
JavaScript | | fail | fail
PHP | | fail |
Python | | fail |
Ruby | | | fail
I fixed these issues, and added tests.
This is a lexer that is useful for templating languages, where the
surrounding text may be of a different syntax. eg. PHP+HTML
The PHP lexer has been changed accordingly.
Fixes#80