Change Lexer API: Remove IDType parameter, it can be retrieved via the Token parameter. Re-arrange parameters so tokens are in order and can be used as a typetuple through multiple other templated functions.
This commit is contained in:
parent
a5d7bf0956
commit
ab067e5732
|
@ -399,8 +399,8 @@ public struct DLexer
|
||||||
{
|
{
|
||||||
import core.vararg;
|
import core.vararg;
|
||||||
|
|
||||||
mixin Lexer!(IdType, Token, lexIdentifier, isSeparating, operators,
|
mixin Lexer!(Token, lexIdentifier, isSeparating, pseudoTokenHandlers,
|
||||||
dynamicTokens, pseudoTokenHandlers, keywords);
|
operators, dynamicTokens, keywords);
|
||||||
|
|
||||||
this(ubyte[] range, const LexerConfig config, StringCache* cache)
|
this(ubyte[] range, const LexerConfig config, StringCache* cache)
|
||||||
{
|
{
|
||||||
|
|
|
@ -367,10 +367,11 @@ public:
|
||||||
* }
|
* }
|
||||||
* ---
|
* ---
|
||||||
*/
|
*/
|
||||||
mixin template Lexer(IDType, Token, alias defaultTokenFunction,
|
mixin template Lexer(Token, alias defaultTokenFunction,
|
||||||
alias tokenSeparatingFunction, alias staticTokens, alias dynamicTokens,
|
alias tokenSeparatingFunction, alias tokenHandlers,
|
||||||
alias tokenHandlers, alias possibleDefaultTokens)
|
alias staticTokens, alias dynamicTokens, alias possibleDefaultTokens)
|
||||||
{
|
{
|
||||||
|
alias IDType = typeof(Token.type);
|
||||||
|
|
||||||
static assert (tokenHandlers.length % 2 == 0, "Each pseudo-token must"
|
static assert (tokenHandlers.length % 2 == 0, "Each pseudo-token must"
|
||||||
~ " have a corresponding handler function name.");
|
~ " have a corresponding handler function name.");
|
||||||
|
|
Loading…
Reference in New Issue