mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2401 from federicobond/update-grammar
grammar.txt: Fix grammar for f.gas(p).value(q)() style calls
This commit is contained in:
commit
b00d7a6911
@ -20,9 +20,12 @@ StateVariableDeclaration = TypeName ( 'public' | 'internal' | 'private' )? Ident
|
|||||||
UsingForDeclaration = 'using' Identifier 'for' ('*' | TypeName) ';'
|
UsingForDeclaration = 'using' Identifier 'for' ('*' | TypeName) ';'
|
||||||
StructDefinition = 'struct' Identifier '{'
|
StructDefinition = 'struct' Identifier '{'
|
||||||
( VariableDeclaration ';' (VariableDeclaration ';')* )? '}'
|
( VariableDeclaration ';' (VariableDeclaration ';')* )? '}'
|
||||||
|
|
||||||
ModifierDefinition = 'modifier' Identifier ParameterList? Block
|
ModifierDefinition = 'modifier' Identifier ParameterList? Block
|
||||||
|
ModifierInvocation = Identifier ( '(' ExpressionList? ')' )?
|
||||||
|
|
||||||
FunctionDefinition = 'function' Identifier? ParameterList
|
FunctionDefinition = 'function' Identifier? ParameterList
|
||||||
( FunctionCall | Identifier | 'constant' | 'payable' | 'external' | 'public' | 'internal' | 'private' )*
|
( ModifierInvocation | 'constant' | 'payable' | 'external' | 'public' | 'internal' | 'private' )*
|
||||||
( 'returns' ParameterList )? ( ';' | Block )
|
( 'returns' ParameterList )? ( ';' | Block )
|
||||||
EventDefinition = 'event' Identifier IndexedParameterList 'anonymous'? ';'
|
EventDefinition = 'event' Identifier IndexedParameterList 'anonymous'? ';'
|
||||||
|
|
||||||
@ -72,8 +75,13 @@ VariableDefinition = ('var' IdentifierList | VariableDeclaration) ( '=' Expressi
|
|||||||
IdentifierList = '(' ( Identifier? ',' )* Identifier? ')'
|
IdentifierList = '(' ( Identifier? ',' )* Identifier? ')'
|
||||||
|
|
||||||
// Precedence by order (see github.com/ethereum/solidity/pull/732)
|
// Precedence by order (see github.com/ethereum/solidity/pull/732)
|
||||||
Expression =
|
Expression
|
||||||
( Expression ('++' | '--') | FunctionCall | IndexAccess | MemberAccess | '(' Expression ')' )
|
= Expression ('++' | '--')
|
||||||
|
| NewExpression
|
||||||
|
| IndexAccess
|
||||||
|
| MemberAccess
|
||||||
|
| FunctionCall
|
||||||
|
| '(' Expression ')'
|
||||||
| ('!' | '~' | 'delete' | '++' | '--' | '+' | '-') Expression
|
| ('!' | '~' | 'delete' | '++' | '--' | '+' | '-') Expression
|
||||||
| Expression '**' Expression
|
| Expression '**' Expression
|
||||||
| Expression ('*' | '/' | '%') Expression
|
| Expression ('*' | '/' | '%') Expression
|
||||||
@ -90,18 +98,18 @@ Expression =
|
|||||||
| Expression ('=' | '|=' | '^=' | '&=' | '<<=' | '>>=' | '+=' | '-=' | '*=' | '/=' | '%=') Expression
|
| Expression ('=' | '|=' | '^=' | '&=' | '<<=' | '>>=' | '+=' | '-=' | '*=' | '/=' | '%=') Expression
|
||||||
| PrimaryExpression
|
| PrimaryExpression
|
||||||
|
|
||||||
PrimaryExpression = Identifier
|
PrimaryExpression = BooleanLiteral
|
||||||
| BooleanLiteral
|
|
||||||
| NumberLiteral
|
| NumberLiteral
|
||||||
| HexLiteral
|
| HexLiteral
|
||||||
| StringLiteral
|
| StringLiteral
|
||||||
| TupleExpression
|
| TupleExpression
|
||||||
|
| Identifier
|
||||||
| ElementaryTypeNameExpression
|
| ElementaryTypeNameExpression
|
||||||
|
|
||||||
ExpressionList = Expression ( ',' Expression )*
|
ExpressionList = Expression ( ',' Expression )*
|
||||||
NameValueList = Identifier ':' Expression ( ',' Identifier ':' Expression )*
|
NameValueList = Identifier ':' Expression ( ',' Identifier ':' Expression )*
|
||||||
|
|
||||||
FunctionCall = ( PrimaryExpression | NewExpression | TypeName ) ( ( '.' Identifier ) | ( '[' Expression ']' ) )* '(' FunctionCallArguments ')'
|
FunctionCall = Expression '(' FunctionCallArguments ')'
|
||||||
FunctionCallArguments = '{' NameValueList? '}'
|
FunctionCallArguments = '{' NameValueList? '}'
|
||||||
| ExpressionList?
|
| ExpressionList?
|
||||||
|
|
||||||
|
@ -394,12 +394,14 @@ The following is the order of precedence for operators, listed in order of evalu
|
|||||||
+============+=====================================+============================================+
|
+============+=====================================+============================================+
|
||||||
| *1* | Postfix increment and decrement | ``++``, ``--`` |
|
| *1* | Postfix increment and decrement | ``++``, ``--`` |
|
||||||
+ +-------------------------------------+--------------------------------------------+
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
| | Function-like call | ``<func>(<args...>)`` |
|
| | New expression | ``new <typename>`` |
|
||||||
+ +-------------------------------------+--------------------------------------------+
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
| | Array subscripting | ``<array>[<index>]`` |
|
| | Array subscripting | ``<array>[<index>]`` |
|
||||||
+ +-------------------------------------+--------------------------------------------+
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
| | Member access | ``<object>.<member>`` |
|
| | Member access | ``<object>.<member>`` |
|
||||||
+ +-------------------------------------+--------------------------------------------+
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
|
| | Function-like call | ``<func>(<args...>)`` |
|
||||||
|
+ +-------------------------------------+--------------------------------------------+
|
||||||
| | Parentheses | ``(<statement>)`` |
|
| | Parentheses | ``(<statement>)`` |
|
||||||
+------------+-------------------------------------+--------------------------------------------+
|
+------------+-------------------------------------+--------------------------------------------+
|
||||||
| *2* | Prefix increment and decrement | ``++``, ``--`` |
|
| *2* | Prefix increment and decrement | ``++``, ``--`` |
|
||||||
|
Loading…
Reference in New Issue
Block a user