aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing/Parser.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-26 16:42:56 +0800
committerchriseth <chris@ethereum.org>2018-04-26 16:59:02 +0800
commitd44fb033221e29a2e648ea248f85604cb9619237 (patch)
tree30d23d29c395424d406380996b7f6443ff67a571 /libsolidity/parsing/Parser.h
parentef2111a2fe89fef06a4d8e750d6a652b16358f4b (diff)
downloaddexon-solidity-d44fb033221e29a2e648ea248f85604cb9619237.tar
dexon-solidity-d44fb033221e29a2e648ea248f85604cb9619237.tar.gz
dexon-solidity-d44fb033221e29a2e648ea248f85604cb9619237.tar.bz2
dexon-solidity-d44fb033221e29a2e648ea248f85604cb9619237.tar.lz
dexon-solidity-d44fb033221e29a2e648ea248f85604cb9619237.tar.xz
dexon-solidity-d44fb033221e29a2e648ea248f85604cb9619237.tar.zst
dexon-solidity-d44fb033221e29a2e648ea248f85604cb9619237.zip
Refactor parser.
Diffstat (limited to 'libsolidity/parsing/Parser.h')
-rw-r--r--libsolidity/parsing/Parser.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/libsolidity/parsing/Parser.h b/libsolidity/parsing/Parser.h
index eb120a61..c4254231 100644
--- a/libsolidity/parsing/Parser.h
+++ b/libsolidity/parsing/Parser.h
@@ -145,21 +145,25 @@ private:
{
IndexAccessStructure, VariableDeclarationStatement, ExpressionStatement
};
+ /// Structure that represents a.b.c[x][y][z]. Can be converted either to an expression
+ /// or to a type name. Path cannot be empty, but indices can be empty.
+ struct IndexAccessedPath
+ {
+ std::vector<ASTPointer<PrimaryExpression>> path;
+ std::vector<std::pair<ASTPointer<Expression>, SourceLocation>> indices;
+ };
/// Performs limited look-ahead to distinguish between variable declaration and expression statement.
/// For source code of the form "a[][8]" ("IndexAccessStructure"), this is not possible to
/// decide with constant look-ahead.
LookAheadInfo peekStatementType() const;
+ /// @returns an IndexAccessedPath as a prestage to parsing a variable declaration (type name)
+ /// or an expression;
+ IndexAccessedPath parseIndexAccessedPath();
/// @returns a typename parsed in look-ahead fashion from something like "a.b[8][2**70]".
- ASTPointer<TypeName> typeNameIndexAccessStructure(
- std::vector<ASTPointer<PrimaryExpression>> const& _path,
- std::vector<std::pair<ASTPointer<Expression>, SourceLocation>> const& _indices
- );
+ ASTPointer<TypeName> typeNameFromIndexAccessStructure(IndexAccessedPath const& _pathAndIndices);
/// @returns an expression parsed in look-ahead fashion from something like "a.b[8][2**70]".
- ASTPointer<Expression> expressionFromIndexAccessStructure(
- std::vector<ASTPointer<PrimaryExpression>> const& _path,
- std::vector<std::pair<ASTPointer<Expression>, SourceLocation>> const& _indices
- );
+ ASTPointer<Expression> expressionFromIndexAccessStructure(IndexAccessedPath const& _pathAndIndices);
std::string currentTokenName();
Token::Value expectAssignmentOperator();