From d61b911a3a02962d5c38ad8b77ab650352529659 Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Wed, 11 Jan 2017 00:51:28 -0300 Subject: [PATCH 1/3] grammar.txt: Move StorageLocation? up to VariableDeclaration --- docs/grammar.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/grammar.txt b/docs/grammar.txt index b5d2b7803..2300dd00d 100644 --- a/docs/grammar.txt +++ b/docs/grammar.txt @@ -35,10 +35,10 @@ TypeNameList = '(' ( TypeName (',' TypeName )* )? ')' // semantic restriction: mappings and structs (recursively) containing mappings // are not allowed in argument lists -VariableDeclaration = TypeName Identifier +VariableDeclaration = TypeName StorageLocation? Identifier TypeName = ElementaryTypeName - | UserDefinedTypeName StorageLocation? + | UserDefinedTypeName | Mapping | ArrayTypeName | FunctionTypeName @@ -46,7 +46,7 @@ TypeName = ElementaryTypeName UserDefinedTypeName = Identifier ( '.' Identifier )* Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')' -ArrayTypeName = TypeName '[' Expression? ']' StorageLocation? +ArrayTypeName = TypeName '[' Expression? ']' FunctionTypeName = 'function' TypeNameList ( 'internal' | 'external' | 'constant' | 'payable' )* ( 'returns' TypeNameList )? StorageLocation = 'memory' | 'storage' From c15b0fb596a3466a8f31f9b4f9cd0289091264aa Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Wed, 11 Jan 2017 01:33:17 -0300 Subject: [PATCH 2/3] grammar.txt: Add named function arguments --- docs/grammar.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/grammar.txt b/docs/grammar.txt index 2300dd00d..f45a62e7f 100644 --- a/docs/grammar.txt +++ b/docs/grammar.txt @@ -97,7 +97,13 @@ PrimaryExpression = Identifier | StringLiteral | ElementaryTypeNameExpression -FunctionCall = ( PrimaryExpression | NewExpression | TypeName ) ( ( '.' Identifier ) | ( '[' Expression ']' ) )* '(' Expression? ( ',' Expression )* ')' +ExpressionList = Expression ( ',' Expression )* +NameValueList = Identifier ':' Expression ( ',' Identifier ':' Expression )* + +FunctionCall = ( PrimaryExpression | NewExpression | TypeName ) ( ( '.' Identifier ) | ( '[' Expression ']' ) )* '(' FunctionCallArguments ')' +FunctionCallArguments = '{' NameValueList? '}' + | ExpressionList? + NewExpression = 'new' Identifier MemberAccess = Expression '.' Identifier IndexAccess = Expression '[' Expression? ']' From 26eff0e0d8c0c34a614e6c7151e248168f72cab7 Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Wed, 11 Jan 2017 01:35:29 -0300 Subject: [PATCH 3/3] grammar.txt: Replace Identifier for Typename in NewExpression --- docs/grammar.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/grammar.txt b/docs/grammar.txt index f45a62e7f..62b4a0212 100644 --- a/docs/grammar.txt +++ b/docs/grammar.txt @@ -104,7 +104,7 @@ FunctionCall = ( PrimaryExpression | NewExpression | TypeName ) ( ( '.' Identifi FunctionCallArguments = '{' NameValueList? '}' | ExpressionList? -NewExpression = 'new' Identifier +NewExpression = 'new' TypeName MemberAccess = Expression '.' Identifier IndexAccess = Expression '[' Expression? ']'