aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorNicolai <NicolaiSoeborg@users.noreply.github.com>2016-07-19 23:27:53 +0800
committerNicolai <NicolaiSoeborg@users.noreply.github.com>2016-07-19 23:27:53 +0800
commit447797ad9c5228ca50a4fa5b17ced4aba07e8d65 (patch)
tree6f48f73016b0f150b332c06edcd2ca6813e84962 /libsolidity
parentdc3828ee371acbe6cdfdb538b416c4bca12b8cef (diff)
downloaddexon-solidity-447797ad9c5228ca50a4fa5b17ced4aba07e8d65.tar.gz
dexon-solidity-447797ad9c5228ca50a4fa5b17ced4aba07e8d65.tar.zst
dexon-solidity-447797ad9c5228ca50a4fa5b17ced4aba07e8d65.zip
Add forStmt to Stmt, removes BasicBinaryOperation, throw expr, explicit rec in ArrTypeName
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/grammar.txt13
1 files changed, 6 insertions, 7 deletions
diff --git a/libsolidity/grammar.txt b/libsolidity/grammar.txt
index 5b16db9c..64ecff60 100644
--- a/libsolidity/grammar.txt
+++ b/libsolidity/grammar.txt
@@ -20,10 +20,10 @@ ParameterList = '(' ( VariableDeclaration (',' VariableDeclaration)* )? ')'
VariableDeclaration = TypeName Identifier
TypeName = ElementaryTypeName | Identifier | Mapping | ArrayTypeName
Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')'
-ArrayTypeName = TypeName ('[' Expression? ']')+
+ArrayTypeName = TypeName '[' Expression? ']'
Block = '{' Statement* '}'
-Statement = IfStatement | WhileStatement | Block |
+Statement = IfStatement | WhileStatement | ForStatement | Block |
( Continue | Break | Return | Throw | VariableDefinition | ExpressionStatement ) ';'
ExpressionStatement = Expression
@@ -34,18 +34,17 @@ ForStatement = 'for' '(' (VardefOrExprStmt)? ';' (Expression)? ';' (ExpressionSt
Continue = 'continue'
Break = 'break'
Return = 'return' Expression?
-Throw = 'throw' Expression?
+Throw = 'throw'
VariableDefinition = VariableDeclaration ( '=' Expression )?
Expression = Assignment | UnaryOperation | BinaryOperation | FunctionCall | NewExpression | IndexAccess |
MemberAccess | PrimaryExpression
// The expression syntax is actually much more complicated
Assignment = Expression (AssignmentOp Expression)
-BasicBinaryOperation = '|' | '^' | '&' | '<<' | '>>' | '>>>' | '+' | '-' | '*' | '/' | '%'
-AssignmentOp = BasicBinaryOperation'='
+AssignmentOp = '|=' | '^=' | '&=' | '<<=' | '>>=' | '+=' | '-=' | '*=' | '/=' | '%='
UnaryOperation = '!' | '~' | '++' | '--' | 'delete'
-BinaryOperation = BasicBinaryOperation | '||' | '&&' | '**' |
- '==' | '!=' | '<' | '>' | '<=' | '>='
+BinaryOperation = '|' | '^' | '&' | '<<' | '>>' | '+' | '-' | '*' | '/' | '%'
+ | '||' | '&&' | '**' | '==' | '!=' | '<' | '>' | '<=' | '>='
FunctionCall = Identifier '(' Expression? ( ',' Expression )* ')'
NewExpression = 'new' Identifier