diff options
-rwxr-xr-x | AST.h | 3 | ||||
-rw-r--r-- | Parser.cpp | 13 | ||||
-rw-r--r-- | Token.h | 2 |
3 files changed, 15 insertions, 3 deletions
@@ -158,10 +158,12 @@ public: ContractDefinition(Location const& _location, ASTPointer<ASTString> const& _name, ASTPointer<ASTString> const& _documentation, + std::vector<ASTPointer<Identifier>> const& _baseContracts, std::vector<ASTPointer<StructDefinition>> const& _definedStructs, std::vector<ASTPointer<VariableDeclaration>> const& _stateVariables, std::vector<ASTPointer<FunctionDefinition>> const& _definedFunctions): Declaration(_location, _name), + m_baseContracts(_baseContracts), m_definedStructs(_definedStructs), m_stateVariables(_stateVariables), m_definedFunctions(_definedFunctions), @@ -193,6 +195,7 @@ public: private: std::vector<std::pair<FixedHash<4>, FunctionDefinition const*>> getInterfaceFunctionList() const; + std::vector<ASTPointer<Identifier>> m_baseContracts; std::vector<ASTPointer<StructDefinition>> m_definedStructs; std::vector<ASTPointer<VariableDeclaration>> m_stateVariables; std::vector<ASTPointer<FunctionDefinition>> m_definedFunctions; @@ -117,10 +117,18 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition() docstring = make_shared<ASTString>(m_scanner->getCurrentCommentLiteral()); expectToken(Token::CONTRACT); ASTPointer<ASTString> name = expectIdentifierToken(); - expectToken(Token::LBRACE); + vector<ASTPointer<Identifier>> baseContracts; vector<ASTPointer<StructDefinition>> structs; vector<ASTPointer<VariableDeclaration>> stateVariables; vector<ASTPointer<FunctionDefinition>> functions; + if (m_scanner->getCurrentToken() == Token::IS) + do + { + m_scanner->next(); + baseContracts.push_back(ASTNodeFactory(*this).createNode<Identifier>(expectIdentifierToken())); + } + while (m_scanner->getCurrentToken() == Token::COMMA); + expectToken(Token::LBRACE); bool visibilityIsPublic = true; while (true) { @@ -149,7 +157,8 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition() } nodeFactory.markEndPosition(); expectToken(Token::RBRACE); - return nodeFactory.createNode<ContractDefinition>(name, docstring, structs, stateVariables, functions); + return nodeFactory.createNode<ContractDefinition>(name, docstring, baseContracts, structs, + stateVariables, functions); } ASTPointer<FunctionDefinition> Parser::parseFunctionDefinition(bool _isPublic) @@ -153,7 +153,7 @@ namespace solidity K(DEFAULT, "default", 0) \ K(DO, "do", 0) \ K(ELSE, "else", 0) \ - K(EXTENDS, "extends", 0) \ + K(IS, "is", 0) \ K(FOR, "for", 0) \ K(FUNCTION, "function", 0) \ K(IF, "if", 0) \ |