mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Considering comments from @chriseth regarding ExpressionStatement and FunctionCall.
This commit is contained in:
parent
8f233b545f
commit
215fc04857
@ -45,11 +45,11 @@ Statement = IfStatement | WhileStatement | ForStatement | Block |
|
|||||||
( PlaceholderStatement | Continue | Break | Return |
|
( PlaceholderStatement | Continue | Break | Return |
|
||||||
Throw | SimpleStatement ) ';'
|
Throw | SimpleStatement ) ';'
|
||||||
|
|
||||||
ExpressionStatement = Expression | VariableDefinition
|
ExpressionStatement = Expression
|
||||||
IfStatement = 'if' '(' Expression ')' Statement ( 'else' Statement )?
|
IfStatement = 'if' '(' Expression ')' Statement ( 'else' Statement )?
|
||||||
WhileStatement = 'while' '(' Expression ')' Statement
|
WhileStatement = 'while' '(' Expression ')' Statement
|
||||||
PlaceholderStatement = '_'
|
PlaceholderStatement = '_'
|
||||||
SimpleStatement = ExpressionStatement
|
SimpleStatement = VariableDefinition | ExpressionStatement
|
||||||
ForStatement = 'for' '(' (SimpleStatement)? ';' (Expression)? ';' (ExpressionStatement)? ')' Statement
|
ForStatement = 'for' '(' (SimpleStatement)? ';' (Expression)? ';' (ExpressionStatement)? ')' Statement
|
||||||
Continue = 'continue'
|
Continue = 'continue'
|
||||||
Break = 'break'
|
Break = 'break'
|
||||||
@ -59,7 +59,7 @@ VariableDefinition = VariableDeclaration ( '=' Expression )?
|
|||||||
|
|
||||||
// Precedence by order (see github.com/ethereum/solidity/pull/732)
|
// Precedence by order (see github.com/ethereum/solidity/pull/732)
|
||||||
Expression =
|
Expression =
|
||||||
( Expression ('++' | '--') | FunctionCall | IndexAccess | MemberAccess | NewExpression | ( TypeName? '(' Expression ')' ) )
|
( Expression ('++' | '--') | FunctionCall | IndexAccess | MemberAccess | '(' Expression ')' )
|
||||||
| ('!' | '~' | 'delete' | '++' | '--' | '+' | '-') Expression
|
| ('!' | '~' | 'delete' | '++' | '--' | '+' | '-') Expression
|
||||||
| Expression '**' Expression
|
| Expression '**' Expression
|
||||||
| Expression ('*' | '/' | '%') Expression
|
| Expression ('*' | '/' | '%') Expression
|
||||||
@ -79,10 +79,12 @@ Expression =
|
|||||||
|
|
||||||
PrimaryExpression = Identifier | BooleanLiteral | NumberLiteral | StringLiteral
|
PrimaryExpression = Identifier | BooleanLiteral | NumberLiteral | StringLiteral
|
||||||
|
|
||||||
FunctionCall = ( Identifier | MemberAccess ) '(' Expression? ( ',' Expression )* ')'
|
FunctionCall = ( MemberAccessFunctionCall | IndexAccessFunctionCall ) '(' Expression? ( ',' Expression )* ')'
|
||||||
NewExpression = 'new' Identifier
|
NewExpression = 'new' Identifier
|
||||||
MemberAccess = Expression '.' Identifier
|
MemberAccess = Expression '.' Identifier
|
||||||
|
MemberAccessFunctionCall = ( PrimaryExpression | NewExpression | TypeName ) ( '.' ( PrimaryExpression | NewExpression | TypeName ) )*
|
||||||
IndexAccess = Expression '[' Expression? ']'
|
IndexAccess = Expression '[' Expression? ']'
|
||||||
|
IndexAccessFunctionCall = ( PrimaryExpression | NewExpression | TypeName ) '[' Expression? ']'
|
||||||
|
|
||||||
BooleanLiteral = 'true' | 'false'
|
BooleanLiteral = 'true' | 'false'
|
||||||
NumberLiteral = '0x'? [0-9]+ (' ' NumberUnit)?
|
NumberLiteral = '0x'? [0-9]+ (' ' NumberUnit)?
|
||||||
|
Loading…
Reference in New Issue
Block a user