/** Full constructor. * @param nm the name of the non terminal. * @param tp the type string for the non terminal. */ public non_terminal(String nm, String tp) { /* super class does most of the work */ super(nm, tp); /* add to set of all non terminals and check for duplicates */ Object conflict = _all.put(nm,this); if (conflict != null) // can't throw an exception here because these are used in static // initializers, so we crash instead // was: // throw new internal_error("Duplicate non-terminal ("+nm+") created"); (new internal_error("Duplicate non-terminal ("+nm+") created")).crash(); /* assign a unique index */ _index = next_index++; }
/** Method called to do a forced error exit on an internal error for cases when we can't actually throw the exception. */ public void crash() { System.err.println("JavaCUP Fatal Internal Error Detected"); System.err.println(getMessage()); printStackTrace(); System.exit(-1); } }
/** Helper function to test for a null object and throw an exception if * one is found. * @param obj the object we are testing. */ protected void not_null(Object obj) throws internal_error { if (obj == null) throw new internal_error("Null object used in set operation"); }
/** Convert to a string */ public String toString() { /* can't throw here since super class doesn't, so we crash instead */ try { return to_simple_string(); } catch(internal_error e) { e.crash(); return null; } }
/** Simple constructor. * @param prod the production this action reduces with. */ public reduce_action(production prod ) throws internal_error { /* sanity check */ if (prod == null) throw new internal_error( "Attempt to create a reduce_action with a null production"); _reduce_with = prod; }
/** Convert to a string */ public String toString() { /* can't throw here since super class doesn't, so we crash instead */ try { return to_simple_string(); } catch(internal_error e) { e.crash(); return null; } }
/** Full constructor. * @param nm the name of the non terminal. * @param tp the type string for the non terminal. */ public non_terminal(String nm, String tp) { /* super class does most of the work */ super(nm, tp); /* add to set of all non terminals and check for duplicates */ Object conflict = _all.put(nm,this); if (conflict != null) // can't throw an exception here because these are used in static // initializers, so we crash instead // was: // throw new internal_error("Duplicate non-terminal ("+nm+") created"); (new internal_error("Duplicate non-terminal ("+nm+") created")).crash(); /* assign a unique index */ _index = next_index++; /* add to by_index set */ _all_by_index.put(new Integer(_index), this); }
/** Helper function for null test. Throws an interal_error exception if its * parameter is null. * @param obj the object we are testing. */ protected void not_null(Object obj) throws internal_error { if (obj == null) throw new internal_error("Null object used in set operation"); }
/** Convert to a string */ public String toString() { /* can't throw here since super class doesn't, so we crash instead */ try { return to_simple_string(); } catch(internal_error e) { e.crash(); return null; } }
/** Method called to do a forced error exit on an internal error for cases when we can't actually throw the exception. */ public void crash() { System.err.println("JavaCUP Fatal Internal Error Detected"); System.err.println(getMessage()); printStackTrace(); System.exit(-1); } }
/** Full constructor. * @param nm the name of the non terminal. * @param tp the type string for the non terminal. */ public non_terminal(String nm, String tp) { /* super class does most of the work */ super(nm, tp); /* add to set of all non terminals and check for duplicates */ Object conflict = _all.put(nm,this); if (conflict != null) // can't throw an exception here because these are used in static // initializers, so we crash instead // was: // throw new internal_error("Duplicate non-terminal ("+nm+") created"); (new internal_error("Duplicate non-terminal ("+nm+") created")).crash(); /* assign a unique index */ _index = next_index++; /* add to by_index set */ _all_by_index.put(new Integer(_index), this); }
/** Helper function for null test. Throws an interal_error exception if its * parameter is null. * @param obj the object we are testing. */ protected void not_null(Object obj) throws internal_error { if (obj == null) throw new internal_error("Null object used in set operation"); }
/** Convert to a string */ public String toString() { /* can't throw here since super class doesn't, so we crash instead */ try { return to_simple_string(); } catch(internal_error e) { e.crash(); return null; } }
/** Method called to do a forced error exit on an internal error for cases when we can't actually throw the exception. */ public void crash() { System.err.println("JavaCUP Fatal Internal Error Detected"); System.err.println(getMessage()); printStackTrace(); System.exit(-1); } };
/** Full constructor. * @param nm the name of the non terminal. * @param tp the type string for the non terminal. */ public non_terminal(String nm, String tp) { /* super class does most of the work */ super(nm, tp); /* add to set of all non terminals and check for duplicates */ Object conflict = _all.put(nm,this); if (conflict != null) // can't throw an exception here because these are used in static // initializers, so we crash instead // was: // throw new internal_error("Duplicate non-terminal ("+nm+") created"); (new internal_error("Duplicate non-terminal ("+nm+") created")).crash(); /* assign a unique index */ _index = next_index++; /* add to by_index set */ _all_by_index.put(new Integer(_index), this); }
/** Full constructor. * @param sym the symbol that this part is made up of. * @param lab an optional label string for the part. */ public symbol_part(symbol sym, String lab) throws internal_error { super(lab); if (sym == null) throw new internal_error( "Attempt to construct a symbol_part with a null symbol"); _the_symbol = sym; }
/** Convert to a string */ public String toString() { /* can't throw here since super class doesn't, so we crash instead */ try { return to_simple_string(); } catch(internal_error e) { e.crash(); return null; } }
/** Method called to do a forced error exit on an internal error for cases when we can't actually throw the exception. */ public void crash() { System.err.println("JavaCUP Fatal Internal Error Detected"); System.err.println(getMessage()); printStackTrace(); System.exit(-1); } }
/** Full constructor. * @param nm the name of the terminal. * @param tp the type of the terminal. */ public terminal(String nm, String tp) { /* superclass does most of the work */ super(nm, tp); /* add to set of all terminals and check for duplicates */ Object conflict = _all.put(nm,this); if (conflict != null) // can't throw an execption here because this is used in static // initializers, so we do a crash instead // was: // throw new internal_error("Duplicate terminal (" + nm + ") created"); (new internal_error("Duplicate terminal (" + nm + ") created")).crash(); /* assign a unique index */ _index = next_index++; /* add to by_index set */ _all_by_index.put(new Integer(_index), this); }
/** Full constructor. * @param sym the symbol that this part is made up of. * @param lab an optional label string for the part. */ public symbol_part(symbol sym, String lab) throws internal_error { super(lab); if (sym == null) throw new internal_error( "Attempt to construct a symbol_part with a null symbol"); _the_symbol = sym; }