mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #1553 from federicobond/improve-grammar
Improve grammar specification
This commit is contained in:
commit
4f5da2ea14
@ -35,10 +35,10 @@ TypeNameList = '(' ( TypeName (',' TypeName )* )? ')'
|
|||||||
|
|
||||||
// semantic restriction: mappings and structs (recursively) containing mappings
|
// semantic restriction: mappings and structs (recursively) containing mappings
|
||||||
// are not allowed in argument lists
|
// are not allowed in argument lists
|
||||||
VariableDeclaration = TypeName Identifier
|
VariableDeclaration = TypeName StorageLocation? Identifier
|
||||||
|
|
||||||
TypeName = ElementaryTypeName
|
TypeName = ElementaryTypeName
|
||||||
| UserDefinedTypeName StorageLocation?
|
| UserDefinedTypeName
|
||||||
| Mapping
|
| Mapping
|
||||||
| ArrayTypeName
|
| ArrayTypeName
|
||||||
| FunctionTypeName
|
| FunctionTypeName
|
||||||
@ -46,7 +46,7 @@ TypeName = ElementaryTypeName
|
|||||||
UserDefinedTypeName = Identifier ( '.' Identifier )*
|
UserDefinedTypeName = Identifier ( '.' Identifier )*
|
||||||
|
|
||||||
Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')'
|
Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')'
|
||||||
ArrayTypeName = TypeName '[' Expression? ']' StorageLocation?
|
ArrayTypeName = TypeName '[' Expression? ']'
|
||||||
FunctionTypeName = 'function' TypeNameList ( 'internal' | 'external' | 'constant' | 'payable' )*
|
FunctionTypeName = 'function' TypeNameList ( 'internal' | 'external' | 'constant' | 'payable' )*
|
||||||
( 'returns' TypeNameList )?
|
( 'returns' TypeNameList )?
|
||||||
StorageLocation = 'memory' | 'storage'
|
StorageLocation = 'memory' | 'storage'
|
||||||
@ -97,8 +97,14 @@ PrimaryExpression = Identifier
|
|||||||
| StringLiteral
|
| StringLiteral
|
||||||
| ElementaryTypeNameExpression
|
| ElementaryTypeNameExpression
|
||||||
|
|
||||||
FunctionCall = ( PrimaryExpression | NewExpression | TypeName ) ( ( '.' Identifier ) | ( '[' Expression ']' ) )* '(' Expression? ( ',' Expression )* ')'
|
ExpressionList = Expression ( ',' Expression )*
|
||||||
NewExpression = 'new' Identifier
|
NameValueList = Identifier ':' Expression ( ',' Identifier ':' Expression )*
|
||||||
|
|
||||||
|
FunctionCall = ( PrimaryExpression | NewExpression | TypeName ) ( ( '.' Identifier ) | ( '[' Expression ']' ) )* '(' FunctionCallArguments ')'
|
||||||
|
FunctionCallArguments = '{' NameValueList? '}'
|
||||||
|
| ExpressionList?
|
||||||
|
|
||||||
|
NewExpression = 'new' TypeName
|
||||||
MemberAccess = Expression '.' Identifier
|
MemberAccess = Expression '.' Identifier
|
||||||
IndexAccess = Expression '[' Expression? ']'
|
IndexAccess = Expression '[' Expression? ']'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user