aboutsummaryrefslogtreecommitdiffstats
path: root/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Parser.cpp')
-rw-r--r--Parser.cpp13
1 files changed, 11 insertions, 2 deletions
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)