diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-14 05:52:04 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-14 06:16:14 +0800 |
commit | b2575b4bcbd15ec8353a01ae53133f6e71115cce (patch) | |
tree | ba14d6c97ca00ddc6d77876e6876c16eb7664803 /Parser.cpp | |
parent | b20ce4451bb4c2b64b112b8654b36502ae654a24 (diff) | |
download | dexon-solidity-b2575b4bcbd15ec8353a01ae53133f6e71115cce.tar dexon-solidity-b2575b4bcbd15ec8353a01ae53133f6e71115cce.tar.gz dexon-solidity-b2575b4bcbd15ec8353a01ae53133f6e71115cce.tar.bz2 dexon-solidity-b2575b4bcbd15ec8353a01ae53133f6e71115cce.tar.lz dexon-solidity-b2575b4bcbd15ec8353a01ae53133f6e71115cce.tar.xz dexon-solidity-b2575b4bcbd15ec8353a01ae53133f6e71115cce.tar.zst dexon-solidity-b2575b4bcbd15ec8353a01ae53133f6e71115cce.zip |
Addressing issues with Enums in Solidity
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()); |