/** Add a single terminal to the set. * @param sym the terminal being added. * @return true if this changes the set. */ public boolean add(terminal sym) throws internal_error { boolean result; not_null(sym); /* see if we already have this */ result = _elements.get(sym.index()); /* if not we add it */ if (!result) _elements.set(sym.index()); return result; }
/** Determine if we have a dot before a non terminal, and if so which one * (return null or the non terminal). */ public non_terminal dot_before_nt() { symbol sym; /* get the symbol after the dot */ sym = symbol_after_dot(); /* if it exists and is a non terminal, return it */ if (sym != null && sym.is_non_term()) return (non_terminal)sym; else return null; }
/** Convert to a string. */ public String toString() { return name(); }
prod.lhs().the_symbol().stack_type() + "(/*" + prod.lhs().the_symbol().name() + "*/" + prod.lhs().the_symbol().index() + ");");
if (!shift_sym.is_non_term() && shift_sym.index() == conflict_sym)
if (!shift_sym.is_non_term() && shift_sym.index() == conflict_sym) System.err.println(" under symbol "+ terminal.find(conflict_sym).name()); System.err.println(" Resolved in favor of shifting.\n");
/** Convert to a string. */ public String toString() { return super.toString() + "[" + index() + "]"; }
((terminal)sym).precedence_num(), ((terminal)sym).precedence_side()); ((symbol_part)symbols.get(term_name)).the_symbol().note_use(); } else { System.err.println("Invalid terminal " + term_name +
int lastResult = ((action_production)prod).getIndexOfIntermediateResult(); if (lastResult!=-1) { result = "(" + prod.lhs().the_symbol().stack_type() + ") " + "((java_cup.runtime.Symbol) " + emit.pre("stack") +
out.println(" " + prod.lhs().the_symbol().stack_type() + " RESULT = null;"); s.name()); out.println(" " + "if ( " + "((java_cup.runtime.Symbol) " + emit.pre("stack") + ".elementAt(" + emit.pre("top") + "-" + index + ")).value != null )"); out.println(" " + "RESULT = " + "(" + prod.lhs().the_symbol().stack_type() + ") " + "((java_cup.runtime.Symbol) " + emit.pre("stack") + ".elementAt(" + emit.pre("top") + "-" + index + ")).value;"); prod.lhs().the_symbol().index() + "/*" + prod.lhs().the_symbol().name() + "*/" + ", " + leftstring + ", " + rightstring + ", RESULT);"); } else { out.println(" " + pre("result") + " = new java_cup.runtime.Symbol(" + prod.lhs().the_symbol().index() + "/*" + prod.lhs().the_symbol().name() + "*/" + ", RESULT);");
if (!shift_sym.is_non_term() && shift_sym.index() == conflict_sym)
/** Convert to a string. */ public String toString() { return super.toString() + "[" + index() + "]"; }
((terminal)sym).precedence_num(), ((terminal)sym).precedence_side()); ((symbol_part)symbols.get(term_name)).the_symbol().note_use(); } else { System.err.println("Invalid terminal " + term_name +
label_types.put(part.label(), part.the_symbol().stack_type());
out.println(" " + prod.lhs().the_symbol().stack_type() + " RESULT = null;"); s.name()); out.println(" " + "if ( " + "((java_cup.runtime.Symbol) " + emit.pre("stack") + ".elementAt(" + emit.pre("top") + "-" + index + ")).value != null )"); out.println(" " + "RESULT = " + "(" + prod.lhs().the_symbol().stack_type() + ") " + "((java_cup.runtime.Symbol) " + emit.pre("stack") + ".elementAt(" + emit.pre("top") + "-" + index + ")).value;"); prod.lhs().the_symbol().index() + "/*" + prod.lhs().the_symbol().name() + "*/" + ", " + leftstring + ", " + rightstring + ", RESULT);"); } else { out.println(" " + pre("result") + " = new java_cup.runtime.Symbol(" + prod.lhs().the_symbol().index() + "/*" + prod.lhs().the_symbol().name() + "*/" + ", RESULT);");
if (!shift_sym.is_non_term() && shift_sym.index() == conflict_sym)
/** Convert to a string. */ public String toString() { return name(); }