Updates on Grammar to match Antlr syntax
This commit is contained in:
@@ -114,8 +114,8 @@ assignment:
|
|||||||
leftHandSide assignmentOperator assignmentExpression;
|
leftHandSide assignmentOperator assignmentExpression;
|
||||||
leftHandSide:
|
leftHandSide:
|
||||||
expressionName;
|
expressionName;
|
||||||
//|fieldAccess
|
|fieldAccess
|
||||||
//|arrayAccess;
|
|arrayAccess;
|
||||||
assignmentOperator:
|
assignmentOperator:
|
||||||
Assignment | MultiplyAssign | DivideAssign | RemainderAssign | AddAssign | SubtractAssign | LeftShiftAssign
|
Assignment | MultiplyAssign | DivideAssign | RemainderAssign | AddAssign | SubtractAssign | LeftShiftAssign
|
||||||
| SighnedRightShiftAssign | BitwiseANDAssign | BitwiseXORAssign | BitwiseORAssign;
|
| SighnedRightShiftAssign | BitwiseANDAssign | BitwiseXORAssign | BitwiseORAssign;
|
||||||
@@ -123,4 +123,4 @@ assignmentOperator:
|
|||||||
//Determining Meaning of a Name (Section 6.5)
|
//Determining Meaning of a Name (Section 6.5)
|
||||||
expressionName:
|
expressionName:
|
||||||
name;
|
name;
|
||||||
//|ambiguousName Dot name;
|
|ambiguousName Dot name;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ options {
|
|||||||
|
|
||||||
identifier: IDENTIFIER;
|
identifier: IDENTIFIER;
|
||||||
|
|
||||||
qualifiedIdentifier: identifier {'.' identifier};
|
qualifiedIdentifier: identifier (Dot identifier)*;
|
||||||
|
|
||||||
literal: IntegerLiteral
|
literal: IntegerLiteral
|
||||||
| FloatingPointLiteral
|
| FloatingPointLiteral
|
||||||
@@ -15,7 +15,7 @@ literal: IntegerLiteral
|
|||||||
| BooleanLiteral
|
| BooleanLiteral
|
||||||
| NullLiteral;
|
| NullLiteral;
|
||||||
|
|
||||||
expression: expression1 [assignmentOperator expression1];
|
expression: expression1 (assignmentOperator expression1)?;
|
||||||
|
|
||||||
assignmentOperator: Assignment
|
assignmentOperator: Assignment
|
||||||
| AddAssign
|
| AddAssign
|
||||||
@@ -30,20 +30,20 @@ assignmentOperator: Assignment
|
|||||||
| SighnedRightShiftAssign
|
| SighnedRightShiftAssign
|
||||||
| UnsighnedRightShiftAssign;
|
| UnsighnedRightShiftAssign;
|
||||||
|
|
||||||
type: identifier {'.' identifier} bracketsOpt
|
type: identifier (Dot identifier)* bracketsOpt
|
||||||
| basicType;
|
| basicType;
|
||||||
|
|
||||||
statementExpression: expression;
|
statementExpression: expression;
|
||||||
|
|
||||||
constantExpression: expression;
|
constantExpression: expression;
|
||||||
|
|
||||||
expression1: expression2 [expression1Rest];
|
expression1: expression2 (expression1Rest)*;
|
||||||
|
|
||||||
expression1Rest: ['?' expression ':' expression1];
|
expression1Rest: (Question expression Colon expression1)?;
|
||||||
|
|
||||||
expression2: expression3 [expression2Rest];
|
expression2: expression3 (expression2Rest)?;
|
||||||
|
|
||||||
expression2Rest: {infixop expression3}
|
expression2Rest: (infixop expression3)*
|
||||||
| expression3 INSTANCEOF type;
|
| expression3 INSTANCEOF type;
|
||||||
|
|
||||||
infixop: ConditionalOR
|
infixop: ConditionalOR
|
||||||
@@ -68,20 +68,20 @@ infixop: ConditionalOR
|
|||||||
|
|
||||||
expression3: prefixOp expression3 // Recursion
|
expression3: prefixOp expression3 // Recursion
|
||||||
| (expr | type) expression3
|
| (expr | type) expression3
|
||||||
| primary {selector} {postfixOP};
|
| primary (selector)* (postfixOP)*;
|
||||||
|
|
||||||
primary: (expression)
|
primary: (expression)
|
||||||
| This [arguments]
|
| This (arguments)?
|
||||||
| Super superSuffix
|
| Super superSuffix
|
||||||
| literal
|
| literal
|
||||||
| New creator
|
| New creator
|
||||||
| identifier {'.' identifier} [identifierSuffix]
|
| identifier (Dot identifier)* (identifierSuffix)?
|
||||||
| basicType bracketsOpt '.'Class
|
| basicType bracketsOpt Dot Class
|
||||||
| Void '.' Class;
|
| Void Dot Class;
|
||||||
|
|
||||||
identifierSuffix: '['(']' bracketsOpt '.' Class '/' expression ']')
|
identifierSuffix: SquareBracketLeft(SquareBracketRight bracketsOpt Dot Class Division expression SquareBracketRight)
|
||||||
| arguments
|
| arguments
|
||||||
|'.' '(' Class '/' This '/' Super arguments '/' New innerCreator ')';
|
|Dot ParanthesesLeft Class Divisor This Divisor Super arguments Divisor New innerCreator ParanthesesRight;
|
||||||
// confused about this need to ask prof
|
// confused about this need to ask prof
|
||||||
|
|
||||||
prefixOp: Increment
|
prefixOp: Increment
|
||||||
@@ -111,11 +111,11 @@ basicType: Byte
|
|||||||
| Double
|
| Double
|
||||||
| Boolean;
|
| Boolean;
|
||||||
|
|
||||||
argumentsOpt: [arguments];
|
argumentsOpt: (arguments)?;
|
||||||
|
|
||||||
arguments: '(' [expression {',' expression}] ')';
|
arguments: '(' (expression (',' expression)*)? ')';
|
||||||
|
|
||||||
bracketsOpt: {'[' ']'}; //ask prof.
|
bracketsOpt: ('[' ']')*; //ask prof.
|
||||||
|
|
||||||
creator: qualifiedIdentifier ( arrayCreatorRest | classCreatorRest);
|
creator: qualifiedIdentifier ( arrayCreatorRest | classCreatorRest);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user