aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/grammar.txt
diff options
context:
space:
mode:
authorNicolai <NicolaiSoeborg@users.noreply.github.com>2016-07-15 05:41:32 +0800
committerNicolai <NicolaiSoeborg@users.noreply.github.com>2016-07-15 05:41:32 +0800
commitff9d6e05f2c49af37e36fae65269959eb21cf6b2 (patch)
tree0abec6be90d8ec8f39c3395606fbbc42f8236a7d /libsolidity/grammar.txt
parentc800f8c97dee4380c56a6313a2b8ebd1b9be474c (diff)
downloaddexon-solidity-ff9d6e05f2c49af37e36fae65269959eb21cf6b2.tar.gz
dexon-solidity-ff9d6e05f2c49af37e36fae65269959eb21cf6b2.tar.zst
dexon-solidity-ff9d6e05f2c49af37e36fae65269959eb21cf6b2.zip
Typos + added missing grammar rules
Diffstat (limited to 'libsolidity/grammar.txt')
-rw-r--r--libsolidity/grammar.txt12
1 files changed, 9 insertions, 3 deletions
diff --git a/libsolidity/grammar.txt b/libsolidity/grammar.txt
index 08a74f45..964bd5e2 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' | 'inheritable' | 'private' )? Identifier ';'
ModifierDefinition = 'modifier' Identifier ParameterList? Block
FunctionDefinition = 'function' Identifier ParameterList
@@ -35,14 +35,20 @@ Continue = 'continue' ';'
Break = 'break' ';'
Return = 'return' Expression? ';'
Throw = 'throw' Expression? ';'
-VariableDefinition = VariableDeclaration ( = Expression )? ';'
+VariableDefinition = VariableDeclaration ( '=' Expression )? ';'
Expression = Assignment | UnaryOperation | BinaryOperation | FunctionCall | NewExpression | IndexAccess |
MemberAccess | PrimaryExpression
// The expression syntax is actually much more complicated
Assignment = Expression (AssignmentOp Expression)
+BasicBinaryOperation = '|' | '^' | '&' | '<<' | '>>' | '>>>' | '+' | '-' | '*' | '/' | '%'
+AssignmentOp = BasicBinaryOperation '='
+UnaryOperation = '!' | '~' | '++' | '--' | 'delete'
+BinaryOperation = BasicBinaryOperation | '||' | '&&' | '**' |
+ '==' | '!=' | '<' | '>' | '<=' | '>=' | 'in'
+
FunctionCall = Expression '(' Expression ( ',' Expression )* ')'
NewExpression = 'new' Identifier
MemberAccess = Expression '.' Identifier
-IndexAccess = Expression '[' (Expresison)? ']'
+IndexAccess = Expression '[' (Expression)? ']'
PrimaryExpression = Identifier | NumberLiteral | StringLiteral | ElementaryTypeName | '(' Expression ')'