📄 noviablealtexception.java
字号:
package antlr_oaa;
/* ANTLR Translator Generator
* Project led by Terence Parr at http://www.jGuru.com
* Software rights: http://www.antlr.org/RIGHTS.html
*
* $Id: NoViableAltException.java,v 1.1 2002/11/08 17:37:51 agno Exp $
*/
import antlr_oaa.collections.AST;
public class NoViableAltException extends RecognitionException {
public Token token;
public AST node; // handles parsing and treeparsing
public NoViableAltException(AST t) {
super("NoViableAlt");
node = t;
fileName = "<AST>";
}
public NoViableAltException(Token t, String fileName) {
super("NoViableAlt");
token = t;
line = t.getLine();
column = t.getColumn();
this.fileName = fileName;
}
/**
* @deprecated As of ANTLR 2.7.0
*/
public String getErrorMessage () {
return getMessage();
}
/**
* Returns a clean error message (no line number/column information)
*/
public String getMessage ()
{
if (token != null) {
return "unexpected token: "+token.getText();
}
// must a tree parser error if token==null
if ( node==TreeParser.ASTNULL ) {
return "unexpected end of subtree";
}
return "unexpected AST node: "+node.toString();
}
/**
* Returns a string representation of this exception.
*/
public String toString() {
if ( token!=null ) { // AST or Token?
return FileLineFormatter.getFormatter().getFormatString(fileName,line)+getMessage();
}
return getMessage();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -