parserexception.java
来自「是有关解释器的.用JAVA编写.可以解释一般的JAVA程序.」· Java 代码 · 共 63 行
JAVA
63 行
/**
* This exception is generated for general errors during parsing, for instance,
* if the anticipated token isn't there. Inherit from this exception to create
* more specific and detailed error types. Use InterpreterException to show
* problems during interpretation.
*
* @see InterpreterException
* @see ScannerException
*/
public class ParserException extends Exception {
private int pos;
private int line;
private String text;
/**
* Instantiates a ParserException.
*
* @param l
* The line where the error was found.
* @param p
* The column where the error was found.
* @param t
* an error description
*/
ParserException(int l, int p, String t) {
super("ParserException <" + t + "> at line " + l + " and position " + p
+ ".");
line = l;
pos = p;
text = t;
}
/**
* Returns the line where the error was found.
*
* @return the error line.
*/
int line() {
return line;
}
/**
* Returns the column where the error was found.
*
* @return the error column.
*/
int pos() {
return pos;
}
/**
* Returns the error description.
*
* @return the error description
*/
String text() {
return text;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?