From 8f233b545f3053982fc4320d820ebb8d732b3a43 Mon Sep 17 00:00:00 2001 From: walter-weinmann <walter.weinmann@gmail.com> Date: Mon, 5 Sep 2016 18:58:58 +0200 Subject: Changes related to issues #984, #989, #999, #1001 and #1004. --- libsolidity/grammar.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libsolidity') diff --git a/libsolidity/grammar.txt b/libsolidity/grammar.txt index 86df3db0..969b9e53 100644 --- a/libsolidity/grammar.txt +++ b/libsolidity/grammar.txt @@ -43,13 +43,13 @@ StorageLocation = 'memory' | 'storage' Block = '{' Statement* '}' Statement = IfStatement | WhileStatement | ForStatement | Block | ( PlaceholderStatement | Continue | Break | Return | - Throw | SimpleStatement | ExpressionStatement ) ';' + Throw | SimpleStatement ) ';' ExpressionStatement = Expression | VariableDefinition IfStatement = 'if' '(' Expression ')' Statement ( 'else' Statement )? WhileStatement = 'while' '(' Expression ')' Statement PlaceholderStatement = '_' -SimpleStatement = VariableDefinition | ExpressionStatement +SimpleStatement = ExpressionStatement ForStatement = 'for' '(' (SimpleStatement)? ';' (Expression)? ';' (ExpressionStatement)? ')' Statement Continue = 'continue' Break = 'break' @@ -59,7 +59,7 @@ VariableDefinition = VariableDeclaration ( '=' Expression )? // Precedence by order (see github.com/ethereum/solidity/pull/732) Expression = - ( Expression ('++' | '--') | FunctionCall | IndexAccess | MemberAccess | '(' Expression ')' ) + ( Expression ('++' | '--') | FunctionCall | IndexAccess | MemberAccess | NewExpression | ( TypeName? '(' Expression ')' ) ) | ('!' | '~' | 'delete' | '++' | '--' | '+' | '-') Expression | Expression '**' Expression | Expression ('*' | '/' | '%') Expression @@ -79,7 +79,7 @@ Expression = PrimaryExpression = Identifier | BooleanLiteral | NumberLiteral | StringLiteral -FunctionCall = Identifier '(' Expression? ( ',' Expression )* ')' +FunctionCall = ( Identifier | MemberAccess ) '(' Expression? ( ',' Expression )* ')' NewExpression = 'new' Identifier MemberAccess = Expression '.' Identifier IndexAccess = Expression '[' Expression? ']' -- cgit v1.2.3 From 215fc048575bfb4d4949bf6d16a4e4b6bc024769 Mon Sep 17 00:00:00 2001 From: walter-weinmann <walter.weinmann@gmail.com> Date: Tue, 6 Sep 2016 05:18:43 +0200 Subject: Considering comments from @chriseth regarding ExpressionStatement and FunctionCall. --- libsolidity/grammar.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libsolidity') diff --git a/libsolidity/grammar.txt b/libsolidity/grammar.txt index 969b9e53..e636fd72 100644 --- a/libsolidity/grammar.txt +++ b/libsolidity/grammar.txt @@ -45,11 +45,11 @@ Statement = IfStatement | WhileStatement | ForStatement | Block | ( PlaceholderStatement | Continue | Break | Return | Throw | SimpleStatement ) ';' -ExpressionStatement = Expression | VariableDefinition +ExpressionStatement = Expression IfStatement = 'if' '(' Expression ')' Statement ( 'else' Statement )? WhileStatement = 'while' '(' Expression ')' Statement PlaceholderStatement = '_' -SimpleStatement = ExpressionStatement +SimpleStatement = VariableDefinition | ExpressionStatement ForStatement = 'for' '(' (SimpleStatement)? ';' (Expression)? ';' (ExpressionStatement)? ')' Statement Continue = 'continue' Break = 'break' @@ -59,7 +59,7 @@ VariableDefinition = VariableDeclaration ( '=' Expression )? // Precedence by order (see github.com/ethereum/solidity/pull/732) Expression = - ( Expression ('++' | '--') | FunctionCall | IndexAccess | MemberAccess | NewExpression | ( TypeName? '(' Expression ')' ) ) + ( Expression ('++' | '--') | FunctionCall | IndexAccess | MemberAccess | '(' Expression ')' ) | ('!' | '~' | 'delete' | '++' | '--' | '+' | '-') Expression | Expression '**' Expression | Expression ('*' | '/' | '%') Expression @@ -79,10 +79,12 @@ Expression = PrimaryExpression = Identifier | BooleanLiteral | NumberLiteral | StringLiteral -FunctionCall = ( Identifier | MemberAccess ) '(' Expression? ( ',' Expression )* ')' +FunctionCall = ( MemberAccessFunctionCall | IndexAccessFunctionCall ) '(' Expression? ( ',' Expression )* ')' NewExpression = 'new' Identifier MemberAccess = Expression '.' Identifier +MemberAccessFunctionCall = ( PrimaryExpression | NewExpression | TypeName ) ( '.' ( PrimaryExpression | NewExpression | TypeName ) )* IndexAccess = Expression '[' Expression? ']' +IndexAccessFunctionCall = ( PrimaryExpression | NewExpression | TypeName ) '[' Expression? ']' BooleanLiteral = 'true' | 'false' NumberLiteral = '0x'? [0-9]+ (' ' NumberUnit)? -- cgit v1.2.3 From 70d91462db154eed74b5c75faa204b11a98ed73e Mon Sep 17 00:00:00 2001 From: walter-weinmann <walter.weinmann@gmail.com> Date: Tue, 6 Sep 2016 11:53:27 +0200 Subject: Considering comment from @chriseth regarding FunctionCall. --- libsolidity/grammar.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'libsolidity') diff --git a/libsolidity/grammar.txt b/libsolidity/grammar.txt index e636fd72..755cf281 100644 --- a/libsolidity/grammar.txt +++ b/libsolidity/grammar.txt @@ -79,12 +79,10 @@ Expression = PrimaryExpression = Identifier | BooleanLiteral | NumberLiteral | StringLiteral -FunctionCall = ( MemberAccessFunctionCall | IndexAccessFunctionCall ) '(' Expression? ( ',' Expression )* ')' +FunctionCall = ( PrimaryExpression | NewExpression | TypeName ) ( ( '.' Identifier ) | ( '[' Expression ']' ) )* '(' Expression? ( ',' Expression )* ')' NewExpression = 'new' Identifier MemberAccess = Expression '.' Identifier -MemberAccessFunctionCall = ( PrimaryExpression | NewExpression | TypeName ) ( '.' ( PrimaryExpression | NewExpression | TypeName ) )* IndexAccess = Expression '[' Expression? ']' -IndexAccessFunctionCall = ( PrimaryExpression | NewExpression | TypeName ) '[' Expression? ']' BooleanLiteral = 'true' | 'false' NumberLiteral = '0x'? [0-9]+ (' ' NumberUnit)? -- cgit v1.2.3