aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorNicolai <NicolaiSoeborg@users.noreply.github.com>2016-07-23 22:15:01 +0800
committerNicolai <NicolaiSoeborg@users.noreply.github.com>2016-07-23 22:15:01 +0800
commitbd2562ffd326ad91bb0b4bd262ffafb2516d9393 (patch)
treee712abb1a36680f838c0d4de8ade38bd8e18ed48 /libsolidity
parent28c4a0a3ab37731c5f6cfea2a5d56303e187ad3f (diff)
downloaddexon-solidity-bd2562ffd326ad91bb0b4bd262ffafb2516d9393.tar
dexon-solidity-bd2562ffd326ad91bb0b4bd262ffafb2516d9393.tar.gz
dexon-solidity-bd2562ffd326ad91bb0b4bd262ffafb2516d9393.tar.bz2
dexon-solidity-bd2562ffd326ad91bb0b4bd262ffafb2516d9393.tar.lz
dexon-solidity-bd2562ffd326ad91bb0b4bd262ffafb2516d9393.tar.xz
dexon-solidity-bd2562ffd326ad91bb0b4bd262ffafb2516d9393.tar.zst
dexon-solidity-bd2562ffd326ad91bb0b4bd262ffafb2516d9393.zip
Order expression according to PR 732
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/grammar.txt27
1 files changed, 18 insertions, 9 deletions
diff --git a/libsolidity/grammar.txt b/libsolidity/grammar.txt
index 7c1d97e9..b71508dd 100644
--- a/libsolidity/grammar.txt
+++ b/libsolidity/grammar.txt
@@ -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