From 968934c05d260cb3149cbcd57014701a32987480 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 22 Feb 2016 02:13:32 +0100 Subject: Move reusable parser components into base class. --- libsolidity/parsing/Parser.h | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) (limited to 'libsolidity/parsing/Parser.h') diff --git a/libsolidity/parsing/Parser.h b/libsolidity/parsing/Parser.h index eb1aa587..9db3b3c4 100644 --- a/libsolidity/parsing/Parser.h +++ b/libsolidity/parsing/Parser.h @@ -22,7 +22,8 @@ #pragma once -#include "libsolidity/ast/AST.h" +#include +#include namespace dev { @@ -31,22 +32,16 @@ namespace solidity class Scanner; -class Parser +class Parser: public ParserBase { public: - Parser(ErrorList& errors): m_errors(errors){}; + Parser(ErrorList& _errors): ParserBase(_errors) {} ASTPointer parse(std::shared_ptr const& _scanner); - std::shared_ptr const& sourceName() const; private: class ASTNodeFactory; - /// Start position of the current token - int position() const; - /// End position of the current token - int endPosition() const; - struct VarDeclParserOptions { VarDeclParserOptions() {} @@ -139,29 +134,13 @@ private: std::vector> const& _path, std::vector, SourceLocation>> const& _indices ); - /// If current token value is not _value, throw exception otherwise advance token. - void expectToken(Token::Value _value); - Token::Value expectAssignmentOperator(); - ASTPointer expectIdentifierToken(); - ASTPointer getLiteralAndAdvance(); ///@} /// Creates an empty ParameterList at the current location (used if parameters can be omitted). ASTPointer createEmptyParameterList(); - /// Creates a @ref ParserError and annotates it with the current position and the - /// given @a _description. - void parserError(std::string const& _description); - - /// Creates a @ref ParserError and annotates it with the current position and the - /// given @a _description. Throws the FatalError. - void fatalParserError(std::string const& _description); - - std::shared_ptr m_scanner; /// Flag that signifies whether '_' is parsed as a PlaceholderStatement or a regular identifier. bool m_insideModifier = false; - /// The reference to the list of errors and warning to add errors/warnings during parsing - ErrorList& m_errors; }; } -- cgit v1.2.3