/** Convert to string. */ public String toString() { String result; boolean comma_flag; result = "{"; comma_flag = false; for (int t = 0; t < terminal.number(); t++) { if (_elements.get(t)) { if (comma_flag) result += ", "; else comma_flag = true; result += terminal.find(t).name(); } } result += "}"; return result; }
/** 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; }
/** Convert to string. */ public String toString() { String result; boolean comma_flag; result = "{"; comma_flag = false; for (int t = 0; t < terminal.number(); t++) { if (_elements.get(t)) { if (comma_flag) result += ", "; else comma_flag = true; result += terminal.find(t).name(); } } result += "}"; return result; }
terminal term = terminal.find(term_index); if (p.precedence_num() > term.precedence_num()) { table_row.under_term[term_index] = insert_reduce(table_row.under_term[term_index],act); else if (p.precedence_num() < term.precedence_num()) { table_row.under_term[term_index] = insert_shift(table_row.under_term[term_index],act); if (term.precedence_side() == assoc.right) { table_row.under_term[term_index] = insert_shift(table_row.under_term[term_index],act); else if (term.precedence_side() == assoc.left) { table_row.under_term[term_index] = insert_reduce(table_row.under_term[term_index],act); else if (term.precedence_side() == assoc.nonassoc) { table_row.under_term[term_index] = new nonassoc_action(); return true; else if (term.precedence_num() > assoc.no_prec) { table_row.under_term[term_index] = insert_shift(table_row.under_term[term_index],act);
new symbol_part(new terminal(term_id, multipart_name))); if ((sym!=null) && (sym instanceof terminal)) { p = new production(lhs_nt, rhs_parts, rhs_pos, ((terminal)sym).precedence_num(), ((terminal)sym).precedence_side()); ((symbol_part)symbols.get(term_name)).the_symbol().note_use(); } else { emit.start_production = new production(non_terminal.START_nt, rhs_parts, rhs_pos, ((terminal)sym).precedence_num(), ((terminal)sym).precedence_side()); } else { emit.start_production =
if (((symbol_part)_rhs[i]).the_symbol() instanceof terminal) { _rhs_prec = ((terminal)((symbol_part)_rhs[i]).the_symbol()).precedence_num(); _rhs_assoc = ((terminal)((symbol_part)_rhs[i]).the_symbol()).precedence_side();
/** Constructor for an empty set. */ public terminal_set() { /* allocate the bitset at what is probably the right size */ _elements = new BitSet(terminal.number()); }
for (Enumeration e = terminal.all(); e.hasMoreElements(); )
/** add relevant data to terminals */ protected void add_precedence(String term) { if (term == null) { System.err.println("Unable to add precedence to nonexistent terminal"); } else { symbol_part sp = (symbol_part)symbols.get(term); if (sp == null) { System.err.println("Could find terminal " + term + " while declaring precedence"); } else { java_cup.symbol sym = sp.the_symbol(); if (sym instanceof terminal) ((terminal)sym).set_precedence(_cur_side, _cur_prec); else System.err.println("Precedence declaration: Can't find terminal " + term); } } }
terminal term = terminal.find(term_index); if (p.precedence_num() > term.precedence_num()) { table_row.under_term[term_index] = insert_reduce(table_row.under_term[term_index],act); else if (p.precedence_num() < term.precedence_num()) { table_row.under_term[term_index] = insert_shift(table_row.under_term[term_index],act); if (term.precedence_side() == assoc.right) { table_row.under_term[term_index] = insert_shift(table_row.under_term[term_index],act); else if (term.precedence_side() == assoc.left) { table_row.under_term[term_index] = insert_reduce(table_row.under_term[term_index],act); else if (term.precedence_side() == assoc.nonassoc) { table_row.under_term[term_index] = new nonassoc_action(); return true; else if (term.precedence_num() > assoc.no_prec) { table_row.under_term[term_index] = insert_shift(table_row.under_term[term_index],act);
new symbol_part(new terminal(term_id, multipart_name))); if ((sym!=null) && (sym instanceof terminal)) { p = new production(lhs_nt, rhs_parts, rhs_pos, ((terminal)sym).precedence_num(), ((terminal)sym).precedence_side()); ((symbol_part)symbols.get(term_name)).the_symbol().note_use(); } else { emit.start_production = new production(non_terminal.START_nt, rhs_parts, rhs_pos, ((terminal)sym).precedence_num(), ((terminal)sym).precedence_side()); } else { emit.start_production =
if (((symbol_part)_rhs[i]).the_symbol() instanceof terminal) { _rhs_prec = ((terminal)((symbol_part)_rhs[i]).the_symbol()).precedence_num(); _rhs_assoc = ((terminal)((symbol_part)_rhs[i]).the_symbol()).precedence_side();
/** Constructor for an empty set. */ public terminal_set() { /* allocate the bitset at what is probably the right size */ _elements = new BitSet(terminal.number()); }