📄 checker.java
字号:
return CUP$Checker$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 36: // lit_expr ::= FLOAT { Object RESULT = null; int numleft = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left; int numright = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right; Float num = (Float)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-0)).value; RESULT = num; CUP$Checker$result = new java_cup.runtime.Symbol(5/*lit_expr*/, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right, RESULT); } return CUP$Checker$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 35: // lit_expr ::= DOUBLE { Object RESULT = null; int numleft = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left; int numright = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right; Double num = (Double)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-0)).value; RESULT = num; CUP$Checker$result = new java_cup.runtime.Symbol(5/*lit_expr*/, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right, RESULT); } return CUP$Checker$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 34: // lit_expr ::= ID { Object RESULT = null; int idleft = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left; int idright = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right; String id = (String)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-0)).value; if (id.equals("TRUE") || id.equals("FALSE") || id.equals("NULL")) throw new SelectorException("Invalid ID TRUE, FALSE or FALSE"); // id type and value are not known at that step! RESULT = null; CUP$Checker$result = new java_cup.runtime.Symbol(5/*lit_expr*/, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right, RESULT); } return CUP$Checker$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 33: // lit_expr ::= LPAREN expr RPAREN { Object RESULT = null; int eleft = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-1)).left; int eright = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-1)).right; Object e = (Object)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-1)).value; RESULT = e; CUP$Checker$result = new java_cup.runtime.Symbol(5/*lit_expr*/, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-2)).left, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right, RESULT); } return CUP$Checker$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 32: // expr ::= lit_expr { Object RESULT = null; int litleft = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left; int litright = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right; Object lit = (Object)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-0)).value; RESULT = lit; CUP$Checker$result = new java_cup.runtime.Symbol(4/*expr*/, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right, RESULT); } return CUP$Checker$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 31: // expr ::= MIN_LONG expr { Object RESULT = null; int eleft = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left; int eright = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right; Object e = (Object)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-0)).value; RESULT = new Long(0); CUP$Checker$result = new java_cup.runtime.Symbol(4/*expr*/, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-1)).left, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right, RESULT); } return CUP$Checker$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 30: // expr ::= MINUS expr { Object RESULT = null; int eleft = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left; int eright = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right; Object e = (Object)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-0)).value; if (e instanceof String || e instanceof Boolean) throw new SelectorException("Numeric type expected" + " after '-'"); if (e instanceof Double) RESULT = new Double(0); else if (e instanceof Float) RESULT = new Float(0); else if (e instanceof Long) RESULT = new Long(0); else if (e instanceof Integer) RESULT = new Integer(0); else if (e instanceof Short) RESULT = new Short((short)0); else RESULT = new Double(0); CUP$Checker$result = new java_cup.runtime.Symbol(4/*expr*/, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-1)).left, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right, RESULT); } return CUP$Checker$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 29: // expr ::= PLUS expr { Object RESULT = null; int eleft = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left; int eright = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right; Object e = (Object)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-0)).value; if (e instanceof String || e instanceof Boolean) throw new SelectorException("Numeric type expected" + " after '+'"); else RESULT = new Double(0); CUP$Checker$result = new java_cup.runtime.Symbol(4/*expr*/, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-1)).left, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right, RESULT); } return CUP$Checker$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 28: // expr ::= expr DIVIDE expr { Object RESULT = null; int e1left = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-2)).left; int e1right = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-2)).right; Object e1 = (Object)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-2)).value; int e2left = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left; int e2right = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right; Object e2 = (Object)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-0)).value; if (e1 instanceof String || e1 instanceof Boolean) throw new SelectorException("Numeric type expected" + " before '/'"); else if (e2 instanceof String || e2 instanceof Boolean) throw new SelectorException("Numeric type expected" + " after '/'"); else RESULT = new Double(0); CUP$Checker$result = new java_cup.runtime.Symbol(4/*expr*/, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-2)).left, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right, RESULT); } return CUP$Checker$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 27: // expr ::= expr TIMES expr { Object RESULT = null; int e1left = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-2)).left; int e1right = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-2)).right; Object e1 = (Object)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-2)).value; int e2left = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left; int e2right = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right; Object e2 = (Object)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-0)).value; if (e1 instanceof String || e1 instanceof Boolean) throw new SelectorException("Numeric type expected" + " before '*'"); else if (e2 instanceof String || e2 instanceof Boolean) throw new SelectorException("Numeric type expected" + " after '*'"); else RESULT = new Double(0); CUP$Checker$result = new java_cup.runtime.Symbol(4/*expr*/, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-2)).left, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right, RESULT); } return CUP$Checker$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 26: // expr ::= expr MINUS expr { Object RESULT = null; int e1left = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-2)).left; int e1right = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-2)).right; Object e1 = (Object)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-2)).value; int e2left = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left; int e2right = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right; Object e2 = (Object)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-0)).value; if (e1 instanceof String || e1 instanceof Boolean) throw new SelectorException("Numeric type expected" + " before '-'"); else if (e2 instanceof String || e2 instanceof Boolean) throw new SelectorException("Numeric type expected" + " after '-'"); else RESULT = new Double(0); CUP$Checker$result = new java_cup.runtime.Symbol(4/*expr*/, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-2)).left, ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right, RESULT); } return CUP$Checker$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 25: // expr ::= expr PLUS expr { Object RESULT = null; int e1left = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-2)).left; int e1right = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-2)).right; Object e1 = (Object)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-2)).value; int e2left = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).left; int e2right = ((java_cup.runtime.Symbol)CUP$Checker$stack.elementAt(CUP$Checker$top-0)).right; Object e2 = (Object)((java_cup.runtime.Symbol) CUP$Checker$stack.elementAt(CUP$Checker$top-0)).value; if (e1 instanceof String || e1 instanceof Boolean) throw new SelectorException("Numeric type expected" + " before '+'"); else if (e2 instanceof String || e2 instanceof Boolean)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -