protected void throwNoMoreContent() throws ParsingException { String msg = CommonI18n.noMoreContent.text(); Position pos = tokens.isEmpty() ? new Position(-1, 1, 0) : tokens.get(tokens.size() - 1).position(); throw new ParsingException(pos, msg); }
protected void throwNoMoreContent() throws ParsingException { String msg = CommonI18n.noMoreContent.text(); Position pos = tokens.isEmpty() ? new Position(-1, 1, 0) : tokens.get(tokens.size() - 1).position(); throw new ParsingException(pos, msg); }
protected Component parseValueComp( TokenStream tokens ) { if (tokens.matchesAnyOf("eq", "ne", "lt", "le", "gt")) { throw new ParsingException(tokens.nextPosition(), "XPath value comparisons using 'eq', 'ne', 'lt', 'le', or 'gt' are not supported"); } return null; }
protected Component parseValueComp( TokenStream tokens ) { if (tokens.matchesAnyOf("eq", "ne", "lt", "le", "gt")) { throw new ParsingException(tokens.nextPosition(), "XPath value comparisons using 'eq', 'ne', 'lt', 'le', or 'gt' are not supported"); } return null; }
protected Component parseTreatExpr( TokenStream tokens ) { Component result = parseCastableExpr(tokens); if (tokens.matches("treat", "as")) { throw new ParsingException(tokens.nextPosition(), "XPath 'treat as' expressions are not supported"); } return result; }
protected String parseNCName( TokenStream tokens ) { String name = tokens.consume(); if (!XmlCharacters.isValidNcName(name)) { throw new ParsingException(tokens.previousPosition(), "Expected valid NCName but found " + name); } return name; }
protected Component parseRangeExpr( TokenStream tokens ) { Component result = parseAdditiveExpr(tokens); if (tokens.matches("to")) { throw new ParsingException(tokens.nextPosition(), "XPath range expressions with 'to' are not supported"); } return result; }
protected Component parseMultiplicativeExpr( TokenStream tokens ) { Component result = parseUnaryExpr(tokens); if (tokens.matchesAnyOf("+", "div", "idiv", "mod")) { throw new ParsingException(tokens.nextPosition(), "XPath multiplicative expressions using '+', 'div', 'idiv', or 'mod' are not supported"); } return result; }
protected Component parseCastableExpr( TokenStream tokens ) { Component result = parseCastExpr(tokens); if (tokens.matches("castable", "as")) { throw new ParsingException(tokens.nextPosition(), "XPath 'castable as' expressions are not supported"); } return result; }
protected Component parseCastExpr( TokenStream tokens ) { Component result = parseComparisonExpr(tokens); if (tokens.matches("cast", "as")) { throw new ParsingException(tokens.nextPosition(), "XPath 'cast as' expressions are not supported"); } return result; }
protected Component parseTreatExpr( TokenStream tokens ) { Component result = parseCastableExpr(tokens); if (tokens.matches("treat", "as")) { throw new ParsingException(tokens.nextPosition(), "XPath 'treat as' expressions are not supported"); } return result; }
protected Component parseCastExpr( TokenStream tokens ) { Component result = parseComparisonExpr(tokens); if (tokens.matches("cast", "as")) { throw new ParsingException(tokens.nextPosition(), "XPath 'cast as' expressions are not supported"); } return result; }
protected String parseNCName( TokenStream tokens ) { String name = tokens.consume(); if (!XmlCharacters.isValidNcName(name)) { throw new ParsingException(tokens.previousPosition(), "Expected valid NCName but found " + name); } return name; }
protected Component parseExpr( TokenStream tokens ) { Component result = parseExprSingle(tokens); if (tokens.matches(',')) { throw new ParsingException(tokens.nextPosition(), "Multiple XPath expressions are not supported"); } return result; }
protected Component parseExpr( TokenStream tokens ) { Component result = parseExprSingle(tokens); if (tokens.matches(',')) { throw new ParsingException(tokens.nextPosition(), "Multiple XPath expressions are not supported"); } return result; }
protected Component parseMultiplicativeExpr( TokenStream tokens ) { Component result = parseUnaryExpr(tokens); if (tokens.matchesAnyOf("+", "div", "idiv", "mod")) { throw new ParsingException(tokens.nextPosition(), "XPath multiplicative expressions using '+', 'div', 'idiv', or 'mod' are not supported"); } return result; }
protected Term parseFullTextSearchExpression( String expression, Position startOfExpression ) { try { return new FullTextSearchParser().parse(expression); } catch (ParsingException e) { // Convert the position in the exception into a position in the query. Position queryPos = startOfExpression.add(e.getPosition()); throw new ParsingException(queryPos, e.getMessage()); } }
protected Term parseFullTextSearchExpression( String expression, Position startOfExpression ) { try { return new FullTextSearchParser().parse(expression); } catch (ParsingException e) { // Convert the position in the exception into a position in the query. Position queryPos = startOfExpression.add(e.getPosition()); throw new ParsingException(queryPos, e.getMessage()); } }
protected Term parseFullTextSearchExpression( String expression, Position startOfExpression ) { try { return new FullTextSearchParser().parse(expression); } catch (ParsingException e) { // Convert the position in the exception into a position in the query. Position queryPos = startOfExpression.add(e.getPosition()); throw new ParsingException(queryPos, e.getMessage()); } }
protected BindVariableName parseBindVariableName( TokenStream tokens, TypeSystem typeSystem ) { // The variable name must conform to a valid prefix, which is defined as a valid NCName ... String value = tokens.consume(); if (!XmlCharacters.isValidNcName(value)) { Position pos = tokens.previousPosition(); String msg = GraphI18n.bindVariableMustConformToNcName.text(value, pos.getLine(), pos.getColumn()); throw new ParsingException(pos, msg); } return bindVariableName(value); }