Create ExprSyntactic.g4
This commit is contained in:
44
ExprSyntactic.g4
Normal file
44
ExprSyntactic.g4
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
parser grammar ExprSyntactic;
|
||||||
|
|
||||||
|
options {
|
||||||
|
tokenVocab=ExprLexer;
|
||||||
|
}
|
||||||
|
|
||||||
|
identifier: IDENTIFIER;
|
||||||
|
|
||||||
|
qualifiedIdentifier: identifier {'.' identifier};
|
||||||
|
|
||||||
|
literal: IntegerLiteral
|
||||||
|
| FloatingPointLiteral
|
||||||
|
| CharacterLiteral
|
||||||
|
| StringLiteral
|
||||||
|
| BooleanLiteral
|
||||||
|
| NullLiteral;
|
||||||
|
|
||||||
|
expression: expression1 [assignmentOperator expression1];
|
||||||
|
|
||||||
|
assignmentOperator: Assignment
|
||||||
|
| AddAssign
|
||||||
|
| SubtractAssign
|
||||||
|
| MultiplyAssign
|
||||||
|
| DivideAssign
|
||||||
|
| BitwiseANDAssign
|
||||||
|
| BitwiseORAssign
|
||||||
|
| BitwiseXORAssign
|
||||||
|
| RemainderAssign
|
||||||
|
| LeftShiftAssign
|
||||||
|
| SighnedRightShiftAssign
|
||||||
|
| UnsighnedRightShiftAssign;
|
||||||
|
|
||||||
|
type: identifier {'.' identifier} bracketsOpt
|
||||||
|
| basicType;
|
||||||
|
|
||||||
|
statementExpression: expression;
|
||||||
|
|
||||||
|
constantExpression: expression;
|
||||||
|
|
||||||
|
expression1: expression2 [expression1Rest];
|
||||||
|
|
||||||
|
expression1Rest: ['?' expression ':' expression1];
|
||||||
|
|
||||||
|
expression2: expression3 [expression2Rest];
|
||||||
Reference in New Issue
Block a user