Remove "in", extra semicolons, forced function param. Added "throw". Changes FunctionCall & IndexAccess

This commit is contained in:
Nicolai 2016-07-19 01:26:39 +02:00
parent ce8a003611
commit dc3828ee37

View File

@ -24,18 +24,18 @@ ArrayTypeName = TypeName ('[' Expression? ']')+
Block = '{' Statement* '}' Block = '{' Statement* '}'
Statement = IfStatement | WhileStatement | Block | Statement = IfStatement | WhileStatement | Block |
( Continue | Break | Return | VariableDefinition | ExpressionStatement ) ';' ( Continue | Break | Return | Throw | VariableDefinition | ExpressionStatement ) ';'
ExpressionStatement = Expression ExpressionStatement = Expression
IfStatement = 'if' '(' Expression ')' Statement ( 'else' Statement )? IfStatement = 'if' '(' Expression ')' Statement ( 'else' Statement )?
WhileStatement = 'while' '(' Expression ')' Statement WhileStatement = 'while' '(' Expression ')' Statement
VardefOrExprStmt = Variabledefinition | ExpressionStatement VardefOrExprStmt = Variabledefinition | ExpressionStatement
ForStatement = 'for' '(' (VardefOrExprStmt)? ';' (Expression)? ';' (ExpressionStatement)? ')' Statement ForStatement = 'for' '(' (VardefOrExprStmt)? ';' (Expression)? ';' (ExpressionStatement)? ')' Statement
Continue = 'continue' ';' Continue = 'continue'
Break = 'break' ';' Break = 'break'
Return = 'return' Expression? ';' Return = 'return' Expression?
Throw = 'throw' Expression? ';' Throw = 'throw' Expression?
VariableDefinition = VariableDeclaration ( '=' Expression )? ';' VariableDefinition = VariableDeclaration ( '=' Expression )?
Expression = Assignment | UnaryOperation | BinaryOperation | FunctionCall | NewExpression | IndexAccess | Expression = Assignment | UnaryOperation | BinaryOperation | FunctionCall | NewExpression | IndexAccess |
MemberAccess | PrimaryExpression MemberAccess | PrimaryExpression
@ -45,10 +45,10 @@ BasicBinaryOperation = '|' | '^' | '&' | '<<' | '>>' | '>>>' | '+' | '-' | '*' |
AssignmentOp = BasicBinaryOperation'=' AssignmentOp = BasicBinaryOperation'='
UnaryOperation = '!' | '~' | '++' | '--' | 'delete' UnaryOperation = '!' | '~' | '++' | '--' | 'delete'
BinaryOperation = BasicBinaryOperation | '||' | '&&' | '**' | BinaryOperation = BasicBinaryOperation | '||' | '&&' | '**' |
'==' | '!=' | '<' | '>' | '<=' | '>=' | 'in' '==' | '!=' | '<' | '>' | '<=' | '>='
FunctionCall = Expression '(' Expression ( ',' Expression )* ')' FunctionCall = Identifier '(' Expression? ( ',' Expression )* ')'
NewExpression = 'new' Identifier NewExpression = 'new' Identifier
MemberAccess = Expression '.' Identifier MemberAccess = Expression '.' Identifier
IndexAccess = Expression '[' (Expression)? ']' IndexAccess = Identifier ('[' Expression? ']')+
PrimaryExpression = Identifier | NumberLiteral | StringLiteral | ElementaryTypeName | '(' Expression ')' PrimaryExpression = Identifier | NumberLiteral | StringLiteral | ElementaryTypeName | '(' Expression ')'