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