Order expression according to PR 732

This commit is contained in:
Nicolai 2016-07-23 16:15:01 +02:00
parent 28c4a0a3ab
commit bd2562ffd3

View File

@ -37,7 +37,7 @@ ArrayTypeName = TypeName '[' Expression? ']'
Block = '{' Statement* '}'
Statement = IfStatement | WhileStatement | ForStatement | Block |
( Continue | Break | Return | Throw | VardefOrExprStmt ) ';'
( Continue | Break | Return | Throw | VardefOrExprStmt | ExpressionStatement ) ';'
ExpressionStatement = Expression | VariableDefinition | Assignment | 'delete' Expression
IfStatement = 'if' '(' Expression ')' Statement ( 'else' Statement )?
@ -51,18 +51,27 @@ Throw = 'throw'
VariableDefinition = VariableDeclaration ( '=' Expression )?
Assignment = Expression ('=' | '|=' | '^=' | '&=' | '<<=' | '>>=' | '+=' | '-=' | '*=' | '/=' | '%=') Expression
// Precedence by order (see github.com/ethereum/solidity/pull/732)
Expression =
('!' | '~' | '++' | '--') expression
| expression ('**' | '*' | '/' | '%') expression
| expression ('|' | '^' | '&' | '<<' | '>>') expression
| expression ('+' | '-') expression
| expression ('<=' | '>=' | '<' | '>') expression
| expression ('==' | '!=') expression
| expression ('&&' | '||') expression
( Expression ('++' | '--') | FunctionCall | IndexAccess | MemberAccess | '(' Expression ')' )
| ('++' | '--' | '+' | '-' | '!' | '~') Expression
| Expression '**' Expression
| Expression ('*' | '/' | '%') Expression
| Expression ('+' | '-') Expression
| Expression ('<<' | '>>' | '>>>')
| Expression '&' Expression
| Expression '^' Expression
| Expression '|' Expression
| Expression ('<' | '>' | '<=' | '>=') Expression
| Expression ('==' | '!=') Expression
| Expression '&&' Expression
| Expression '||' Expression
| Expression '?' Expression ':' Expression
| Expression ('=' | '|=' | '^=' | '&=' | '<<=' | '/=' | '%=') Expression
| Expression ',' Expression
| PrimaryExpression
PrimaryExpression = Identifier | BooleanLiteral | NumberLiteral | StringLiteral
| FunctionCall | MemberAccess | IndexAccess | '(' Expression ')'
FunctionCall = Identifier '(' Expression? ( ',' Expression )* ')'
NewExpression = 'new' Identifier