TokenId should take tokens length + 1 when determining integral type to make room for tok!""
This commit is contained in:
parent
2293c33420
commit
e6109eebdc
|
@ -118,11 +118,11 @@ module stdx.lexer;
|
||||||
template TokenIdType(alias staticTokens, alias dynamicTokens,
|
template TokenIdType(alias staticTokens, alias dynamicTokens,
|
||||||
alias possibleDefaultTokens)
|
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;
|
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;
|
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;
|
alias TokenIdType = uint;
|
||||||
else
|
else
|
||||||
static assert (false);
|
static assert (false);
|
||||||
|
|
Loading…
Reference in New Issue