/** helper routine to clone a new production part adding a given label */ protected production_part add_lab(production_part part, String lab) throws internal_error { /* if there is no label, or this is an action, just return the original */ if (lab == null || part.is_action()) return part; /* otherwise build a new one with the given label attached */ return new symbol_part(((symbol_part)part).the_symbol(),lab); }
/** helper routine to clone a new production part adding a given label */ protected production_part add_lab(production_part part, String lab) throws internal_error { /* if there is no label, or this is an action, just return the original */ if (lab == null || part.is_action()) return part; /* otherwise build a new one with the given label attached */ return new symbol_part(((symbol_part)part).the_symbol(),lab); }
/** helper routine to clone a new production part adding a given label */ protected production_part add_lab(production_part part, String lab) throws internal_error { /* if there is no label, or this is an action, just return the original */ if (lab == null || part.is_action()) return part; /* otherwise build a new one with the given label attached */ return new symbol_part(((symbol_part)part).the_symbol(),lab); }
/** helper routine to clone a new production part adding a given label */ protected production_part add_lab(production_part part, String lab) throws internal_error { /* if there is no label, or this is an action, just return the original */ if (lab == null || part.is_action()) return part; /* otherwise build a new one with the given label attached */ return new symbol_part(((symbol_part)part).the_symbol(),lab); }
/** helper routine to clone a new production part adding a given label */ protected production_part add_lab(production_part part, String lab) throws internal_error { /* if there is no label, or this is an action, just return the original */ if (lab == null || part.is_action()) return part; /* otherwise build a new one with the given label attached */ return new symbol_part(((symbol_part)part).the_symbol(),lab); }
symbols.put(non_term_id, new symbol_part(this_nt)); new symbol_part(new terminal(term_id, multipart_name))); add_rhs_part(add_lab(new symbol_part(start_nt),"start_val")); add_rhs_part(new symbol_part(terminal.EOF)); add_rhs_part(new action_part("RESULT = start_val;")); emit.start_production = add_rhs_part(add_lab(new symbol_part(start_nt),"start_val")); add_rhs_part(new symbol_part(terminal.EOF)); add_rhs_part(new action_part("RESULT = start_val;")); if ((sym!=null) && (sym instanceof terminal)) { add_rhs_part(add_lab(new symbol_part(start_nt), "start_val")); add_rhs_part(new symbol_part(terminal.EOF)); add_rhs_part(new action_part("RESULT = start_val;")); emit.start_production = symbols.put("error", new symbol_part(terminal.error));
/** Remove all embedded actions from a production by factoring them * out into individual action production using new non terminals. * if the original production was: <pre> * A ::= B {action1} C {action2} D * </pre> * then it will be factored into: <pre> * A ::= B NT$1 C NT$2 D * NT$1 ::= {action1} * NT$2 ::= {action2} * </pre> * where NT$1 and NT$2 are new system created non terminals. */ protected void remove_embedded_actions() throws internal_error { non_terminal new_nt; production new_prod; /* walk over the production and process each action */ for (int act_loc = 0; act_loc < rhs_length(); act_loc++) if (rhs(act_loc).is_action()) { /* create a new non terminal for the action production */ new_nt = non_terminal.create_new(); /* create a new production with just the action */ new_prod = new action_production(this, new_nt, null, 0, ((action_part)rhs(act_loc)).code_string()); /* replace the action with the generated non terminal */ _rhs[act_loc] = new symbol_part(new_nt); } }
symbols.put((/*non_term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val, new symbol_part(this_nt)); new symbol_part(new terminal((/*term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val, multipart_name))); add_rhs_part(new symbol_part(start_nt)); add_rhs_part(new symbol_part(terminal.EOF)); emit.start_production = new production(non_terminal.START_nt, rhs_parts, rhs_pos); add_rhs_part(new symbol_part(start_nt)); add_rhs_part(new symbol_part(terminal.EOF)); emit.start_production = new production(non_terminal.START_nt, rhs_parts, rhs_pos); symbols.put("error", new symbol_part(terminal.error));
_rhs[act_loc] = new symbol_part(new_nt);
_rhs[act_loc] = new symbol_part(new_nt);
_rhs[act_loc] = new symbol_part(new_nt);
_rhs[act_loc] = new symbol_part(new_nt);
_lhs = new symbol_part(lhs_sym);
_rhs[act_loc] = new symbol_part(new_nt); lastLocation = act_loc;
_lhs = new symbol_part(lhs_sym);
_lhs = new symbol_part(lhs_sym);
_lhs = new symbol_part(lhs_sym);
_lhs = new symbol_part(lhs_sym);
_lhs = new symbol_part(lhs_sym);
_lhs = new symbol_part(lhs_sym);