Merge pull request #101 from AndrejMitrovic/FixTokenIdIndex
TokenId should take tokens length + 1 when determining integral type to make room for tok!""
This commit is contained in:
commit
4ec32b5772
|
@ -118,11 +118,11 @@ module stdx.lexer;
|
|||
template TokenIdType(alias staticTokens, alias dynamicTokens,
|
||||
alias possibleDefaultTokens)
|
||||
{
|
||||
static if ((staticTokens.length + dynamicTokens.length + possibleDefaultTokens.length) <= ubyte.max)
|
||||
static if ((staticTokens.length + dynamicTokens.length + possibleDefaultTokens.length + 1) <= ubyte.max)
|
||||
alias TokenIdType = ubyte;
|
||||
else static if ((staticTokens.length + dynamicTokens.length + possibleDefaultTokens.length) <= ushort.max)
|
||||
else static if ((staticTokens.length + dynamicTokens.length + possibleDefaultTokens.length + 1) <= ushort.max)
|
||||
alias TokenIdType = ushort;
|
||||
else static if ((staticTokens.length + dynamicTokens.length + possibleDefaultTokens.length) <= uint.max)
|
||||
else static if ((staticTokens.length + dynamicTokens.length + possibleDefaultTokens.length + 1) <= uint.max)
|
||||
alias TokenIdType = uint;
|
||||
else
|
||||
static assert (false);
|
||||
|
|
Loading…
Reference in New Issue