Raise proper error on reserved keywords

This commit is contained in:
Alex Beregszaszi 2016-09-06 02:22:02 +01:00
parent cfb6dfc35e
commit a13c5b3157

View File

@ -47,7 +47,17 @@ void ParserBase::expectToken(Token::Value _value)
Token::Value tok = m_scanner->currentToken(); Token::Value tok = m_scanner->currentToken();
if (tok != _value) if (tok != _value)
{ {
if (Token::isElementaryTypeName(tok)) //for the sake of accuracy in reporting if (Token::isReservedKeyword(tok))
{
fatalParserError(
string("Expected token ") +
string(Token::name(_value)) +
string(" got reserved keyword '") +
string(Token::name(tok)) +
string("'")
);
}
else if (Token::isElementaryTypeName(tok)) //for the sake of accuracy in reporting
{ {
ElementaryTypeNameToken elemTypeName = m_scanner->currentElementaryTypeNameToken(); ElementaryTypeNameToken elemTypeName = m_scanner->currentElementaryTypeNameToken();
fatalParserError( fatalParserError(