aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-11-30 01:55:27 +0800
committerchriseth <chris@ethereum.org>2018-12-01 01:24:15 +0800
commit436696d3b647ccf1b7fed4edbf86c7cd37950839 (patch)
treeccc83ffadebd9df9604236edce974cea5f9f2d50
parentcc00d8172b6cd7f9fc032e4a21857455ace2f290 (diff)
downloaddexon-solidity-436696d3b647ccf1b7fed4edbf86c7cd37950839.tar
dexon-solidity-436696d3b647ccf1b7fed4edbf86c7cd37950839.tar.gz
dexon-solidity-436696d3b647ccf1b7fed4edbf86c7cd37950839.tar.bz2
dexon-solidity-436696d3b647ccf1b7fed4edbf86c7cd37950839.tar.lz
dexon-solidity-436696d3b647ccf1b7fed4edbf86c7cd37950839.tar.xz
dexon-solidity-436696d3b647ccf1b7fed4edbf86c7cd37950839.tar.zst
dexon-solidity-436696d3b647ccf1b7fed4edbf86c7cd37950839.zip
Update assembly grammar part.
-rw-r--r--docs/grammar.txt35
1 files changed, 27 insertions, 8 deletions
diff --git a/docs/grammar.txt b/docs/grammar.txt
index b9c8ddb9..3d2c9bc3 100644
--- a/docs/grammar.txt
+++ b/docs/grammar.txt
@@ -72,7 +72,7 @@ WhileStatement = 'while' '(' Expression ')' Statement
PlaceholderStatement = '_'
SimpleStatement = VariableDefinition | ExpressionStatement
ForStatement = 'for' '(' (SimpleStatement)? ';' (Expression)? ';' (ExpressionStatement)? ')' Statement
-InlineAssemblyStatement = 'assembly' StringLiteral? InlineAssemblyBlock
+InlineAssemblyStatement = 'assembly' StringLiteral? AssemblyBlock
DoWhileStatement = 'do' Statement 'while' '(' Expression ')'
Continue = 'continue'
Break = 'break'
@@ -152,11 +152,30 @@ Fixed = 'fixed' | ( 'fixed' [0-9]+ 'x' [0-9]+ )
Ufixed = 'ufixed' | ( 'ufixed' [0-9]+ 'x' [0-9]+ )
-InlineAssemblyBlock = '{' AssemblyItem* '}'
-AssemblyItem = Identifier | FunctionalAssemblyExpression | InlineAssemblyBlock | AssemblyVariableDeclaration | AssemblyAssignment | AssemblyLabel | NumberLiteral | StringLiteral | HexLiteral
-AssemblyExpression = Identifier | FunctionalAssemblyExpression | NumberLiteral | StringLiteral | HexLiteral
-AssemblyVariableDeclaration = 'let' Identifier ':=' AssemblyExpression
-AssemblyAssignment = ( Identifier ':=' AssemblyExpression ) | ( '=:' Identifier )
-AssemblyLabel = Identifier ':'
-FunctionalAssemblyExpression = Identifier '(' AssemblyItem? ( ',' AssemblyItem )* ')'
+AssemblyBlock = '{' AssemblyStatement* '}'
+
+AssemblyStatement = AssemblyBlock
+ | AssemblyFunctionDefinition
+ | AssemblyVariableDeclaration
+ | AssemblyAssignment
+ | AssemblyIf
+ | AssemblyExpression
+ | AssemblySwitch
+ | AssemblyForLoop
+ | AssemblyBreakContinue
+AssemblyFunctionDefinition =
+ 'function' Identifier '(' AssemblyIdentifierList? ')'
+ ( '->' AssemblyIdentifierList )? AssemblyBlock
+AssemblyVariableDeclaration = 'let' AssemblyIdentifierList ( ':=' AssemblyExpression )?
+AssemblyAssignment = AssemblyIdentifierList ':=' AssemblyExpression
+AssemblyExpression = AssemblyFunctionCall | Identifier | Literal
+AssemblyIf = 'if' AssemblyExpression AssemblyBlock
+AssemblySwitch = 'switch' AssemblyExpression ( Case+ AssemblyDefault? | AssemblyDefault )
+AssemblyCase = 'case' Literal AssemblyBlock
+AssemblyDefault = 'default' AssemblyBlock
+AssemblyForLoop = 'for' AssemblyBlock AssemblyExpression AssemblyBlock AssemblyBlock
+AssemblyBreakContinue = 'break' | 'continue'
+AssemblyFunctionCall = Identifier '(' ( AssemblyExpression ( ',' AssemblyExpression )* )? ')'
+
+AssemblyIdentifierList = Identifier ( ',' Identifier )*