Merge pull request #1528 from federicobond/userdefinedtypename

Add UserDefinedTypeName to grammar.txt
This commit is contained in:
chriseth 2017-01-02 12:25:04 +01:00 committed by GitHub
commit 37799683a7

View File

@ -14,7 +14,7 @@ ContractDefinition = ( 'contract' | 'library' ) Identifier
ContractPart = StateVariableDeclaration | UsingForDeclaration ContractPart = StateVariableDeclaration | UsingForDeclaration
| StructDefinition | ModifierDefinition | FunctionDefinition | EventDefinition | EnumDefinition | StructDefinition | ModifierDefinition | FunctionDefinition | EventDefinition | EnumDefinition
InheritanceSpecifier = Identifier ( '(' Expression ( ',' Expression )* ')' )? InheritanceSpecifier = UserDefinedTypeName ( '(' Expression ( ',' Expression )* ')' )?
StateVariableDeclaration = TypeName ( 'public' | 'internal' | 'private' )? Identifier ('=' Expression)? ';' StateVariableDeclaration = TypeName ( 'public' | 'internal' | 'private' )? Identifier ('=' Expression)? ';'
UsingForDeclaration = 'using' Identifier 'for' ('*' | TypeName) ';' UsingForDeclaration = 'using' Identifier 'for' ('*' | TypeName) ';'
@ -36,7 +36,15 @@ 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 Identifier
TypeName = ElementaryTypeName | Identifier StorageLocation? | Mapping | ArrayTypeName | FunctionTypeName
TypeName = ElementaryTypeName
| UserDefinedTypeName StorageLocation?
| Mapping
| ArrayTypeName
| FunctionTypeName
UserDefinedTypeName = Identifier ( '.' Identifier )*
Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')' Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')'
ArrayTypeName = TypeName '[' Expression? ']' StorageLocation? ArrayTypeName = TypeName '[' Expression? ']' StorageLocation?
FunctionTypeName = 'function' TypeNameList ( 'internal' | 'external' | 'constant' | 'payable' )* FunctionTypeName = 'function' TypeNameList ( 'internal' | 'external' | 'constant' | 'payable' )*