/** Report a non fatal error (or warning). This method takes a message * string and an additional object (to be used by specializations * implemented in subclasses). Here in the base class a very simple * implementation is provided which simply prints the message to * System.err. * * @param message an error message. * @param info an extra object reserved for use by specialized subclasses. */ public void report_error(String message, Object info) { if (info instanceof ComplexSymbol){ ComplexSymbol cs = (ComplexSymbol)info; System.err.println(message+" for input symbol \""+cs.getName()+"\" spanning from "+cs.getLeft() +" to "+cs.getRight()); return; } System.err.print(message); System.err.flush(); if (info instanceof Symbol) if (((Symbol)info).left != -1) System.err.println(" at character " + ((Symbol)info).left + " of input"); else System.err.println(""); }
/** Report a non fatal error (or warning). This method takes a message * string and an additional object (to be used by specializations * implemented in subclasses). Here in the base class a very simple * implementation is provided which simply prints the message to * System.err. * * @param message an error message. * @param info an extra object reserved for use by specialized subclasses. */ public void report_error(String message, Object info) { if (info instanceof ComplexSymbol){ ComplexSymbol cs = (ComplexSymbol)info; System.err.println(message+" for input symbol \""+cs.getName()+"\" spanning from "+cs.getLeft() +" to "+cs.getRight()); return; } System.err.print(message); System.err.flush(); if (info instanceof Symbol) if (((Symbol)info).left != -1) System.err.println(" at character " + ((Symbol)info).left + " of input"); else System.err.println(""); }
/** Report a non fatal error (or warning). This method takes a message * string and an additional object (to be used by specializations * implemented in subclasses). Here in the base class a very simple * implementation is provided which simply prints the message to * System.err. * * @param message an error message. * @param info an extra object reserved for use by specialized subclasses. */ public void report_error(String message, Object info) { if (info instanceof ComplexSymbol){ ComplexSymbol cs = (ComplexSymbol)info; System.err.println(message+" for input symbol \""+cs.getName()+"\" spanning from "+cs.getLeft() +" to "+cs.getRight()); return; } System.err.print(message); System.err.flush(); if (info instanceof Symbol) if (((Symbol)info).left != -1) System.err.println(" at character " + ((Symbol)info).left + " of input"); else System.err.println(""); }
writer.writeStartElement("token"); writer.writeAttribute("name",cs.getName()); cs.getLeft().toXML(writer, "left"); writer.writeCharacters(cs.value+""); cs.getRight().toXML(writer, "right"); writer.writeAttribute("left",cs.getLeft()+""); writer.writeAttribute("right",cs.getRight()+""); writer.writeCharacters(cs.getName()+"");
writer.writeStartElement("token"); writer.writeAttribute("name",cs.getName()); cs.getLeft().toXML(writer, "left"); writer.writeCharacters(cs.value+""); cs.getRight().toXML(writer, "right"); writer.writeAttribute("left",cs.getLeft()+""); writer.writeAttribute("right",cs.getRight()+""); writer.writeCharacters(cs.getName()+"");
writer.writeStartElement("token"); writer.writeAttribute("name",cs.getName()); cs.getLeft().toXML(writer, "left"); writer.writeCharacters(cs.value+""); cs.getRight().toXML(writer, "right"); writer.writeAttribute("left",cs.getLeft()+""); writer.writeAttribute("right",cs.getRight()+""); writer.writeCharacters(cs.getName()+"");