diff options
author | Nicolai <NicolaiSoeborg@users.noreply.github.com> | 2016-08-02 04:33:05 +0800 |
---|---|---|
committer | Nicolai <NicolaiSoeborg@users.noreply.github.com> | 2016-08-02 04:33:05 +0800 |
commit | baaad627c48127114dc9200cbbb589477e620ee1 (patch) | |
tree | 8ff3f5f7eee1f0ae8936109d77df66eff107fb27 /libsolidity/grammar.txt | |
parent | 9f772cb9a1d7ffcf4670901d2aa039ecbde92600 (diff) | |
download | dexon-solidity-baaad627c48127114dc9200cbbb589477e620ee1.tar.gz dexon-solidity-baaad627c48127114dc9200cbbb589477e620ee1.tar.zst dexon-solidity-baaad627c48127114dc9200cbbb589477e620ee1.zip |
Remove ambiguity from EventDefinition. Fix SourceUnit
Diffstat (limited to 'libsolidity/grammar.txt')
-rw-r--r-- | libsolidity/grammar.txt | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libsolidity/grammar.txt b/libsolidity/grammar.txt index 97a9ad39..a88aa3c0 100644 --- a/libsolidity/grammar.txt +++ b/libsolidity/grammar.txt @@ -1,12 +1,12 @@ -SourceUnit = (ImportDirective ';')* ContractDefinition +SourceUnit = (ImportDirective | ContractDefinition)* ContractDefinition = ( 'contract' | 'library' ) Identifier ( 'is' InheritanceSpecifier (',' InheritanceSpecifier )* )? '{' ContractPart* '}' -ImportDirective = 'import' StringLiteral ('as' Identifier)? - | 'import' ('*' | Identifier) ('as' Identifier)? 'from' StringLiteral - | 'import' '{' Identifier ('as' Identifier)? ( ',' Identifier ('as' Identifier)? )* '}' 'from' StringLiteral +ImportDirective = 'import' StringLiteral ('as' Identifier)? ';' + | 'import' ('*' | Identifier) ('as' Identifier)? 'from' StringLiteral ';' + | 'import' '{' Identifier ('as' Identifier)? ( ',' Identifier ('as' Identifier)? )* '}' 'from' StringLiteral ';' ContractPart = StateVariableDeclaration | UsingForDeclaration | StructDefinition | ModifierDefinition | FunctionDefinition | EventDefinition | EnumDefinition @@ -21,13 +21,13 @@ ModifierDefinition = 'modifier' Identifier ParameterList? Block FunctionDefinition = 'function' Identifier ParameterList ( FunctionCall | Identifier | 'constant' | 'external' | 'public' | 'internal' | 'private' )* ( 'returns' ParameterList )? Block -EventDefinition = 'event' Identifier (ParameterList | IndexedTypeParameterList) 'anonymous'? ';' +EventDefinition = 'event' Identifier IndexedParameterList 'anonymous'? ';' EnumValue = Identifier EnumDefinition = 'enum' Identifier '{' EnumValue? (',' EnumValue)* '}' -IndexedTypeParameterList = '(' ( TypeName 'indexed'? Identifier? (',' TypeName 'indexed'? Identifier?)* )? ')' -ParameterList = '(' ( TypeName Identifier? (',' TypeName Identifier?)* )? ')' +IndexedParameterList = '(' ( TypeName 'indexed'? Identifier? (',' TypeName 'indexed'? Identifier?)* )? ')' +ParameterList = '(' ( TypeName Identifier? (',' TypeName Identifier?)* )? ')' // semantic restriction: mappings and structs (recursively) containing mappings // are not allowed in argument lists @@ -70,7 +70,7 @@ Expression = | Expression '||' Expression | Expression '?' Expression ':' Expression | Expression ('=' | '|=' | '^=' | '&=' | '<<=' | '>>=' | '+=' | '-=' | '*=' | '/=' | '%=') Expression - | Expression? (',' Expression)? + | Expression? (',' Expression) | PrimaryExpression PrimaryExpression = Identifier | BooleanLiteral | NumberLiteral | StringLiteral @@ -81,7 +81,7 @@ MemberAccess = Expression '.' Identifier IndexAccess = Expression '[' Expression? ']' BooleanLiteral = 'true' | 'false' -NumberLiteral = '0x'? [0-9]+ NumberUnit? +NumberLiteral = '0x'? [0-9]+ (' ' NumberUnit)? NumberUnit = 'wei' | 'szabo' | 'finney' | 'ether' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years' StringLiteral = '"' ([^"\r\n\\] | '\\' .)* '"' |