view lucene/src/luan/modules/lucene/queryparser/ParseException.java @ 730:01e68da6983b

add sane-lucene-queryparser source to luan
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 10 Jun 2016 15:41:15 -0600
parents
children
line wrap: on
line source

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();
	}

}