From 2e9f5d1c98af76dbab4960f095a5fef1ddfc7db5 Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Wed, 23 May 2018 11:57:52 +0200 Subject: Introduces emit token and removes identifier workaround. --- libsolidity/parsing/Parser.cpp | 9 ++++++--- libsolidity/parsing/Token.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'libsolidity') diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index aec9ebbb..e9810fe3 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -939,10 +939,11 @@ ASTPointer Parser::parseStatement() } case Token::Assembly: return parseInlineAssembly(docString); + case Token::Emit: + statement = parseEmitStatement(docString); + break; case Token::Identifier: - if (m_scanner->currentLiteral() == "emit") - statement = parseEmitStatement(docString); - else if (m_insideModifier && m_scanner->currentLiteral() == "_") + if (m_insideModifier && m_scanner->currentLiteral() == "_") { statement = ASTNodeFactory(*this).createNode(docString); m_scanner->next(); @@ -1062,6 +1063,8 @@ ASTPointer Parser::parseForStatement(ASTPointer const& ASTPointer Parser::parseEmitStatement(ASTPointer const& _docString) { + expectToken(Token::Emit, false); + ASTNodeFactory nodeFactory(*this); m_scanner->next(); ASTNodeFactory eventCallNodeFactory(*this); diff --git a/libsolidity/parsing/Token.h b/libsolidity/parsing/Token.h index 4d456550..845a97bc 100644 --- a/libsolidity/parsing/Token.h +++ b/libsolidity/parsing/Token.h @@ -149,6 +149,7 @@ namespace solidity K(Do, "do", 0) \ K(Else, "else", 0) \ K(Enum, "enum", 0) \ + K(Emit, "emit", 0) \ K(Event, "event", 0) \ K(External, "external", 0) \ K(For, "for", 0) \ -- cgit v1.2.3