diff options
Diffstat (limited to 'libsolidity/parsing/Parser.h')
-rw-r--r-- | libsolidity/parsing/Parser.h | 20 |
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(); |