📄 parser.java
字号:
setStackSize(stackSize);
if (EQEXPR1()) {
Object o = peek(0);
popStack(2);
push(o);
return true;
}
return false;
}
private boolean EQEXPR1() {
boolean match = true;
match = match && RELEXPR();
match = match && EQEXPR2();
return match;
}
private boolean EQEXPR2() {
int isave = next;
int stackSize = getStackSize();
next = isave;
setStackSize(stackSize);
if (EQEXPR21()) {
Object o = peek(0);
popStack(4);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (EQEXPR22()) {
Object o = peek(0);
popStack(4);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (EQEXPR23()) {
Object o = peek(0);
popStack(1);
push(o);
return true;
}
return false;
}
private boolean EQEXPR21() {
boolean match = true;
match = match && token(Symbol.EQEQ);
match = match && RELEXPR();
if (match) {
InfixExpression ie = ast.newInfixExpression();
ie.setLeftOperand((Expression)peek(-2));
ie.setOperator(InfixExpression.Operator.EQUALS);
ie.setRightOperand((Expression)peek(0));
push(ie);
}
match = match && EQEXPR2();
return match;
}
private boolean EQEXPR22() {
boolean match = true;
match = match && token(Symbol.NOTEQ);
match = match && RELEXPR();
if (match) {
InfixExpression ie = ast.newInfixExpression();
ie.setLeftOperand((Expression)peek(-2));
ie.setOperator(InfixExpression.Operator.NOT_EQUALS);
ie.setRightOperand((Expression)peek(0));
push(ie);
}
match = match && EQEXPR2();
return match;
}
private boolean EQEXPR23() {
boolean match = true;
match = match && tokenEpsilon();
return match;
}
private boolean RELEXPR() {
int isave = next;
int stackSize = getStackSize();
next = isave;
setStackSize(stackSize);
if (RELEXPR1()) {
Object o = peek(0);
popStack(2);
push(o);
return true;
}
return false;
}
private boolean RELEXPR1() {
boolean match = true;
match = match && SHIFTEXPR();
match = match && RELEXPR2();
return match;
}
private boolean RELEXPR2() {
int isave = next;
int stackSize = getStackSize();
next = isave;
setStackSize(stackSize);
if (RELEXPR21()) {
Object o = peek(0);
popStack(4);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (RELEXPR22()) {
Object o = peek(0);
popStack(4);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (RELEXPR23()) {
Object o = peek(0);
popStack(4);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (RELEXPR24()) {
Object o = peek(0);
popStack(4);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (RELEXPR25()) {
Object o = peek(0);
popStack(1);
push(o);
return true;
}
return false;
}
private boolean RELEXPR21() {
boolean match = true;
match = match && token(Symbol.LT);
match = match && SHIFTEXPR();
if (match) {
InfixExpression ie = ast.newInfixExpression();
ie.setLeftOperand((Expression)peek(-2));
ie.setOperator(InfixExpression.Operator.LESS);
ie.setRightOperand((Expression)peek(0));
push(ie);
}
match = match && RELEXPR2();
return match;
}
private boolean RELEXPR22() {
boolean match = true;
match = match && token(Symbol.GT);
match = match && SHIFTEXPR();
if (match) {
InfixExpression ie = ast.newInfixExpression();
ie.setLeftOperand((Expression)peek(-2));
ie.setOperator(InfixExpression.Operator.GREATER);
ie.setRightOperand((Expression)peek(0));
push(ie);
}
match = match && RELEXPR2();
return match;
}
private boolean RELEXPR23() {
boolean match = true;
match = match && token(Symbol.LTEQ);
match = match && SHIFTEXPR();
if (match) {
InfixExpression ie = ast.newInfixExpression();
ie.setLeftOperand((Expression)peek(-2));
ie.setOperator(InfixExpression.Operator.LESS_EQUALS);
ie.setRightOperand((Expression)peek(0));
push(ie);
}
match = match && RELEXPR2();
return match;
}
private boolean RELEXPR24() {
boolean match = true;
match = match && token(Symbol.GTEQ);
match = match && SHIFTEXPR();
if (match) {
InfixExpression ie = ast.newInfixExpression();
ie.setLeftOperand((Expression)peek(-2));
ie.setOperator(InfixExpression.Operator.GREATER_EQUALS);
ie.setRightOperand((Expression)peek(0));
push(ie);
}
match = match && RELEXPR2();
return match;
}
private boolean RELEXPR25() {
boolean match = true;
match = match && tokenEpsilon();
return match;
}
private boolean SHIFTEXPR() {
int isave = next;
int stackSize = getStackSize();
next = isave;
setStackSize(stackSize);
if (SHIFTEXPR1()) {
Object o = peek(0);
popStack(2);
push(o);
return true;
}
return false;
}
private boolean SHIFTEXPR1() {
boolean match = true;
match = match && ADDSUBEXPR();
match = match && SHIFTEXPR2();
return match;
}
private boolean SHIFTEXPR2() {
int isave = next;
int stackSize = getStackSize();
next = isave;
setStackSize(stackSize);
if (SHIFTEXPR21()) {
Object o = peek(0);
popStack(4);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (SHIFTEXPR22()) {
Object o = peek(0);
popStack(4);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (SHIFTEXPR23()) {
Object o = peek(0);
popStack(1);
push(o);
return true;
}
return false;
}
private boolean SHIFTEXPR21() {
boolean match = true;
match = match && token(Symbol.LSHIFT);
match = match && ADDSUBEXPR();
if (match) {
InfixExpression ie = ast.newInfixExpression();
ie.setLeftOperand((Expression)peek(-2));
ie.setOperator(InfixExpression.Operator.LEFT_SHIFT);
ie.setRightOperand((Expression)peek(0));
push(ie);
}
match = match && SHIFTEXPR2();
return match;
}
private boolean SHIFTEXPR22() {
boolean match = true;
match = match && token(Symbol.RSHIFT);
match = match && ADDSUBEXPR();
if (match) {
InfixExpression ie = ast.newInfixExpression();
ie.setLeftOperand((Expression)peek(-2));
ie.setOperator(InfixExpression.Operator.RIGHT_SHIFT_SIGNED);
ie.setRightOperand((Expression)peek(0));
push(ie);
}
match = match && SHIFTEXPR2();
return match;
}
private boolean SHIFTEXPR23() {
boolean match = true;
match = match && tokenEpsilon();
return match;
}
private boolean ADDSUBEXPR() {
int isave = next;
int stackSize = getStackSize();
next = isave;
setStackSize(stackSize);
if (ADDSUBEXPR1()) {
Object o = peek(0);
popStack(2);
push(o);
return true;
}
return false;
}
private boolean ADDSUBEXPR1() {
boolean match = true;
match = match && MULDIVEXPR();
match = match && ADDSUBEXPR2();
return match;
}
private boolean ADDSUBEXPR2() {
int isave = next;
int stackSize = getStackSize();
next = isave;
setStackSize(stackSize);
if (ADDSUBEXPR21()) {
Object o = peek(0);
popStack(4);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (ADDSUBEXPR22()) {
Object o = peek(0);
popStack(4);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (ADDSUBEXPR23()) {
Object o = peek(0);
popStack(1);
push(o);
return true;
}
return false;
}
private boolean ADDSUBEXPR21() {
boolean match = true;
match = match && token(Symbol.PLUS);
match = match && MULDIVEXPR();
if (match) {
InfixExpression ie = ast.newInfixExpression();
ie.setLeftOperand((Expression)peek(-2));
ie.setOperator(InfixExpression.Operator.PLUS);
ie.setRightOperand((Expression)peek(0));
push(ie);
}
match = match && ADDSUBEXPR2();
return match;
}
private boolean ADDSUBEXPR22() {
boolean match = true;
match = match && token(Symbol.MINUS);
match = match && MULDIVEXPR();
if (match) {
InfixExpression ie = ast.newInfixExpression();
ie.setLeftOperand((Expression)peek(-2));
ie.setOperator(InfixExpression.Operator.MINUS);
ie.setRightOperand((Expression)peek(0));
push(ie);
}
match = match && ADDSUBEXPR2();
return match;
}
private boolean ADDSUBEXPR23() {
boolean match = true;
match = match && tokenEpsilon();
return match;
}
private boolean MULDIVEXPR() {
int isave = next;
int stackSize = getStackSize();
next = isave;
setStackSize(stackSize);
if (MULDIVEXPR1()) {
Object o = peek(0);
popStack(2);
push(o);
return true;
}
return false;
}
private boolean MULDIVEXPR1() {
boolean match = true;
match = match && UNARYEXPR();
match = match && MULDIVEXPR2();
return match;
}
private boolean MULDIVEXPR2() {
int isave = next;
int stackSize = getStackSize();
next = isave;
setStackSize(stackSize);
if (MULDIVEXPR21()) {
Object o = peek(0);
popStack(4);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (MULDIVEXPR22()) {
Object o = peek(0);
popStack(4);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (MULDIVEXPR23()) {
Object o = peek(0);
popStack(4);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (MULDIVEXPR24()) {
Object o = peek(0);
popStack(1);
push(o);
return true;
}
return false;
}
private boolean MULDIVEXPR21() {
boolean match = true;
match = match && token(Symbol.MULT);
match = match && UNARYEXPR();
if (match) {
InfixExpression ie = ast.newInfixExpression();
ie.setLeftOperand((Expression)peek(-2));
ie.setOperator(InfixExpression.Operator.TIMES);
ie.setRightOperand((Expression)peek(0));
push(ie);
}
match = match && MULDIVEXPR2();
return match;
}
private boolean MULDIVEXPR22() {
boolean match = true;
match = match && token(Symbol.DIV);
match = match && UNARYEXPR();
if (match) {
InfixExpression ie = ast.newInfixExpression();
ie.setLeftOperand((Expression)peek(-2));
ie.setOperator(InfixExpression.Operator.DIVIDE);
ie.setRightOperand((Expression)peek(0));
push(ie);
}
match = match && MULDIVEXPR2();
return match;
}
private boolean MULDIVEXPR23() {
boolean match = true;
match = match && token(Symbol.MOD);
match = match && UNARYEXPR();
if (match) {
InfixExpression ie = ast.newInfixExpression();
ie.setLeftOperand((Expression)peek(-2));
ie.setOperator(InfixExpression.Operator.REMAINDER);
ie.setRightOperand((Expression)peek(0));
push(ie);
}
match = match && MULDIVEXPR2();
return match;
}
private boolean MULDIVEXPR24() {
boolean match = true;
match = match && tokenEpsilon();
return match;
}
private boolean UNARYEXPR() {
int isave = next;
int stackSize = getStackSize();
next = isave;
setStackSize(stackSize);
if (UNARYEXPR1()) {
Object o = peek(0);
popStack(3);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (UNARYEXPR2()) {
Object o = peek(0);
popStack(3);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (UNARYEXPR3()) {
Object o = peek(0);
popStack(1);
push(o);
return true;
}
return false;
}
private boolean UNARYEXPR1() {
boolean match = true;
match = match && token(Symbol.MINUS);
match = match && TERMEXPR();
if (match) {
PrefixExpression pe = ast.newPrefixExpression();
pe.setOperand((Expression)peek(0));
pe.setOperator(PrefixExpression.Operator.MINUS);
push(pe);
}
return match;
}
private boolean UNARYEXPR2() {
boolean match = true;
match = match && token(Symbol.NOT);
match = match && TERMEXPR();
if (match) {
PrefixExpression pe = ast.newPrefixExpression();
pe.setOperand((Expression)peek(0));
pe.setOperator(PrefixExpression.Operator.NOT);
push(pe);
}
return match;
}
private boolean UNARYEXPR3() {
boolean match = true;
match = match && TERMEXPR();
return match;
}
private boolean TERMEXPR() {
int isave = next;
int stackSize = getStackSize();
next = isave;
setStackSize(stackSize);
if (TERMEXPR1()) {
Object o = peek(0);
popStack(4);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (TERMEXPR2()) {
Object o = peek(0);
popStack(5);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (TERMEXPR3()) {
Object o = peek(0);
popStack(1);
push(o);
return true;
}
next = isave;
setStackSize(stackSize);
if (TERMEXPR4()) {
Object o = peek(0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -