changeset 1362:77f2d091f17f

minor - SaneQueryParser
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 26 May 2019 12:42:08 -0600
parents 9eba6bf0163b
children 1a7b8e38921a
files src/luan/lib/queryparser/SaneQueryParser.java
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
diff -r 9eba6bf0163b -r 77f2d091f17f src/luan/lib/queryparser/SaneQueryParser.java
--- a/src/luan/lib/queryparser/SaneQueryParser.java	Mon Apr 22 00:38:11 2019 -0600
+++ b/src/luan/lib/queryparser/SaneQueryParser.java	Sun May 26 12:42:08 2019 -0600
@@ -30,7 +30,8 @@
 	}
 
 
-	private static final String NOT_IN_TERM = " \t\r\n\":[]{}^+-()";
+	private static final String NOT_IN_RANGE = " \t\r\n\":[]{}^+()";
+	private static final String NOT_IN_TERM = NOT_IN_RANGE + "-";
 	private static final String NOT_IN_FIELD = NOT_IN_TERM + ",";
 	private final FieldParser fieldParser;
 	private final Parser parser;
@@ -91,7 +92,7 @@
 			query = RangeTerm(field);
 		if( query == null ) {
 			parser.begin();
-			String match = SimpleTerm();
+			String match = SimpleTerm(NOT_IN_TERM);
 			query = fieldParser.getQuery(this,field,match);
 			parser.success();
 		}
@@ -145,9 +146,9 @@
 			return parser.failure(null);
 		boolean includeMin = parser.lastChar() == '[';
 		Spaces();
-		String minQuery = SimpleTerm();
+		String minQuery = SimpleTerm(NOT_IN_RANGE);
 		TO();
-		String maxQuery = SimpleTerm();
+		String maxQuery = SimpleTerm(NOT_IN_RANGE);
 		if( !parser.anyOf("]}") )
 			throw exception("unclosed range");
 		boolean includeMax = parser.lastChar() == ']';
@@ -164,7 +165,7 @@
 		parser.success();
 	}
 
-	private String SimpleTerm() throws ParseException {
+	private String SimpleTerm(String exclude) throws ParseException {
 		parser.begin();
 		String match;
 		if( parser.match('"') ) {
@@ -178,7 +179,7 @@
 			match = parser.textFrom(start);
 			Spaces();
 		} else {
-			match = Unquoted(NOT_IN_TERM);
+			match = Unquoted(exclude);
 		}
 		if( match.length() == 0 )
 			throw exception("invalid input");