Allow future keywords to be accessed as members in a struct.
This fixes a bug where a token that could be a keyword in one version is not a keyword in another version, but treated like a non-member after a "." dereference.
This commit is contained in:
parent
6373574b13
commit
eb505e4262
7 changed files with 41 additions and 12 deletions
|
|
@ -598,7 +598,12 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
|
|||
case PpAtomConstUint: parserToken->sType.lex.i = ppToken.ival; return UINTCONSTANT;
|
||||
case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT;
|
||||
case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT;
|
||||
case PpAtomIdentifier: return tokenizeIdentifier();
|
||||
case PpAtomIdentifier:
|
||||
{
|
||||
int token = tokenizeIdentifier();
|
||||
field = false;
|
||||
return token;
|
||||
}
|
||||
|
||||
case EndOfInput: return 0;
|
||||
|
||||
|
|
@ -623,7 +628,6 @@ int TScanContext::tokenizeIdentifier()
|
|||
return identifierOrType();
|
||||
}
|
||||
keyword = it->second;
|
||||
field = false;
|
||||
|
||||
switch (keyword) {
|
||||
case CONST:
|
||||
|
|
@ -1020,11 +1024,8 @@ int TScanContext::tokenizeIdentifier()
|
|||
int TScanContext::identifierOrType()
|
||||
{
|
||||
parserToken->sType.lex.string = NewPoolTString(tokenText);
|
||||
if (field) {
|
||||
field = false;
|
||||
|
||||
return FIELD_SELECTION;
|
||||
}
|
||||
if (field)
|
||||
return IDENTIFIER;
|
||||
|
||||
parserToken->sType.lex.symbol = parseContext.symbolTable.find(*parserToken->sType.lex.string);
|
||||
if (afterType == false && parserToken->sType.lex.symbol) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue