From 2a7b01982c2b49399b9ee0dd89c7827af28c6280 Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Sat, 24 Dec 2016 13:00:11 -0300 Subject: [PATCH 1/3] Fix StorageLocation position for ArrayTypeName rule in grammar --- docs/grammar.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/grammar.txt b/docs/grammar.txt index d15fbaf7c..7bb45bba9 100644 --- a/docs/grammar.txt +++ b/docs/grammar.txt @@ -38,7 +38,7 @@ TypeNameList = '(' ( TypeName (',' TypeName )* )? ')' VariableDeclaration = TypeName Identifier TypeName = ElementaryTypeName | Identifier StorageLocation? | Mapping | ArrayTypeName | FunctionTypeName Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')' -ArrayTypeName = TypeName StorageLocation? '[' Expression? ']' +ArrayTypeName = TypeName '[' Expression? ']' StorageLocation? FunctionTypeName = 'function' TypeNameList ( 'internal' | 'external' | 'constant' | 'payable' )* ( 'returns' TypeNameList )? StorageLocation = 'memory' | 'storage' From 507525be5f3fec5860d226010beea6550373fd0b Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Sat, 24 Dec 2016 13:10:51 -0300 Subject: [PATCH 2/3] Fix NumberLiteral rule for hex numbers --- docs/grammar.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/grammar.txt b/docs/grammar.txt index 7bb45bba9..5fac96a1c 100644 --- a/docs/grammar.txt +++ b/docs/grammar.txt @@ -90,13 +90,16 @@ MemberAccess = Expression '.' Identifier IndexAccess = Expression '[' Expression? ']' BooleanLiteral = 'true' | 'false' -NumberLiteral = '0x'? [0-9]+ (' ' NumberUnit)? +NumberLiteral = ( HexNumber | DecimalNumber ) (' ' NumberUnit)? NumberUnit = 'wei' | 'szabo' | 'finney' | 'ether' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'years' HexLiteral = 'hex' ('"' ([0-9a-fA-F]{2})* '"' | '\'' ([0-9a-fA-F]{2})* '\'') StringLiteral = '"' ([^"\r\n\\] | '\\' .)* '"' Identifier = [a-zA-Z_] [a-zA-Z_0-9]* +HexNumber = '0x' [0-9a-fA-F]+ +DecimalNumber = [0-9]+ + ElementaryTypeName = 'address' | 'bool' | 'string' | 'var' | Int | Uint | Byte | Fixed | Ufixed From 890a8818b5455eb067b5ee2ed6c9d32623c0c94c Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Mon, 26 Dec 2016 22:57:00 -0300 Subject: [PATCH 3/3] Add unimplemented functions to grammar --- docs/grammar.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/grammar.txt b/docs/grammar.txt index 5fac96a1c..c9f7f4482 100644 --- a/docs/grammar.txt +++ b/docs/grammar.txt @@ -23,7 +23,7 @@ StructDefinition = 'struct' Identifier '{' ModifierDefinition = 'modifier' Identifier ParameterList? Block FunctionDefinition = 'function' Identifier? ParameterList ( FunctionCall | Identifier | 'constant' | 'payable' | 'external' | 'public' | 'internal' | 'private' )* - ( 'returns' ParameterList )? Block + ( 'returns' ParameterList )? ( ';' | Block ) EventDefinition = 'event' Identifier IndexedParameterList 'anonymous'? ';' EnumValue = Identifier