diff options
Diffstat (limited to 'Parser.cpp')
-rw-r--r-- | Parser.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
@@ -266,12 +266,11 @@ ASTPointer<StructDefinition> Parser::parseStructDefinition() return nodeFactory.createNode<StructDefinition>(name, members); } -ASTPointer<EnumValue> Parser::parseEnumDeclaration() +ASTPointer<EnumValue> Parser::parseEnumValue() { ASTNodeFactory nodeFactory(*this); - ASTPointer<ASTString> name = expectIdentifierToken(); nodeFactory.markEndPosition(); - return nodeFactory.createNode<EnumValue>(name); + return nodeFactory.createNode<EnumValue>(expectIdentifierToken()); } ASTPointer<EnumDefinition> Parser::parseEnumDefinition() @@ -284,13 +283,12 @@ ASTPointer<EnumDefinition> Parser::parseEnumDefinition() while (m_scanner->getCurrentToken() != Token::RBrace) { - members.push_back(parseEnumDeclaration()); + members.push_back(parseEnumValue()); if (m_scanner->getCurrentToken() == Token::RBrace) break; expectToken(Token::Comma); - if (m_scanner->getCurrentToken() != Token::Identifier) { + if (m_scanner->getCurrentToken() != Token::Identifier) BOOST_THROW_EXCEPTION(createParserError("Expected Identifier after ','")); - } } nodeFactory.markEndPosition(); @@ -859,13 +857,6 @@ ASTPointer<ASTString> Parser::expectIdentifierToken() return getLiteralAndAdvance(); } -ASTPointer<ASTString> Parser::peekIdentifierToken() -{ - if (m_scanner->getCurrentToken() != Token::Identifier) - return nullptr; - return getLiteralAndAdvance(); -} - ASTPointer<ASTString> Parser::getLiteralAndAdvance() { ASTPointer<ASTString> identifier = make_shared<ASTString>(m_scanner->getCurrentLiteral()); |