aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xAST.h3
-rw-r--r--Parser.cpp13
-rw-r--r--Token.h2
3 files changed, 15 insertions, 3 deletions
diff --git a/AST.h b/AST.h
index 409aed44..e4761536 100755
--- a/AST.h
+++ b/AST.h
@@ -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;
diff --git a/Parser.cpp b/Parser.cpp
index ebff3ba4..26fc2018 100644
--- a/Parser.cpp
+++ b/Parser.cpp
@@ -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)
diff --git a/Token.h b/Token.h
index 9fb86e7f..552e9a75 100644
--- a/Token.h
+++ b/Token.h
@@ -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) \