aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing/Parser.h
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-02-22 09:13:32 +0800
committerchriseth <c@ethdev.com>2016-02-23 01:02:29 +0800
commit968934c05d260cb3149cbcd57014701a32987480 (patch)
tree72496c588192d4677d9127ba8b6e8d36e7408860 /libsolidity/parsing/Parser.h
parent37381072dec7636bd4648cbc291ae79c1b1fa450 (diff)
downloaddexon-solidity-968934c05d260cb3149cbcd57014701a32987480.tar.gz
dexon-solidity-968934c05d260cb3149cbcd57014701a32987480.tar.zst
dexon-solidity-968934c05d260cb3149cbcd57014701a32987480.zip
Move reusable parser components into base class.
Diffstat (limited to 'libsolidity/parsing/Parser.h')
-rw-r--r--libsolidity/parsing/Parser.h29
1 files changed, 4 insertions, 25 deletions
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 <libsolidity/ast/AST.h>
+#include <libsolidity/parsing/ParserBase.h>
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<SourceUnit> parse(std::shared_ptr<Scanner> const& _scanner);
- std::shared_ptr<std::string const> 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<ASTPointer<PrimaryExpression>> const& _path,
std::vector<std::pair<ASTPointer<Expression>, SourceLocation>> const& _indices
);
- /// If current token value is not _value, throw exception otherwise advance token.
- void expectToken(Token::Value _value);
- Token::Value expectAssignmentOperator();
- ASTPointer<ASTString> expectIdentifierToken();
- ASTPointer<ASTString> getLiteralAndAdvance();
///@}
/// Creates an empty ParameterList at the current location (used if parameters can be omitted).
ASTPointer<ParameterList> 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<Scanner> 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;
};
}