
aima.core.logic.common.ParserException 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;
import java.util.ArrayList;
import java.util.List;
/**
* A runtime exception to be used to describe Parser exceptions. In particular
* it provides information to help in identifying which tokens proved
* problematic in the parse.
*
* @author Ciaran O'Reilly
*
*/
public class ParserException extends RuntimeException {
private static final long serialVersionUID = 1L;
private List problematicTokens = new ArrayList();
public ParserException(String message, Token... problematicTokens) {
super(message);
if (problematicTokens != null) {
for (Token pt : problematicTokens) {
this.problematicTokens.add(pt);
}
}
}
public ParserException(String message, Throwable cause, Token... problematicTokens) {
super(message, cause);
if (problematicTokens != null) {
for (Token pt : problematicTokens) {
this.problematicTokens.add(pt);
}
}
}
/**
*
* @return a list of 0 or more tokens from the input stream that are
* believed to have contributed to the parse exception.
*/
public List getProblematicTokens() {
return problematicTokens;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy