aima.core.logic.common.LexerException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aima-core Show documentation
Show all versions of aima-core Show documentation
AIMA-Java Core Algorithms from the book Artificial Intelligence a Modern Approach 3rd Ed.
package aima.core.logic.common;
/**
* A runtime exception to be used to describe Lexer exceptions. In particular it
* provides information to help in identifying where in the input character
* sequence the exception occurred.
*
* @author Ciaran O'Reilly
*
*/
public class LexerException extends RuntimeException {
private static final long serialVersionUID = 1L;
private int currentPositionInInput;
public LexerException(String message, int currentPositionInInput) {
super(message);
this.currentPositionInInput = currentPositionInInput;
}
public LexerException(String message, int currentPositionInInput,
Throwable cause) {
super(message, cause);
this.currentPositionInInput = currentPositionInInput;
}
/**
*
* @return the current position in the input character stream that the lexer
* was at before the exception was encountered.
*/
public int getCurrentPositionInInputExceptionThrown() {
return currentPositionInInput;
}
}