All Downloads are FREE. Search and download functionalities are using the official Maven repository.

aima.core.logic.common.LexerException Maven / Gradle / Ivy

Go to download

AIMA-Java Core Algorithms from the book Artificial Intelligence a Modern Approach 3rd Ed.

The newest version!
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;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy