grammar.txt: Fixes to EnumDef and ArrayTypeName

This commit is contained in:
Nicolai 2016-07-19 01:03:41 +02:00
parent c396148fe6
commit ce8a003611

View File

@ -13,14 +13,14 @@ FunctionDefinition = 'function' Identifier ParameterList
( 'returns' ParameterList )? Block
EnumValue = Identifier
EnumDefinition = 'enum' '{' EnumValue (',' EnumValue)* '}'
EnumDefinition = 'enum' Identifier '{' EnumValue? (',' EnumValue)* '}'
ParameterList = '(' ( VariableDeclaration (',' VariableDeclaration)* )? ')'
// semantic restriction: mappings and structs (recursively) containing mappings
// are not allowed in argument lists
VariableDeclaration = TypeName Identifier
TypeName = ElementaryTypeName | Identifier | Mapping | ArrayTypeName
Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')'
ArrayTypeName = TypeName '[' (Expression)? ']'
ArrayTypeName = TypeName ('[' Expression? ']')+
Block = '{' Statement* '}'
Statement = IfStatement | WhileStatement | Block |