📄 parser.java
字号:
//----------------------------------------------------// The following code was generated by CUP v0.9e// Tue Aug 20 18:50:40 EDT 1996//----------------------------------------------------import java_cup.runtime.*;import java.util.*;import java.lang.*;import java.io.*;public class parser extends java_cup.runtime.lr_parser { /** constructor */ public parser() {super();} /** production table */ protected static final short _production_table[][] = { {4, 1}, {0, 2}, {4, 3}, {3, 1}, {3, 1}, {3, 1}, {3, 1}, {3, 1}, {3, 1}, {23, 0}, {22, 5}, {24, 0}, {25, 0}, {11, 6}, {26, 0}, {27, 0}, {2, 7}, {28, 0}, {29, 0}, {1, 9}, {6, 3}, {30, 0}, {5, 7}, {15, 4}, {16, 1}, {16, 1}, {17, 1}, {17, 3}, {13, 1}, {13, 3}, {19, 1}, {19, 3}, {14, 1}, {14, 1}, {14, 3}, {18, 1}, {21, 1}, {21, 3}, {20, 5}, {20, 5}, {20, 2}, {7, 0}, {7, 2}, {9, 1}, {9, 3}, {8, 3}, {8, 3}, {8, 3}, {12, 2}, {12, 3}, {10, 3} }; /** access to production table */ public short[][] production_table() {return _production_table;} /** parse action table */ protected static final short[][] _action_table = { /*0*/{2,11,9,12,14,5,17,15,21,7,22,14,-1,0}, /*1*/{0,-8,11,-8,-1,0}, /*2*/{0,-9,11,-9,-1,0}, /*3*/{0,-6,11,-6,-1,0}, /*4*/{15,82,-1,0}, /*5*/{0,80,11,79,-1,0}, /*6*/{24,17,-1,0}, /*7*/{0,-1,11,-1,-1,0}, /*8*/{0,-7,11,-7,-1,0}, /*9*/{0,-4,11,-4,-1,0}, /*10*/{8,50,-1,0}, /*11*/{23,27,24,26,-1,0}, /*12*/{0,-5,11,-5,-1,0}, /*13*/{10,19,-1,0}, /*14*/{15,16,-1,0}, /*15*/{24,17,-1,0}, /*16*/{0,-36,4,-36,6,-36,11,-36,18,-36,20,-36,-1,0}, /*17*/{0,-21,11,-21,-1,0}, /*18*/{24,17,-1,0}, /*19*/{0,-10,11,-10,18,-10,-1,0}, /*20*/{0,-42,11,-42,18,23,-1,0}, /*21*/{0,-11,11,-11,-1,0}, /*22*/{23,27,24,26,-1,0}, /*23*/{27,34,-1,0}, /*24*/{0,-43,11,-43,19,32,-1,0}, /*25*/{0,-34,4,-34,5,-36,7,-34,10,-34,11,-34,12,-34,13,-34,16,-34,19,-34,27,-34,-1,0}, /*26*/{0,-33,4,-33,7,-33,10,-33,11,-33,12,-33,13,-33,16,-33,19,-33,27,-33,-1,0}, /*27*/{0,-44,11,-44,19,-44,-1,0}, /*28*/{5,30,-1,0}, /*29*/{23,27,24,26,-1,0}, /*30*/{0,-35,4,-35,7,-35,10,-35,11,-35,12,-35,13,-35,16,-35,19,-35,27,-35,-1,0}, /*31*/{23,27,24,26,-1,0}, /*32*/{0,-45,11,-45,19,-45,-1,0}, /*33*/{23,27,24,26,25,36,26,37,-1,0}, /*34*/{0,-46,11,-46,19,-46,-1,0}, /*35*/{0,-48,11,-48,19,-48,-1,0}, /*36*/{0,-47,11,-47,19,-47,-1,0}, /*37*/{4,-29,7,-29,10,-29,-1,0}, /*38*/{4,40,10,-15,-1,0}, /*39*/{23,27,24,26,-1,0}, /*40*/{10,42,-1,0}, /*41*/{24,17,-1,0}, /*42*/{0,-16,4,46,11,-16,18,-16,-1,0}, /*43*/{0,-31,4,-31,11,-31,18,-31,-1,0}, /*44*/{0,-42,11,-42,18,23,-1,0}, /*45*/{24,17,-1,0}, /*46*/{0,-32,4,-32,11,-32,18,-32,-1,0}, /*47*/{0,-17,11,-17,-1,0}, /*48*/{4,-30,7,-30,10,-30,-1,0}, /*49*/{24,17,-1,0}, /*50*/{6,-18,-1,0}, /*51*/{6,53,-1,0}, /*52*/{23,27,24,26,-1,0}, /*53*/{4,40,7,55,-1,0}, /*54*/{3,-19,-1,0}, /*55*/{3,57,-1,0}, /*56*/{6,59,-1,0}, /*57*/{0,-20,11,-20,-1,0}, /*58*/{25,60,26,62,-1,0}, /*59*/{0,-25,4,-25,7,-25,11,-25,18,-25,-1,0}, /*60*/{4,-27,7,-27,-1,0}, /*61*/{0,-26,4,-26,7,-26,11,-26,18,-26,-1,0}, /*62*/{4,64,7,65,-1,0}, /*63*/{25,60,26,62,-1,0}, /*64*/{0,-24,11,-24,-1,0}, /*65*/{4,-28,7,-28,-1,0}, /*66*/{20,-12,-1,0}, /*67*/{20,69,-1,0}, /*68*/{23,27,24,26,-1,0}, /*69*/{0,-13,4,71,11,-13,18,-13,-1,0}, /*70*/{23,27,24,26,-1,0}, /*71*/{0,-42,11,-42,18,23,-1,0}, /*72*/{0,-14,11,-14,-1,0}, /*73*/{27,76,-1,0}, /*74*/{0,-50,4,-50,11,-50,18,-50,-1,0}, /*75*/{25,60,26,62,-1,0}, /*76*/{0,-51,4,-51,11,-51,18,-51,-1,0}, /*77*/{0,-49,4,-49,11,-49,18,-49,-1,0}, /*78*/{2,11,9,12,14,5,17,15,21,7,22,14,-1,0}, /*79*/{0,-2,-1,0}, /*80*/{0,-3,11,-3,-1,0}, /*81*/{24,17,-1,0}, /*82*/{6,-22,-1,0}, /*83*/{6,85,-1,0}, /*84*/{23,27,24,26,-1,0}, /*85*/{12,92,13,94,16,93,-1,0}, /*86*/{4,-37,7,-37,-1,0}, /*87*/{4,89,7,90,-1,0}, /*88*/{23,27,24,26,-1,0}, /*89*/{0,-23,11,-23,-1,0}, /*90*/{4,-38,7,-38,-1,0}, /*91*/{6,98,-1,0}, /*92*/{4,-41,7,-41,-1,0}, /*93*/{6,95,-1,0}, /*94*/{25,96,-1,0}, /*95*/{7,97,-1,0}, /*96*/{4,-40,7,-40,-1,0}, /*97*/{25,99,-1,0}, /*98*/{7,100,-1,0}, /*99*/{4,-39,7,-39,-1,0}, }; /** access to parse action table */ public short[][] action_table() {return _action_table;} /** reduce_goto table */ protected static final short[][] _reduce_table = { /*0*/{1,12,2,9,3,7,4,5,5,3,6,8,11,1,22,2,-1,-1}, /*1*/{-1,-1}, /*2*/{-1,-1}, /*3*/{-1,-1}, /*4*/{-1,-1}, /*5*/{-1,-1}, /*6*/{18,66,-1,-1}, /*7*/{-1,-1}, /*8*/{-1,-1}, /*9*/{-1,-1}, /*10*/{-1,-1}, /*11*/{13,38,14,37,18,28,-1,-1}, /*12*/{-1,-1}, /*13*/{-1,-1}, /*14*/{-1,-1}, /*15*/{18,17,-1,-1}, /*16*/{-1,-1}, /*17*/{-1,-1}, /*18*/{18,19,-1,-1}, /*19*/{23,20,-1,-1}, /*20*/{7,21,-1,-1}, /*21*/{-1,-1}, /*22*/{8,27,9,24,14,23,18,28,-1,-1}, /*23*/{-1,-1}, /*24*/{-1,-1}, /*25*/{-1,-1}, /*26*/{-1,-1}, /*27*/{-1,-1}, /*28*/{-1,-1}, /*29*/{14,30,18,28,-1,-1}, /*30*/{-1,-1}, /*31*/{8,32,14,23,18,28,-1,-1}, /*32*/{-1,-1}, /*33*/{14,34,18,28,-1,-1}, /*34*/{-1,-1}, /*35*/{-1,-1}, /*36*/{-1,-1}, /*37*/{-1,-1}, /*38*/{26,40,-1,-1}, /*39*/{14,48,18,28,-1,-1}, /*40*/{-1,-1}, /*41*/{18,43,19,42,-1,-1}, /*42*/{27,44,-1,-1}, /*43*/{-1,-1}, /*44*/{7,47,-1,-1}, /*45*/{18,46,-1,-1}, /*46*/{-1,-1}, /*47*/{-1,-1}, /*48*/{-1,-1}, /*49*/{18,50,-1,-1}, /*50*/{28,51,-1,-1}, /*51*/{-1,-1}, /*52*/{13,53,14,37,18,28,-1,-1}, /*53*/{-1,-1}, /*54*/{29,55,-1,-1}, /*55*/{15,57,-1,-1}, /*56*/{-1,-1}, /*57*/{-1,-1}, /*58*/{16,60,17,62,-1,-1}, /*59*/{-1,-1}, /*60*/{-1,-1}, /*61*/{-1,-1}, /*62*/{-1,-1}, /*63*/{16,65,-1,-1}, /*64*/{-1,-1}, /*65*/{-1,-1}, /*66*/{24,67,-1,-1}, /*67*/{12,69,-1,-1}, /*68*/{10,77,14,73,18,28,-1,-1}, /*69*/{25,71,-1,-1}, /*70*/{10,74,14,73,18,28,-1,-1}, /*71*/{7,72,-1,-1}, /*72*/{-1,-1}, /*73*/{-1,-1}, /*74*/{-1,-1}, /*75*/{16,76,-1,-1}, /*76*/{-1,-1}, /*77*/{-1,-1}, /*78*/{1,12,2,9,3,80,5,3,6,8,11,1,22,2,-1,-1}, /*79*/{-1,-1}, /*80*/{-1,-1}, /*81*/{18,82,-1,-1}, /*82*/{30,83,-1,-1}, /*83*/{-1,-1}, /*84*/{14,85,18,28,20,86,21,87,-1,-1}, /*85*/{-1,-1}, /*86*/{-1,-1}, /*87*/{-1,-1}, /*88*/{14,85,18,28,20,90,-1,-1}, /*89*/{-1,-1}, /*90*/{-1,-1}, /*91*/{-1,-1}, /*92*/{-1,-1}, /*93*/{-1,-1}, /*94*/{-1,-1}, /*95*/{-1,-1}, /*96*/{-1,-1}, /*97*/{-1,-1}, /*98*/{-1,-1}, /*99*/{-1,-1}, }; /** access to reduce_goto table */ public short[][] reduce_table() {return _reduce_table;} /** instance of action encapsulation class */ protected CUP$actions action_obj; /** action encapsulation object initializer */ protected void init_actions() { action_obj = new CUP$actions(); } /** invoke a user supplied parse action */ public java_cup.runtime.symbol do_action( int act_num, java_cup.runtime.lr_parser parser, java.util.Stack stack, int top) throws java.lang.Exception { /* call code in generated class */ return action_obj.CUP$do_action(act_num, parser, stack, top); } /** start state */ public int start_state() {return 0;} /** start production */ public int start_production() {return 1;} /** EOF symbol index */ public int EOF_sym() {return 0;} /** error symbol index */ public int error_sym() {return 1;} /** user initialization */ public void user_init() throws java.lang.Exception { scanner.init(parserInputStream); } /** scan to get the next token */ public java_cup.runtime.token scan() throws java.lang.Exception { return scanner.next_token(); } InputStream parserInputStream; public parser(InputStream is) { this(); parserInputStream = is; }};/** Cup generated class to encapsulate user supplied action code.*/class CUP$actions {Vector actions = new Vector();Hashtable Statement = new Hashtable();Vector value_list = new Vector();Vector foo = new Vector();Vector column_list = new Vector();Vector search_list = new Vector();public void addAction (Vector v, String type) { Hashtable h = ( (Hashtable) Statement.clone() ); h.put("TYPE", type); v.addElement(h); Statement.clear(); value_list.removeAllElements(); foo.removeAllElements(); column_list.removeAllElements(); search_list.removeAllElements();}public Vector getActions() { return actions;} /** Constructor */ CUP$actions() { } /** Method with the actual generated action code. */ public final java_cup.runtime.symbol CUP$do_action( int CUP$act_num, java_cup.runtime.lr_parser CUP$parser, java.util.Stack CUP$stack, int CUP$top) throws java.lang.Exception { /* object for return from actions */ java_cup.runtime.symbol CUP$result; /* select the action based on the action number */ switch (CUP$act_num) { /*. . . . . . . . . . . . . . . . . . . .*/ case 50: // set_expr ::= column COMPARISON value { CUP$result = new int_token(/*set_expr*/10); foo.addElement(new String((/*s1*/(str_token)CUP$stack.elementAt(CUP$top-2)).str_val)); value_list.addElement(new String((/*s2*/(str_token)CUP$stack.elementAt(CUP$top-0)).str_val)); } return CUP$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 49: // set_clause ::= set_clause COMMA set_expr { CUP$result = new int_token(/*set_clause*/12); } return CUP$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 48: // set_clause ::= SET set_expr { CUP$result = new int_token(/*set_clause*/12); } return CUP$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 47: // search_expr ::= column COMPARISON INT_NUM { CUP$result = new int_token(/*search_expr*/8); String search_expr_def[] = new String[4]; search_expr_def[0] = "INT_COMPARE"; search_expr_def[1] = (/*s1*/(str_token)CUP$stack.elementAt(CUP$top-2)).str_val; search_expr_def[2] = (/*s2*/(str_token)CUP$stack.elementAt(CUP$top-1)).str_val; search_expr_def[3] = (/*s3*/(str_token)CUP$stack.elementAt(CUP$top-0)).str_val; search_list.addElement( search_expr_def ); } return CUP$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 46: // search_expr ::= column COMPARISON STRING { CUP$result = new int_token(/*search_expr*/8); String search_expr_def[] = new String[4]; search_expr_def[0] = "STRING_COMPARE"; search_expr_def[1] = (/*s1*/(str_token)CUP$stack.elementAt(CUP$top-2)).str_val; search_expr_def[2] = (/*s2*/(str_token)CUP$stack.elementAt(CUP$top-1)).str_val; search_expr_def[3] = (/*s3*/(str_token)CUP$stack.elementAt(CUP$top-0)).str_val; search_list.addElement( search_expr_def ); } return CUP$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 45: // search_expr ::= column COMPARISON column { CUP$result = new int_token(/*search_expr*/8); String search_expr_def[] = new String[4]; search_expr_def[0] = "JOIN"; search_expr_def[1] = (/*s1*/(str_token)CUP$stack.elementAt(CUP$top-2)).str_val; search_expr_def[2] = (/*s2*/(str_token)CUP$stack.elementAt(CUP$top-1)).str_val; search_expr_def[3] = (/*s3*/(str_token)CUP$stack.elementAt(CUP$top-0)).str_val; search_list.addElement( search_expr_def ); } return CUP$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 44: // search_condition ::= search_condition AND search_expr { CUP$result = new int_token(/*search_condition*/9);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -