public void endRule() { try { out.writeByte('.'); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } }
public void endAlt() { try { //out.flush(); //out = (DataOutputStream)streams.pop(); // restore previous stream out.writeByte(';'); //out.writeShort(numElementsInAlt); //out.write(altBuf.toByteArray()); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } }
public void alt(GrammarAST alt) { numElementsInAlt = 0; try { out.writeByte('A'); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } //streams.push(out); //altBuf = new ByteArrayOutputStream(); //out = new DataOutputStream(altBuf); }
public void range() { // must be char range numElementsInAlt++; try { out.writeByte('-'); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } }
public void not() { try { out.writeByte('~'); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } }
public void alt(GrammarAST alt) { numElementsInAlt = 0; try { out.writeByte('A'); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } //streams.push(out); //altBuf = new ByteArrayOutputStream(); //out = new DataOutputStream(altBuf); }
public void not() { try { out.writeByte('~'); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } }
public void error(String s, Throwable e) { if ( e instanceof InvocationTargetException ) { e = ((InvocationTargetException)e).getTargetException(); } ErrorManager.error(ErrorManager.MSG_INTERNAL_ERROR, s, e); } public void warning(String s) {
public void wildcard(GrammarAST t) { numElementsInAlt++; try { out.writeByte('w'); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } }
public void block(int nalts) { try { out.writeByte('B'); out.writeShort(nalts); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } }
public void block(int nalts) { try { out.writeByte('B'); out.writeShort(nalts); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } }
public void rule(String name) { try { out.writeByte('R'); writeString(out, name); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } }
public static void internalError(Object error, Throwable e) { StackTraceElement location = getLastNonErrorManagerCodeLocation(e); String msg = "Exception "+e+"@"+location+": "+error; error(MSG_INTERNAL_ERROR, msg); }
public static void internalError(Object error) { StackTraceElement location = getLastNonErrorManagerCodeLocation(new Exception()); String msg = location+": "+error; error(MSG_INTERNAL_ERROR, msg); }
public static void internalError(Object error, Throwable e) { StackTraceElement location = getLastNonErrorManagerCodeLocation(e); String msg = "Exception "+e+"@"+location+": "+error; error(MSG_INTERNAL_ERROR, msg); }
public void token(GrammarAST t) { numElementsInAlt++; try { out.writeByte('t'); int ttype = g.getTokenType(t.getText()); out.writeShort(ttype); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } }
public void ruleRef(GrammarAST t) { numElementsInAlt++; try { out.writeByte('r'); out.writeShort(g.getRuleIndex(t.getText())); } catch (IOException ioe) { ErrorManager.error(ErrorManager.MSG_CANNOT_WRITE_FILE, filename); } }
public void printGrammar(PrintStream output) { ANTLRTreePrinter printer = new ANTLRTreePrinter(); printer.setASTNodeClass("org.antlr.tool.GrammarAST"); try { String g = printer.toString(grammarTree, this, false); output.println(g); } catch (RecognitionException re) { ErrorManager.error(ErrorManager.MSG_SYNTAX_ERROR,re); } }
public void printGrammar(PrintStream output) { ANTLRTreePrinter printer = new ANTLRTreePrinter(new CommonTreeNodeStream(getGrammarTree())); try { String g = printer.toString(this, false); output.println(g); } catch (RecognitionException re) { ErrorManager.error(ErrorManager.MSG_SYNTAX_ERROR,re); } }
public String text(GrammarAST t) { if ( t==null ) return null; try { return new ANTLRTreePrinter(new CommonTreeNodeStream(t)).toString(grammar, true); } catch (Exception e) { ErrorManager.error(ErrorManager.MSG_BAD_AST_STRUCTURE, e); } return null; }