aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/grammar.txt
diff options
context:
space:
mode:
authorwalter-weinmann <walter.weinmann@gmail.com>2016-09-06 11:18:43 +0800
committerwalter-weinmann <walter.weinmann@gmail.com>2016-09-06 11:26:18 +0800
commit215fc048575bfb4d4949bf6d16a4e4b6bc024769 (patch)
treeaf5523ff003a5aad613af7206509958e03e0f188 /libsolidity/grammar.txt
parent8f233b545f3053982fc4320d820ebb8d732b3a43 (diff)
downloaddexon-solidity-215fc048575bfb4d4949bf6d16a4e4b6bc024769.tar.gz
dexon-solidity-215fc048575bfb4d4949bf6d16a4e4b6bc024769.tar.zst
dexon-solidity-215fc048575bfb4d4949bf6d16a4e4b6bc024769.zip
Considering comments from @chriseth regarding ExpressionStatement and FunctionCall.
Diffstat (limited to 'libsolidity/grammar.txt')
-rw-r--r--libsolidity/grammar.txt10
1 files changed, 6 insertions, 4 deletions
diff --git a/libsolidity/grammar.txt b/libsolidity/grammar.txt
index 969b9e53..e636fd72 100644
--- a/libsolidity/grammar.txt
+++ b/libsolidity/grammar.txt
@@ -45,11 +45,11 @@ Statement = IfStatement | WhileStatement | ForStatement | Block |
( PlaceholderStatement | Continue | Break | Return |
Throw | SimpleStatement ) ';'
-ExpressionStatement = Expression | VariableDefinition
+ExpressionStatement = Expression
IfStatement = 'if' '(' Expression ')' Statement ( 'else' Statement )?
WhileStatement = 'while' '(' Expression ')' Statement
PlaceholderStatement = '_'
-SimpleStatement = ExpressionStatement
+SimpleStatement = VariableDefinition | ExpressionStatement
ForStatement = 'for' '(' (SimpleStatement)? ';' (Expression)? ';' (ExpressionStatement)? ')' Statement
Continue = 'continue'
Break = 'break'
@@ -59,7 +59,7 @@ VariableDefinition = VariableDeclaration ( '=' Expression )?
// Precedence by order (see github.com/ethereum/solidity/pull/732)
Expression =
- ( Expression ('++' | '--') | FunctionCall | IndexAccess | MemberAccess | NewExpression | ( TypeName? '(' Expression ')' ) )
+ ( Expression ('++' | '--') | FunctionCall | IndexAccess | MemberAccess | '(' Expression ')' )
| ('!' | '~' | 'delete' | '++' | '--' | '+' | '-') Expression
| Expression '**' Expression
| Expression ('*' | '/' | '%') Expression
@@ -79,10 +79,12 @@ Expression =
PrimaryExpression = Identifier | BooleanLiteral | NumberLiteral | StringLiteral
-FunctionCall = ( Identifier | MemberAccess ) '(' Expression? ( ',' Expression )* ')'
+FunctionCall = ( MemberAccessFunctionCall | IndexAccessFunctionCall ) '(' Expression? ( ',' Expression )* ')'
NewExpression = 'new' Identifier
MemberAccess = Expression '.' Identifier
+MemberAccessFunctionCall = ( PrimaryExpression | NewExpression | TypeName ) ( '.' ( PrimaryExpression | NewExpression | TypeName ) )*
IndexAccess = Expression '[' Expression? ']'
+IndexAccessFunctionCall = ( PrimaryExpression | NewExpression | TypeName ) '[' Expression? ']'
BooleanLiteral = 'true' | 'false'
NumberLiteral = '0x'? [0-9]+ (' ' NumberUnit)?