Mercurial Hosting > luan
diff src/luan/modules/lucene/queryparser/ParseException.java @ 775:1a68fc55a80c
simplify dir structure
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 26 Aug 2016 14:36:40 -0600 |
parents | lucene/src/luan/modules/lucene/queryparser/ParseException.java@01e68da6983b |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/luan/modules/lucene/queryparser/ParseException.java Fri Aug 26 14:36:40 2016 -0600 @@ -0,0 +1,33 @@ +package luan.modules.lucene.queryparser; + + +public final class ParseException extends Exception { + public final String text; + public final int errorIndex; + public final int highIndex; + + public ParseException(SaneQueryParser qp) { + this(qp,"Invalid input"); + } + + public ParseException(SaneQueryParser qp,String msg) { + super(msg+" at position "+(qp.parser.errorIndex()+1)); + Parser parser = qp.parser; + this.text = parser.text; + this.errorIndex = parser.errorIndex(); + this.highIndex = parser.highIndex(); + } + + public ParseException(SaneQueryParser qp,Exception cause) { + this(qp,cause.getMessage(),cause); + } + + public ParseException(SaneQueryParser qp,String msg,Exception cause) { + super(msg+" at position "+(qp.parser.errorIndex()+1),cause); + Parser parser = qp.parser; + this.text = parser.text; + this.errorIndex = parser.errorIndex(); + this.highIndex = parser.highIndex(); + } + +}