Accept name constants in the grammar

This commit is contained in:
Randy Heit 2013-09-10 21:56:13 -05:00
commit 33e835b58d
3 changed files with 18 additions and 0 deletions

View file

@ -139,6 +139,7 @@ static void InitTokenMap()
TOKENDEF (TK_Identifier, ZCC_IDENTIFIER);
TOKENDEF (TK_StringConst, ZCC_STRCONST);
TOKENDEF (TK_NameConst, ZCC_NAMECONST);
TOKENDEF (TK_IntConst, ZCC_INTCONST);
TOKENDEF (TK_UIntConst, ZCC_UINTCONST);
TOKENDEF (TK_FloatConst, ZCC_FLOATCONST);
@ -193,6 +194,11 @@ static void DoParse(const char *filename)
value.String = state.Strings.Alloc(sc.String, sc.StringLen);
tokentype = ZCC_STRCONST;
}
else if (sc.TokenType == TK_NameConst)
{
value.Int = sc.Name;
tokentype = ZCC_NAMECONST;
}
else if (sc.TokenType == TK_IntConst)
{
value.Int = sc.Number;