Alias TokenId
Generates the token type identifier for the given symbol.
alias TokenId(IdType, alias staticTokens, alias dynamicTokens, alias possibleDefaultTokens, string symbol)
= id;
There are two special cases:
- If symbol is "", then the token identifier will be 0
- If symbol is "\0", then the token identifier will be the maximum valid token type identifier
Examples
template tok(string symbol)
{
alias tok = TokenId!(IdType, staticTokens, dynamicTokens,
possibleDefaultTokens, symbol);
}
// num and plus are of type ubyte.
IdType plus = tok!"+";
IdType num = tok!"numberLiteral";