aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsolidity/grammar.txt11
1 files changed, 8 insertions, 3 deletions
diff --git a/libsolidity/grammar.txt b/libsolidity/grammar.txt
index a5089c8f..a08a08fa 100644
--- a/libsolidity/grammar.txt
+++ b/libsolidity/grammar.txt
@@ -5,7 +5,7 @@ ContractPart = StateVariableDeclaration | StructDefinition | ModifierDefinition
InheritanceSpecifier = Identifier ( '(' Expression ( ',' Expression )* ')' )?
StructDefinition = 'struct' Identifier '{'
- ( VariableDeclaration (';' VariableDeclaration)* )? '}'
+ ( VariableDeclaration ';' (VariableDeclaration ';')* )? '}'
StateVariableDeclaration = TypeName ( 'public' | 'internal' | 'private' )? Identifier ';'
ModifierDefinition = 'modifier' Identifier ParameterList? Block
FunctionDefinition = 'function' Identifier ParameterList
@@ -29,7 +29,7 @@ Statement = IfStatement | WhileStatement | ForStatement | Block |
ExpressionStatement = Expression
IfStatement = 'if' '(' Expression ')' Statement ( 'else' Statement )?
WhileStatement = 'while' '(' Expression ')' Statement
-VardefOrExprStmt = Variabledefinition | ExpressionStatement
+VardefOrExprStmt = VariableDefinition | ExpressionStatement
ForStatement = 'for' '(' (VardefOrExprStmt)? ';' (Expression)? ';' (ExpressionStatement)? ')' Statement
Continue = 'continue'
Break = 'break'
@@ -50,7 +50,12 @@ FunctionCall = Identifier '(' Expression? ( ',' Expression )* ')'
NewExpression = 'new' Identifier
MemberAccess = Expression '.' Identifier
IndexAccess = Expression '[' Expression? ']'
-PrimaryExpression = Identifier | NumberLiteral | StringLiteral | ElementaryTypeName | '(' Expression ')'
+PrimaryExpression = Identifier | BooleanLiteral | NumberLiteral | StringLiteral | ElementaryTypeName | '(' Expression ')'
+
+BooleanLiteral = 'true' | 'false'
+NumberLiteral = [0-9]+
+StringLiteral = '"' [a-zA-Z_0-9]* '"'
+Identifier = [a-zA-Z_] [a-zA-Z_0-9]*
ElementaryTypeName = 'address' | 'bool' | 'string'
| 'int' | 'int8' | 'int16' | 'int24' | 'int32' | 'int40' | 'int48' | 'int56' | 'int64' | 'int72' | 'int80' | 'int88' | 'int96' | 'int104' | 'int112' | 'int120' | 'int128' | 'int136' | 'int144' | 'int152' | 'int160' | 'int168' | 'int176' | 'int184' | 'int192' | 'int200' | 'int208' | 'int216' | 'int224' | 'int232' | 'int240' | 'int248' | 'int256'