aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorNicolai <NicolaiSoeborg@users.noreply.github.com>2016-07-20 08:18:09 +0800
committerNicolai <NicolaiSoeborg@users.noreply.github.com>2016-07-20 08:18:09 +0800
commitf003bdafa6ca623728befcbc8c8a22e8422dc9ec (patch)
tree91aa76a9c81f9b71065ca7a63551d3e8e8d28b0c /libsolidity
parent1e2f071a11dbc706f549fa3ac6b524b5bf4a7599 (diff)
downloaddexon-solidity-f003bdafa6ca623728befcbc8c8a22e8422dc9ec.tar.gz
dexon-solidity-f003bdafa6ca623728befcbc8c8a22e8422dc9ec.tar.zst
dexon-solidity-f003bdafa6ca623728befcbc8c8a22e8422dc9ec.zip
Fix StructDef. Add BoolLiteral. Def NumLiteral, StringLiteral and Identifier.
Diffstat (limited to 'libsolidity')
-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'