Home | History | Annotate | Download | only in java_cup
      1 
      2 //----------------------------------------------------
      3 // The following code was generated by Java(tm) CUP v0.9d
      4 // Thu Aug 10 03:51:39 MSD 2006
      5 //----------------------------------------------------
      6 
      7 package java_cup;
      8 
      9 import java.util.Hashtable;
     10 
     11 public class parser extends java_cup.runtime.lr_parser {
     12 
     13   /** constructor */
     14   public parser() {super();}
     15 
     16   /** production table */
     17   protected static final short _production_table[][] = {
     18         {0, 2},     {32, 0},     {1, 10},     {1, 4},     {33, 0},
     19         {2, 4},     {2, 1},     {3, 2},     {3, 1},     {34, 0},
     20         {11, 4},     {4, 2},     {5, 4},     {5, 1},     {6, 4},
     21         {6, 1},     {13, 4},     {13, 1},     {14, 4},     {14, 1},
     22         {16, 4},     {16, 1},     {7, 2},     {7, 1},     {35, 0},
     23         {15, 5},     {36, 0},     {15, 6},     {37, 0},     {15, 4},
     24         {38, 0},     {15, 5},     {18, 3},     {18, 1},     {19, 3},
     25         {19, 1},     {39, 0},     {8, 5},     {8, 1},     {9, 2},
     26         {9, 1},     {40, 0},     {20, 5},     {41, 0},     {20, 3},
     27         {25, 3},     {25, 1},     {26, 1},     {21, 2},     {21, 1},
     28         {22, 2},     {22, 1},     {31, 2},     {31, 1},     {10, 3},
     29         {10, 1},     {12, 3},     {12, 1},     {17, 1},     {23, 1},
     30         {24, 1},     {28, 1},     {29, 1},     {30, 1},     {27, 0}
     31       };
     32 
     33   /** access to production table */
     34   public short[][] production_table() {return _production_table;}
     35 
     36   /** parse action table */
     37   protected static final short[][] _action_table = {
     38     /*0*/{1,3,2,-2,3,-2,5,-2,6,-2,7,-2,8,-2,9,-2,10,-2,20,-2,-1,0},
     39     /*1*/{0,120,-1,0},
     40     /*2*/{7,34,8,36,-1,0},
     41     /*3*/{2,7,3,-65,5,-65,6,-65,7,-65,8,-65,9,-65,10,-65,20,-65,-1,0},
     42     /*4*/{3,-65,5,-65,6,-65,7,-65,8,-65,9,-65,10,-65,20,-65,-1,0},
     43     /*5*/{3,-7,5,-7,6,-7,7,-7,8,-7,9,-7,10,-7,20,-7,-1,0},
     44     /*6*/{21,8,-1,0},
     45     /*7*/{13,-56,16,-56,21,-56,-1,0},
     46     /*8*/{13,-5,16,11,-1,0},
     47     /*9*/{13,13,-1,0},
     48     /*10*/{21,12,-1,0},
     49     /*11*/{13,-55,16,-55,21,-55,-1,0},
     50     /*12*/{3,-6,5,-6,6,-6,7,-6,8,-6,9,-6,10,-6,20,-6,-1,0},
     51     /*13*/{3,17,5,18,6,-65,7,-65,8,-65,9,-65,10,-65,20,-65,-1,0},
     52     /*14*/{3,-9,5,-9,6,-9,7,-9,8,-9,9,-9,10,-9,20,-9,-1,0},
     53     /*15*/{3,-8,5,-8,6,-8,7,-8,8,-8,9,-8,10,-8,20,-8,-1,0},
     54     /*16*/{21,8,-1,0},
     55     /*17*/{4,108,-1,0},
     56     /*18*/{6,103,7,-65,8,-65,9,-65,10,-65,20,-65,-1,0},
     57     /*19*/{6,-14,7,-14,8,-14,9,-14,10,-14,20,-14,-1,0},
     58     /*20*/{7,-65,8,-65,9,-65,10,-65,20,22,-1,0},
     59     /*21*/{11,99,-1,0},
     60     /*22*/{7,-22,8,-22,9,-22,10,-22,-1,0},
     61     /*23*/{7,-65,8,-65,9,25,10,-65,-1,0},
     62     /*24*/{11,96,-1,0},
     63     /*25*/{7,-65,8,-65,10,29,-1,0},
     64     /*26*/{7,-18,8,-18,10,-18,-1,0},
     65     /*27*/{7,34,8,36,-1,0},
     66     /*28*/{11,31,-1,0},
     67     /*29*/{7,-20,8,-20,-1,0},
     68     /*30*/{22,32,-1,0},
     69     /*31*/{13,33,-1,0},
     70     /*32*/{7,-19,8,-19,-1,0},
     71     /*33*/{1,85,21,8,-1,0},
     72     /*34*/{1,-24,7,-24,8,-24,12,-24,21,-24,-1,0},
     73     /*35*/{7,72,-1,0},
     74     /*36*/{1,-65,7,34,8,36,12,41,21,-65,-1,0},
     75     /*37*/{1,47,21,43,-1,0},
     76     /*38*/{1,-39,21,-39,-1,0},
     77     /*39*/{1,-23,7,-23,8,-23,12,-23,21,-23,-1,0},
     78     /*40*/{11,42,-1,0},
     79     /*41*/{21,43,-1,0},
     80     /*42*/{13,-62,18,-62,-1,0},
     81     /*43*/{13,-37,-1,0},
     82     /*44*/{13,46,-1,0},
     83     /*45*/{1,-38,21,-38,-1,0},
     84     /*46*/{13,-44,-1,0},
     85     /*47*/{18,-42,-1,0},
     86     /*48*/{0,-3,1,47,21,43,-1,0},
     87     /*49*/{0,-41,1,-41,21,-41,-1,0},
     88     /*50*/{0,-40,1,-40,21,-40,-1,0},
     89     /*51*/{18,53,-1,0},
     90     /*52*/{13,-65,19,-65,21,-65,22,-65,-1,0},
     91     /*53*/{13,68,19,67,-1,0},
     92     /*54*/{13,-50,19,-50,21,-50,22,-50,-1,0},
     93     /*55*/{13,-48,19,-48,21,59,22,58,-1,0},
     94     /*56*/{13,-47,19,-47,-1,0},
     95     /*57*/{13,-52,19,-52,21,-52,22,-52,-1,0},
     96     /*58*/{13,-63,17,-63,19,-63,21,-63,22,-63,-1,0},
     97     /*59*/{13,-65,17,62,19,-65,21,-65,22,-65,-1,0},
     98     /*60*/{13,-49,19,-49,21,-49,22,-49,-1,0},
     99     /*61*/{21,65,-1,0},
    100     /*62*/{13,-54,19,-54,21,-54,22,-54,-1,0},
    101     /*63*/{13,-51,19,-51,21,-51,22,-51,-1,0},
    102     /*64*/{13,-64,21,-64,22,-64,-1,0},
    103     /*65*/{13,-53,21,-53,22,-53,-1,0},
    104     /*66*/{13,-65,19,-65,21,-65,22,-65,-1,0},
    105     /*67*/{0,-43,1,-43,21,-43,-1,0},
    106     /*68*/{13,-46,19,-46,-1,0},
    107     /*69*/{13,71,-1,0},
    108     /*70*/{0,-45,1,-45,21,-45,-1,0},
    109     /*71*/{1,73,21,8,-1,0},
    110     /*72*/{13,-31,-1,0},
    111     /*73*/{16,11,21,-59,-1,0},
    112     /*74*/{21,76,-1,0},
    113     /*75*/{13,-61,14,-61,-1,0},
    114     /*76*/{13,-27,14,79,-1,0},
    115     /*77*/{13,-36,14,-36,-1,0},
    116     /*78*/{21,76,-1,0},
    117     /*79*/{13,81,-1,0},
    118     /*80*/{1,-28,7,-28,8,-28,12,-28,21,-28,-1,0},
    119     /*81*/{13,-35,14,-35,-1,0},
    120     /*82*/{13,84,-1,0},
    121     /*83*/{1,-32,7,-32,8,-32,12,-32,21,-32,-1,0},
    122     /*84*/{13,-29,-1,0},
    123     /*85*/{21,87,-1,0},
    124     /*86*/{13,-60,14,-60,-1,0},
    125     /*87*/{13,-34,14,-34,-1,0},
    126     /*88*/{13,-25,14,91,-1,0},
    127     /*89*/{13,93,-1,0},
    128     /*90*/{21,87,-1,0},
    129     /*91*/{13,-33,14,-33,-1,0},
    130     /*92*/{1,-26,7,-26,8,-26,12,-26,21,-26,-1,0},
    131     /*93*/{13,95,-1,0},
    132     /*94*/{1,-30,7,-30,8,-30,12,-30,21,-30,-1,0},
    133     /*95*/{22,97,-1,0},
    134     /*96*/{13,98,-1,0},
    135     /*97*/{7,-17,8,-17,10,-17,-1,0},
    136     /*98*/{21,8,-1,0},
    137     /*99*/{13,101,16,11,-1,0},
    138     /*100*/{7,-21,8,-21,9,-21,10,-21,-1,0},
    139     /*101*/{7,-16,8,-16,9,-16,10,-16,20,-16,-1,0},
    140     /*102*/{4,105,-1,0},
    141     /*103*/{7,-12,8,-12,9,-12,10,-12,20,-12,-1,0},
    142     /*104*/{22,106,-1,0},
    143     /*105*/{13,107,-1,0},
    144     /*106*/{7,-15,8,-15,9,-15,10,-15,20,-15,-1,0},
    145     /*107*/{22,109,-1,0},
    146     /*108*/{13,110,-1,0},
    147     /*109*/{6,-13,7,-13,8,-13,9,-13,10,-13,20,-13,-1,0},
    148     /*110*/{13,-58,16,115,-1,0},
    149     /*111*/{13,-10,-1,0},
    150     /*112*/{13,114,-1,0},
    151     /*113*/{3,-11,5,-11,6,-11,7,-11,8,-11,9,-11,10,-11,20,-11,-1,0},
    152     /*114*/{15,116,21,12,-1,0},
    153     /*115*/{13,-57,-1,0},
    154     /*116*/{1,-65,7,34,8,36,12,41,21,-65,-1,0},
    155     /*117*/{1,47,21,43,-1,0},
    156     /*118*/{0,-4,1,47,21,43,-1,0},
    157     /*119*/{0,-1,-1,0},
    158   };
    159 
    160   /** access to parse action table */
    161   public short[][] action_table() {return _action_table;}
    162 
    163   /** reduce_goto table */
    164   protected static final short[][] _reduce_table = {
    165     /*0*/{1,1,32,3,-1,-1},
    166     /*1*/{-1,-1},
    167     /*2*/{7,116,15,34,-1,-1},
    168     /*3*/{2,4,27,5,-1,-1},
    169     /*4*/{3,13,27,14,-1,-1},
    170     /*5*/{-1,-1},
    171     /*6*/{10,8,-1,-1},
    172     /*7*/{-1,-1},
    173     /*8*/{33,9,-1,-1},
    174     /*9*/{-1,-1},
    175     /*10*/{-1,-1},
    176     /*11*/{-1,-1},
    177     /*12*/{-1,-1},
    178     /*13*/{4,20,5,18,11,15,27,19,-1,-1},
    179     /*14*/{-1,-1},
    180     /*15*/{-1,-1},
    181     /*16*/{10,110,12,111,-1,-1},
    182     /*17*/{-1,-1},
    183     /*18*/{6,103,27,101,-1,-1},
    184     /*19*/{-1,-1},
    185     /*20*/{16,23,27,22,-1,-1},
    186     /*21*/{-1,-1},
    187     /*22*/{-1,-1},
    188     /*23*/{13,25,27,26,-1,-1},
    189     /*24*/{-1,-1},
    190     /*25*/{14,27,27,29,-1,-1},
    191     /*26*/{-1,-1},
    192     /*27*/{7,36,15,34,-1,-1},
    193     /*28*/{-1,-1},
    194     /*29*/{-1,-1},
    195     /*30*/{-1,-1},
    196     /*31*/{-1,-1},
    197     /*32*/{-1,-1},
    198     /*33*/{10,73,17,85,-1,-1},
    199     /*34*/{-1,-1},
    200     /*35*/{-1,-1},
    201     /*36*/{8,37,15,39,27,38,-1,-1},
    202     /*37*/{9,48,20,49,28,47,-1,-1},
    203     /*38*/{-1,-1},
    204     /*39*/{-1,-1},
    205     /*40*/{-1,-1},
    206     /*41*/{28,43,-1,-1},
    207     /*42*/{-1,-1},
    208     /*43*/{39,44,-1,-1},
    209     /*44*/{-1,-1},
    210     /*45*/{-1,-1},
    211     /*46*/{41,69,-1,-1},
    212     /*47*/{40,51,-1,-1},
    213     /*48*/{20,50,28,47,-1,-1},
    214     /*49*/{-1,-1},
    215     /*50*/{-1,-1},
    216     /*51*/{-1,-1},
    217     /*52*/{21,55,25,53,26,56,27,54,-1,-1},
    218     /*53*/{-1,-1},
    219     /*54*/{-1,-1},
    220     /*55*/{22,60,29,59,-1,-1},
    221     /*56*/{-1,-1},
    222     /*57*/{-1,-1},
    223     /*58*/{-1,-1},
    224     /*59*/{27,62,31,63,-1,-1},
    225     /*60*/{-1,-1},
    226     /*61*/{30,65,-1,-1},
    227     /*62*/{-1,-1},
    228     /*63*/{-1,-1},
    229     /*64*/{-1,-1},
    230     /*65*/{-1,-1},
    231     /*66*/{21,55,26,68,27,54,-1,-1},
    232     /*67*/{-1,-1},
    233     /*68*/{-1,-1},
    234     /*69*/{-1,-1},
    235     /*70*/{-1,-1},
    236     /*71*/{10,73,17,74,-1,-1},
    237     /*72*/{38,82,-1,-1},
    238     /*73*/{-1,-1},
    239     /*74*/{19,76,24,77,-1,-1},
    240     /*75*/{-1,-1},
    241     /*76*/{36,79,-1,-1},
    242     /*77*/{-1,-1},
    243     /*78*/{24,81,-1,-1},
    244     /*79*/{-1,-1},
    245     /*80*/{-1,-1},
    246     /*81*/{-1,-1},
    247     /*82*/{-1,-1},
    248     /*83*/{-1,-1},
    249     /*84*/{37,93,-1,-1},
    250     /*85*/{18,88,23,87,-1,-1},
    251     /*86*/{-1,-1},
    252     /*87*/{-1,-1},
    253     /*88*/{35,89,-1,-1},
    254     /*89*/{-1,-1},
    255     /*90*/{23,91,-1,-1},
    256     /*91*/{-1,-1},
    257     /*92*/{-1,-1},
    258     /*93*/{-1,-1},
    259     /*94*/{-1,-1},
    260     /*95*/{-1,-1},
    261     /*96*/{-1,-1},
    262     /*97*/{-1,-1},
    263     /*98*/{10,99,-1,-1},
    264     /*99*/{-1,-1},
    265     /*100*/{-1,-1},
    266     /*101*/{-1,-1},
    267     /*102*/{-1,-1},
    268     /*103*/{-1,-1},
    269     /*104*/{-1,-1},
    270     /*105*/{-1,-1},
    271     /*106*/{-1,-1},
    272     /*107*/{-1,-1},
    273     /*108*/{-1,-1},
    274     /*109*/{-1,-1},
    275     /*110*/{-1,-1},
    276     /*111*/{34,112,-1,-1},
    277     /*112*/{-1,-1},
    278     /*113*/{-1,-1},
    279     /*114*/{-1,-1},
    280     /*115*/{-1,-1},
    281     /*116*/{8,117,15,39,27,38,-1,-1},
    282     /*117*/{9,118,20,49,28,47,-1,-1},
    283     /*118*/{20,50,28,47,-1,-1},
    284     /*119*/{-1,-1},
    285   };
    286 
    287   /** access to reduce_goto table */
    288   public short[][] reduce_table() {return _reduce_table;}
    289 
    290   /** instance of action encapsulation class */
    291   protected CUP$actions action_obj;
    292 
    293   /** action encapsulation object initializer */
    294   protected void init_actions()
    295     {
    296       action_obj = new CUP$actions();
    297     }
    298 
    299   /** invoke a user supplied parse action */
    300   public java_cup.runtime.symbol do_action(
    301     int                        act_num,
    302     java_cup.runtime.lr_parser parser,
    303     java.util.Stack            stack,
    304     int                        top)
    305     throws java.lang.Exception
    306   {
    307     /* call code in generated class */
    308     return action_obj.CUP$do_action(act_num, parser, stack, top);
    309   }
    310 
    311   /** start state */
    312   public int start_state() {return 0;}
    313   /** start production */
    314   public int start_production() {return 0;}
    315 
    316   /** EOF symbol index */
    317   public int EOF_sym() {return 0;}
    318 
    319   /** error symbol index */
    320   public int error_sym() {return 1;}
    321 
    322 
    323   /** user initialization */
    324   public void user_init() throws java.lang.Exception
    325     {
    326  lexer.init();
    327     }
    328 
    329   /** scan to get the next token */
    330   public java_cup.runtime.token scan()
    331     throws java.lang.Exception
    332     {
    333  return lexer.next_token();
    334     }
    335 
    336 
    337 
    338   /* override error routines */
    339 
    340   public void report_fatal_error(
    341     String   message,
    342     Object   info)
    343     {
    344       done_parsing();
    345       lexer.emit_error(message);
    346       System.err.println("Can't recover from previous error(s), giving up.");
    347       System.exit(1);
    348     }
    349 
    350     public void report_error(String message, Object info)
    351     {
    352       lexer.emit_error(message);
    353     }
    354 
    355 };
    356 
    357 /** JavaCup generated class to encapsulate user supplied action code.*/
    358 class CUP$actions {
    359 
    360 
    361   /** helper routine to clone a new production part adding a given label */
    362   protected production_part add_lab(production_part part, String lab)
    363     throws internal_error
    364     {
    365       /* if there is no label, or this is an action, just return the original */
    366       if (lab == null || part.is_action()) return part;
    367 
    368       /* otherwise build a new one with the given label attached */
    369       return new symbol_part(((symbol_part)part).the_symbol(),lab);
    370     }
    371 
    372   /** max size of right hand side we will support */
    373   protected final int MAX_RHS = 200;
    374 
    375   /** array for accumulating right hand side parts */
    376   protected production_part[] rhs_parts = new production_part[MAX_RHS];
    377 
    378   /** where we are currently in building a right hand side */
    379   protected int rhs_pos = 0;
    380 
    381   /** start a new right hand side */
    382   protected void new_rhs() {rhs_pos = 0; }
    383 
    384   /** add a new right hand side part */
    385   protected void add_rhs_part(production_part part) throws java.lang.Exception
    386     {
    387       if (rhs_pos >= MAX_RHS)
    388     throw new Exception("Internal Error: Productions limited to " +
    389                  MAX_RHS + " symbols and actions");
    390 
    391       rhs_parts[rhs_pos] = part;
    392       rhs_pos++;
    393     }
    394 
    395   /** string to build up multiple part names */
    396   protected String multipart_name = new String();
    397 
    398   /** append a new name segment to the accumulated multipart name */
    399   protected void append_multipart(String name)
    400     {
    401       String dot = "";
    402 
    403       /* if we aren't just starting out, put on a dot */
    404       if (multipart_name.length() != 0)  dot = ".";
    405 
    406       multipart_name = multipart_name.concat(dot + name);
    407     }
    408 
    409   /** table of declared symbols -- contains production parts indexed by name */
    410   protected Hashtable symbols = new Hashtable();
    411 
    412   /** table of just non terminals -- contains non_terminals indexed by name */
    413   protected Hashtable non_terms = new Hashtable();
    414 
    415   /** declared start non_terminal */
    416   protected non_terminal start_nt = null;
    417 
    418   /** left hand side non terminal of the current production */
    419   protected non_terminal lhs_nt;
    420 
    421 
    422 
    423   /** Constructor */
    424   CUP$actions() { }
    425 
    426   /** Method with the actual generated action code. */
    427   public final java_cup.runtime.symbol CUP$do_action(
    428     int                        CUP$act_num,
    429     java_cup.runtime.lr_parser CUP$parser,
    430     java.util.Stack            CUP$stack,
    431     int                        CUP$top)
    432     throws java.lang.Exception
    433     {
    434       /* object for return from actions */
    435       java_cup.runtime.symbol CUP$result;
    436 
    437       /* select the action based on the action number */
    438       switch (CUP$act_num)
    439         {
    440           /*. . . . . . . . . . . . . . . . . . . .*/
    441           case 64: // empty ::=
    442             {
    443               CUP$result = new java_cup.runtime.symbol(/*empty*/27);
    444 
    445             }
    446           return CUP$result;
    447 
    448           /*. . . . . . . . . . . . . . . . . . . .*/
    449           case 63: // label_id ::= ID
    450             {
    451               CUP$result = new java_cup.runtime.str_token(/*label_id*/30);
    452                ((java_cup.runtime.str_token)CUP$result).str_val = (/*the_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val;
    453             }
    454           return CUP$result;
    455 
    456           /*. . . . . . . . . . . . . . . . . . . .*/
    457           case 62: // symbol_id ::= ID
    458             {
    459               CUP$result = new java_cup.runtime.str_token(/*symbol_id*/29);
    460                ((java_cup.runtime.str_token)CUP$result).str_val = (/*the_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val;
    461             }
    462           return CUP$result;
    463 
    464           /*. . . . . . . . . . . . . . . . . . . .*/
    465           case 61: // nt_id ::= ID
    466             {
    467               CUP$result = new java_cup.runtime.str_token(/*nt_id*/28);
    468                ((java_cup.runtime.str_token)CUP$result).str_val = (/*the_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val;
    469             }
    470           return CUP$result;
    471 
    472           /*. . . . . . . . . . . . . . . . . . . .*/
    473           case 60: // new_non_term_id ::= ID
    474             {
    475               CUP$result = new java_cup.runtime.symbol(/*new_non_term_id*/24);
    476 
    477       /* see if this non terminal has been declared before */
    478       if (symbols.get((/*non_term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val) != null)
    479         {
    480           /* issue a message */
    481           lexer.emit_error( "Symbol \"" + (/*non_term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val +
    482                                   "\" has already been declared");
    483         }
    484       else
    485         {
    486           /* build the non terminal object */
    487               non_terminal this_nt =
    488         new non_terminal((/*non_term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val, multipart_name);
    489 
    490           /* put it in the non_terms table */
    491           non_terms.put((/*non_term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val, this_nt);
    492 
    493           /* build a production_part and put it in the symbols table */
    494           symbols.put((/*non_term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val, new symbol_part(this_nt));
    495         }
    496 
    497             }
    498           return CUP$result;
    499 
    500           /*. . . . . . . . . . . . . . . . . . . .*/
    501           case 59: // new_term_id ::= ID
    502             {
    503               CUP$result = new java_cup.runtime.symbol(/*new_term_id*/23);
    504 
    505       /* see if this terminal has been declared before */
    506       if (symbols.get((/*term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val) != null)
    507         {
    508           /* issue a message */
    509           lexer.emit_error("Symbol \"" + (/*term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val +
    510                "\" has already been declared");
    511         }
    512       else
    513         {
    514           /* build a production_part and put it in the table */
    515           symbols.put((/*term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val,
    516             new symbol_part(new terminal((/*term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val, multipart_name)));
    517         }
    518 
    519             }
    520           return CUP$result;
    521 
    522           /*. . . . . . . . . . . . . . . . . . . .*/
    523           case 58: // type_id ::= multipart_id
    524             {
    525               CUP$result = new java_cup.runtime.symbol(/*type_id*/17);
    526 
    527             }
    528           return CUP$result;
    529 
    530           /*. . . . . . . . . . . . . . . . . . . .*/
    531           case 57: // import_id ::= multipart_id
    532             {
    533               CUP$result = new java_cup.runtime.symbol(/*import_id*/12);
    534 
    535             }
    536           return CUP$result;
    537 
    538           /*. . . . . . . . . . . . . . . . . . . .*/
    539           case 56: // import_id ::= multipart_id DOT STAR
    540             {
    541               CUP$result = new java_cup.runtime.symbol(/*import_id*/12);
    542                append_multipart("*");
    543             }
    544           return CUP$result;
    545 
    546           /*. . . . . . . . . . . . . . . . . . . .*/
    547           case 55: // multipart_id ::= ID
    548             {
    549               CUP$result = new java_cup.runtime.symbol(/*multipart_id*/10);
    550                append_multipart((/*an_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val);
    551             }
    552           return CUP$result;
    553 
    554           /*. . . . . . . . . . . . . . . . . . . .*/
    555           case 54: // multipart_id ::= multipart_id DOT ID
    556             {
    557               CUP$result = new java_cup.runtime.symbol(/*multipart_id*/10);
    558                append_multipart((/*another_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val);
    559             }
    560           return CUP$result;
    561 
    562           /*. . . . . . . . . . . . . . . . . . . .*/
    563           case 53: // opt_label ::= empty
    564             {
    565               CUP$result = new java_cup.runtime.str_token(/*opt_label*/31);
    566                ((java_cup.runtime.str_token)CUP$result).str_val = null;
    567             }
    568           return CUP$result;
    569 
    570           /*. . . . . . . . . . . . . . . . . . . .*/
    571           case 52: // opt_label ::= COLON label_id
    572             {
    573               CUP$result = new java_cup.runtime.str_token(/*opt_label*/31);
    574                ((java_cup.runtime.str_token)CUP$result).str_val = (/*labid*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val;
    575             }
    576           return CUP$result;
    577 
    578           /*. . . . . . . . . . . . . . . . . . . .*/
    579           case 51: // prod_part ::= CODE_STRING
    580             {
    581               CUP$result = new java_cup.runtime.symbol(/*prod_part*/22);
    582 
    583       /* add a new production part */
    584       add_rhs_part(new action_part((/*code_str*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val));
    585 
    586             }
    587           return CUP$result;
    588 
    589           /*. . . . . . . . . . . . . . . . . . . .*/
    590           case 50: // prod_part ::= symbol_id opt_label
    591             {
    592               CUP$result = new java_cup.runtime.symbol(/*prod_part*/22);
    593 
    594       /* try to look up the id */
    595       production_part symb = (production_part)symbols.get((/*symid*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-1)).str_val);
    596 
    597       /* if that fails, symbol is undeclared */
    598       if (symb == null)
    599         {
    600           if (lexer.error_count == 0)
    601             lexer.emit_error("Symbol \"" + (/*symid*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-1)).str_val +
    602                    "\" has not been declared");
    603         }
    604       else
    605         {
    606           /* add a labeled production part */
    607           add_rhs_part(add_lab(symb, (/*labid*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val));
    608         }
    609 
    610             }
    611           return CUP$result;
    612 
    613           /*. . . . . . . . . . . . . . . . . . . .*/
    614           case 49: // prod_part_list ::= empty
    615             {
    616               CUP$result = new java_cup.runtime.symbol(/*prod_part_list*/21);
    617 
    618             }
    619           return CUP$result;
    620 
    621           /*. . . . . . . . . . . . . . . . . . . .*/
    622           case 48: // prod_part_list ::= prod_part_list prod_part
    623             {
    624               CUP$result = new java_cup.runtime.symbol(/*prod_part_list*/21);
    625 
    626             }
    627           return CUP$result;
    628 
    629           /*. . . . . . . . . . . . . . . . . . . .*/
    630           case 47: // rhs ::= prod_part_list
    631             {
    632               CUP$result = new java_cup.runtime.symbol(/*rhs*/26);
    633 
    634       if (lhs_nt != null)
    635         {
    636           /* build the production */
    637           production p = new production(lhs_nt, rhs_parts, rhs_pos);
    638 
    639           /* if we have no start non-terminal declared and this is
    640          the first production, make its lhs nt the start_nt
    641          and build a special start production for it. */
    642               if (start_nt == null)
    643         {
    644           start_nt = lhs_nt;
    645 
    646               /* build a special start production */
    647               new_rhs();
    648               add_rhs_part(new symbol_part(start_nt));
    649               add_rhs_part(new symbol_part(terminal.EOF));
    650               emit.start_production =
    651              new production(non_terminal.START_nt, rhs_parts, rhs_pos);
    652               new_rhs();
    653         }
    654         }
    655 
    656       /* reset the rhs accumulation in any case */
    657       new_rhs();
    658 
    659             }
    660           return CUP$result;
    661 
    662           /*. . . . . . . . . . . . . . . . . . . .*/
    663           case 46: // rhs_list ::= rhs
    664             {
    665               CUP$result = new java_cup.runtime.symbol(/*rhs_list*/25);
    666 
    667             }
    668           return CUP$result;
    669 
    670           /*. . . . . . . . . . . . . . . . . . . .*/
    671           case 45: // rhs_list ::= rhs_list BAR rhs
    672             {
    673               CUP$result = new java_cup.runtime.symbol(/*rhs_list*/25);
    674 
    675             }
    676           return CUP$result;
    677 
    678           /*. . . . . . . . . . . . . . . . . . . .*/
    679           case 44: // production ::= error NT$9 SEMI
    680             {
    681               CUP$result = new java_cup.runtime.symbol(/*production*/20);
    682 
    683             }
    684           return CUP$result;
    685 
    686           /*. . . . . . . . . . . . . . . . . . . .*/
    687           case 43: // NT$9 ::=
    688             {
    689               CUP$result = new java_cup.runtime.token(/*NT$9*/41);
    690                lexer.emit_error("Syntax Error");
    691             }
    692           return CUP$result;
    693 
    694           /*. . . . . . . . . . . . . . . . . . . .*/
    695           case 42: // production ::= nt_id NT$8 COLON_COLON_EQUALS rhs_list SEMI
    696             {
    697               CUP$result = new java_cup.runtime.symbol(/*production*/20);
    698 
    699             }
    700           return CUP$result;
    701 
    702           /*. . . . . . . . . . . . . . . . . . . .*/
    703           case 41: // NT$8 ::=
    704             {
    705               CUP$result = new java_cup.runtime.token(/*NT$8*/40);
    706 
    707       /* lookup the lhs nt */
    708       lhs_nt = (non_terminal)non_terms.get((/*lhs_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val);
    709 
    710           /* if it wasn't declared, emit a message */
    711       if (lhs_nt == null)
    712         {
    713           if (lexer.error_count == 0)
    714             lexer.emit_error("LHS non terminal \"" + (/*lhs_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val +
    715                    "\" has not been declared");
    716         }
    717 
    718       /* reset the rhs accumulation */
    719       new_rhs();
    720 
    721             }
    722           return CUP$result;
    723 
    724           /*. . . . . . . . . . . . . . . . . . . .*/
    725           case 40: // production_list ::= production
    726             {
    727               CUP$result = new java_cup.runtime.symbol(/*production_list*/9);
    728 
    729             }
    730           return CUP$result;
    731 
    732           /*. . . . . . . . . . . . . . . . . . . .*/
    733           case 39: // production_list ::= production_list production
    734             {
    735               CUP$result = new java_cup.runtime.symbol(/*production_list*/9);
    736 
    737             }
    738           return CUP$result;
    739 
    740           /*. . . . . . . . . . . . . . . . . . . .*/
    741           case 38: // start_spec ::= empty
    742             {
    743               CUP$result = new java_cup.runtime.symbol(/*start_spec*/8);
    744 
    745             }
    746           return CUP$result;
    747 
    748           /*. . . . . . . . . . . . . . . . . . . .*/
    749           case 37: // start_spec ::= START WITH nt_id NT$7 SEMI
    750             {
    751               CUP$result = new java_cup.runtime.symbol(/*start_spec*/8);
    752 
    753             }
    754           return CUP$result;
    755 
    756           /*. . . . . . . . . . . . . . . . . . . .*/
    757           case 36: // NT$7 ::=
    758             {
    759               CUP$result = new java_cup.runtime.token(/*NT$7*/39);
    760 
    761       /* verify that the name has been declared as a non terminal */
    762       non_terminal nt = (non_terminal)non_terms.get((/*start_name*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val);
    763       if (nt == null)
    764         {
    765           lexer.emit_error( "Start non terminal \"" + (/*start_name*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val +
    766                        "\" has not been declared");
    767         }
    768           else
    769         {
    770           /* remember the non-terminal for later */
    771           start_nt = nt;
    772 
    773           /* build a special start production */
    774           new_rhs();
    775           add_rhs_part(new symbol_part(start_nt));
    776           add_rhs_part(new symbol_part(terminal.EOF));
    777           emit.start_production =
    778              new production(non_terminal.START_nt, rhs_parts, rhs_pos);
    779           new_rhs();
    780         }
    781 
    782             }
    783           return CUP$result;
    784 
    785           /*. . . . . . . . . . . . . . . . . . . .*/
    786           case 35: // non_term_name_list ::= new_non_term_id
    787             {
    788               CUP$result = new java_cup.runtime.symbol(/*non_term_name_list*/19);
    789 
    790             }
    791           return CUP$result;
    792 
    793           /*. . . . . . . . . . . . . . . . . . . .*/
    794           case 34: // non_term_name_list ::= non_term_name_list COMMA new_non_term_id
    795             {
    796               CUP$result = new java_cup.runtime.symbol(/*non_term_name_list*/19);
    797 
    798             }
    799           return CUP$result;
    800 
    801           /*. . . . . . . . . . . . . . . . . . . .*/
    802           case 33: // term_name_list ::= new_term_id
    803             {
    804               CUP$result = new java_cup.runtime.symbol(/*term_name_list*/18);
    805 
    806             }
    807           return CUP$result;
    808 
    809           /*. . . . . . . . . . . . . . . . . . . .*/
    810           case 32: // term_name_list ::= term_name_list COMMA new_term_id
    811             {
    812               CUP$result = new java_cup.runtime.symbol(/*term_name_list*/18);
    813 
    814             }
    815           return CUP$result;
    816 
    817           /*. . . . . . . . . . . . . . . . . . . .*/
    818           case 31: // symbol ::= NON TERMINAL error NT$6 SEMI
    819             {
    820               CUP$result = new java_cup.runtime.symbol(/*symbol*/15);
    821 
    822             }
    823           return CUP$result;
    824 
    825           /*. . . . . . . . . . . . . . . . . . . .*/
    826           case 30: // NT$6 ::=
    827             {
    828               CUP$result = new java_cup.runtime.token(/*NT$6*/38);
    829 
    830       /* reset the accumulated multipart name */
    831       multipart_name = new String();
    832 
    833             }
    834           return CUP$result;
    835 
    836           /*. . . . . . . . . . . . . . . . . . . .*/
    837           case 29: // symbol ::= TERMINAL error NT$5 SEMI
    838             {
    839               CUP$result = new java_cup.runtime.symbol(/*symbol*/15);
    840 
    841             }
    842           return CUP$result;
    843 
    844           /*. . . . . . . . . . . . . . . . . . . .*/
    845           case 28: // NT$5 ::=
    846             {
    847               CUP$result = new java_cup.runtime.token(/*NT$5*/37);
    848 
    849       /* reset the accumulated multipart name */
    850       multipart_name = new String();
    851 
    852             }
    853           return CUP$result;
    854 
    855           /*. . . . . . . . . . . . . . . . . . . .*/
    856           case 27: // symbol ::= NON TERMINAL type_id non_term_name_list NT$4 SEMI
    857             {
    858               CUP$result = new java_cup.runtime.symbol(/*symbol*/15);
    859 
    860             }
    861           return CUP$result;
    862 
    863           /*. . . . . . . . . . . . . . . . . . . .*/
    864           case 26: // NT$4 ::=
    865             {
    866               CUP$result = new java_cup.runtime.token(/*NT$4*/36);
    867 
    868       /* reset the accumulated multipart name */
    869       multipart_name = new String();
    870 
    871             }
    872           return CUP$result;
    873 
    874           /*. . . . . . . . . . . . . . . . . . . .*/
    875           case 25: // symbol ::= TERMINAL type_id term_name_list NT$3 SEMI
    876             {
    877               CUP$result = new java_cup.runtime.symbol(/*symbol*/15);
    878 
    879             }
    880           return CUP$result;
    881 
    882           /*. . . . . . . . . . . . . . . . . . . .*/
    883           case 24: // NT$3 ::=
    884             {
    885               CUP$result = new java_cup.runtime.token(/*NT$3*/35);
    886 
    887       /* reset the accumulated multipart name */
    888       multipart_name = new String();
    889 
    890             }
    891           return CUP$result;
    892 
    893           /*. . . . . . . . . . . . . . . . . . . .*/
    894           case 23: // symbol_list ::= symbol
    895             {
    896               CUP$result = new java_cup.runtime.symbol(/*symbol_list*/7);
    897 
    898             }
    899           return CUP$result;
    900 
    901           /*. . . . . . . . . . . . . . . . . . . .*/
    902           case 22: // symbol_list ::= symbol_list symbol
    903             {
    904               CUP$result = new java_cup.runtime.symbol(/*symbol_list*/7);
    905 
    906             }
    907           return CUP$result;
    908 
    909           /*. . . . . . . . . . . . . . . . . . . .*/
    910           case 21: // debug_grammar ::= empty
    911             {
    912               CUP$result = new java_cup.runtime.symbol(/*debug_grammar*/16);
    913 
    914             }
    915           return CUP$result;
    916 
    917           /*. . . . . . . . . . . . . . . . . . . .*/
    918           case 20: // debug_grammar ::= DEBUG WITH multipart_id SEMI
    919             {
    920               CUP$result = new java_cup.runtime.symbol(/*debug_grammar*/16);
    921 
    922       /* save the procedure name */
    923           emit.debug_grammar = multipart_name;
    924           /* reset the accumulated multipart name */
    925           multipart_name = new String();
    926 
    927             }
    928           return CUP$result;
    929 
    930           /*. . . . . . . . . . . . . . . . . . . .*/
    931           case 19: // scan_code ::= empty
    932             {
    933               CUP$result = new java_cup.runtime.symbol(/*scan_code*/14);
    934 
    935             }
    936           return CUP$result;
    937 
    938           /*. . . . . . . . . . . . . . . . . . . .*/
    939           case 18: // scan_code ::= SCAN WITH CODE_STRING SEMI
    940             {
    941               CUP$result = new java_cup.runtime.symbol(/*scan_code*/14);
    942 
    943       /* save the user code */
    944       emit.scan_code = (/*user_code*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-1)).str_val;
    945 
    946             }
    947           return CUP$result;
    948 
    949           /*. . . . . . . . . . . . . . . . . . . .*/
    950           case 17: // init_code ::= empty
    951             {
    952               CUP$result = new java_cup.runtime.symbol(/*init_code*/13);
    953 
    954             }
    955           return CUP$result;
    956 
    957           /*. . . . . . . . . . . . . . . . . . . .*/
    958           case 16: // init_code ::= INIT WITH CODE_STRING SEMI
    959             {
    960               CUP$result = new java_cup.runtime.symbol(/*init_code*/13);
    961 
    962       /* save the user code */
    963       emit.init_code = (/*user_code*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-1)).str_val;
    964 
    965             }
    966           return CUP$result;
    967 
    968           /*. . . . . . . . . . . . . . . . . . . .*/
    969           case 15: // parser_code_part ::= empty
    970             {
    971               CUP$result = new java_cup.runtime.symbol(/*parser_code_part*/6);
    972 
    973             }
    974           return CUP$result;
    975 
    976           /*. . . . . . . . . . . . . . . . . . . .*/
    977           case 14: // parser_code_part ::= PARSER CODE CODE_STRING SEMI
    978             {
    979               CUP$result = new java_cup.runtime.symbol(/*parser_code_part*/6);
    980 
    981       /* save the user included code string */
    982       emit.parser_code = (/*user_code*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-1)).str_val;
    983 
    984             }
    985           return CUP$result;
    986 
    987           /*. . . . . . . . . . . . . . . . . . . .*/
    988           case 13: // action_code_part ::= empty
    989             {
    990               CUP$result = new java_cup.runtime.symbol(/*action_code_part*/5);
    991 
    992             }
    993           return CUP$result;
    994 
    995           /*. . . . . . . . . . . . . . . . . . . .*/
    996           case 12: // action_code_part ::= ACTION CODE CODE_STRING SEMI
    997             {
    998               CUP$result = new java_cup.runtime.symbol(/*action_code_part*/5);
    999 
   1000       /* save the user included code string */
   1001       emit.action_code = (/*user_code*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-1)).str_val;
   1002 
   1003             }
   1004           return CUP$result;
   1005 
   1006           /*. . . . . . . . . . . . . . . . . . . .*/
   1007           case 11: // code_part ::= action_code_part parser_code_part
   1008             {
   1009               CUP$result = new java_cup.runtime.symbol(/*code_part*/4);
   1010 
   1011             }
   1012           return CUP$result;
   1013 
   1014           /*. . . . . . . . . . . . . . . . . . . .*/
   1015           case 10: // import_spec ::= IMPORT import_id NT$2 SEMI
   1016             {
   1017               CUP$result = new java_cup.runtime.symbol(/*import_spec*/11);
   1018 
   1019             }
   1020           return CUP$result;
   1021 
   1022           /*. . . . . . . . . . . . . . . . . . . .*/
   1023           case 9: // NT$2 ::=
   1024             {
   1025               CUP$result = new java_cup.runtime.token(/*NT$2*/34);
   1026 
   1027       /* save this import on the imports list */
   1028       emit.import_list.push(multipart_name);
   1029 
   1030       /* reset the accumulated multipart name */
   1031       multipart_name = new String();
   1032 
   1033             }
   1034           return CUP$result;
   1035 
   1036           /*. . . . . . . . . . . . . . . . . . . .*/
   1037           case 8: // import_list ::= empty
   1038             {
   1039               CUP$result = new java_cup.runtime.symbol(/*import_list*/3);
   1040 
   1041             }
   1042           return CUP$result;
   1043 
   1044           /*. . . . . . . . . . . . . . . . . . . .*/
   1045           case 7: // import_list ::= import_list import_spec
   1046             {
   1047               CUP$result = new java_cup.runtime.symbol(/*import_list*/3);
   1048 
   1049             }
   1050           return CUP$result;
   1051 
   1052           /*. . . . . . . . . . . . . . . . . . . .*/
   1053           case 6: // package_spec ::= empty
   1054             {
   1055               CUP$result = new java_cup.runtime.symbol(/*package_spec*/2);
   1056 
   1057             }
   1058           return CUP$result;
   1059 
   1060           /*. . . . . . . . . . . . . . . . . . . .*/
   1061           case 5: // package_spec ::= PACKAGE multipart_id NT$1 SEMI
   1062             {
   1063               CUP$result = new java_cup.runtime.symbol(/*package_spec*/2);
   1064 
   1065             }
   1066           return CUP$result;
   1067 
   1068           /*. . . . . . . . . . . . . . . . . . . .*/
   1069           case 4: // NT$1 ::=
   1070             {
   1071               CUP$result = new java_cup.runtime.token(/*NT$1*/33);
   1072 
   1073       /* save the package name */
   1074       emit.package_name = multipart_name;
   1075 
   1076       /* reset the accumulated multipart name */
   1077       multipart_name = new String();
   1078 
   1079             }
   1080           return CUP$result;
   1081 
   1082           /*. . . . . . . . . . . . . . . . . . . .*/
   1083           case 3: // spec ::= error symbol_list start_spec production_list
   1084             {
   1085               CUP$result = new java_cup.runtime.symbol(/*spec*/1);
   1086 
   1087             }
   1088           return CUP$result;
   1089 
   1090           /*. . . . . . . . . . . . . . . . . . . .*/
   1091           case 2: // spec ::= NT$0 package_spec import_list code_part debug_grammar init_code scan_code symbol_list start_spec production_list
   1092             {
   1093               CUP$result = new java_cup.runtime.symbol(/*spec*/1);
   1094 
   1095             }
   1096           return CUP$result;
   1097 
   1098           /*. . . . . . . . . . . . . . . . . . . .*/
   1099           case 1: // NT$0 ::=
   1100             {
   1101               CUP$result = new java_cup.runtime.token(/*NT$0*/32);
   1102 
   1103           /* declare "error" as a terminal */
   1104           symbols.put("error", new symbol_part(terminal.error));
   1105 
   1106           /* declare start non terminal */
   1107           non_terms.put("$START", non_terminal.START_nt);
   1108 
   1109             }
   1110           return CUP$result;
   1111 
   1112           /*. . . . . . . . . . . . . . . . . . . .*/
   1113           case 0: // $START ::= spec EOF
   1114             {
   1115               CUP$result = new java_cup.runtime.token(/*$START*/0);
   1116 
   1117             }
   1118           /* ACCEPT */
   1119           CUP$parser.done_parsing();
   1120           return CUP$result;
   1121 
   1122           /* . . . . . .*/
   1123           default:
   1124             throw new Exception(
   1125                "Invalid action number found in internal parse table");
   1126 
   1127         }
   1128     }
   1129 };
   1130 
   1131