1 package antlr; 2 3 9 10 import antlr.collections.AST; 11 12 public class NoViableAltException extends RecognitionException { 13 public Token token; 14 public AST node; 16 public NoViableAltException(AST t) { 17 super("NoViableAlt", "<AST>", -1, -1); 18 node = t; 19 } 20 21 public NoViableAltException(Token t, String fileName_) { 22 super("NoViableAlt", fileName_, t.getLine(), t.getColumn()); 23 token = t; 24 } 25 26 29 public String getMessage() { 30 if (token != null) { 31 return "unexpected token: " + token.getText(); 32 } 33 34 if (node == TreeParser.ASTNULL) { 36 return "unexpected end of subtree"; 37 } 38 return "unexpected AST node: " + node.toString(); 39 } 40 } 41 | Popular Tags |