/** * Determine if the current token matches the expected token type. * * @param expectedType the expected token type of the current token * @return true if the current token did match, or false if the current token did not match * @throws IllegalStateException if this method was called before the stream was {@link #start() started} */ public boolean matches( int expectedType ) throws IllegalStateException { return !completed && currentToken().matches(expectedType); }
/** * Get the position of the next (or current) token. * * @return the current token's position; never null * @throws IllegalStateException if this method was called before the stream was {@link #start() started} * @throws NoSuchElementException if there is no previous token */ public Position nextPosition() { return currentToken().position(); }
/** * Get the position of the previous token. * * @return the previous token's position; never null * @throws IllegalStateException if this method was called before the stream was {@link #start() started} * @throws NoSuchElementException if there is no previous token */ public Position previousPosition() { return previousToken().position(); }
protected NodeComparisonOperator parseNodeComp( TokenStream tokens ) { if (tokens.matches("is") || tokens.matches("<", "<") || tokens.matches(">", ">")) { throw new ParsingException(tokens.nextPosition(), "XPath 'is', '<<' and '>>' expressions 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 Select parseSelect( TokenStream tokens ) throws ParsingException { tokens.consume("SELECT"); List<Column> columns = parseColumns(tokens); tokens.consume("FROM"); String tableName = tokens.consume(); return new Select(tableName, columns); }
protected Delete parseDelete( TokenStream tokens ) throws ParsingException { tokens.consume("DELETE", "FROM"); String tableName = tokens.consume(); tokens.consume("WHERE"); String lhs = tokens.consume(); tokens.consume('='); String rhs = tokens.consume(); return new Delete(tableName, new Criteria(lhs, rhs)); }
String generateFragment() { // Find the current position ... assert currentToken != null; int startIndex = currentToken.startIndex(); return generateFragment(inputString, startIndex, 20, " ===>> "); }
protected NodeComparisonOperator parseNodeComp( TokenStream tokens ) { if (tokens.matches("is") || tokens.matches("<", "<") || tokens.matches(">", ">")) { throw new ParsingException(tokens.nextPosition(), "XPath 'is', '<<' and '>>' expressions 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; }
/** * Determine if the current token matches the expected value. * * @param expected the expected value of the current token token * @return true if the current token did match, or false if the current token did not match * @throws IllegalStateException if this method was called before the stream was {@link #start() started} */ public boolean matches( char expected ) throws IllegalStateException { return !completed && currentToken().matches(expected); }
/** * Get the position of the next (or current) token. * * @return the current token's position; never null * @throws IllegalStateException if this method was called before the stream was {@link #start() started} * @throws NoSuchElementException if there is no previous token */ public Position nextPosition() { return currentToken().position(); }
String generateFragment() { // Find the current position ... assert currentToken != null; int startIndex = currentToken.startIndex(); return generateFragment(inputString, startIndex, 20, " ===>> "); }
/** * Get the position of the previous token. * * @return the previous token's position; never null * @throws IllegalStateException if this method was called before the stream was {@link #start() started} * @throws NoSuchElementException if there is no previous token */ public Position previousPosition() { return previousToken().position(); }
/** * Determine if the current token matches the expected token type. * * @param expectedType the expected token type of the current token * @return true if the current token did match, or false if the current token did not match * @throws IllegalStateException if this method was called before the stream was {@link #start() started} */ public boolean matches( int expectedType ) throws IllegalStateException { return !completed && currentToken().matches(expectedType); }
/** * Get the position of the next (or current) token. * * @return the current token's position; never null * @throws IllegalStateException if this method was called before the stream was {@link #start() started} * @throws NoSuchElementException if there is no previous token */ public Position nextPosition() { return currentToken().position(); }
String generateFragment() { // Find the current position ... assert currentToken != null; int startIndex = currentToken.startIndex(); return generateFragment(inputString, startIndex, 20, " ===>> "); }
/** * Determine if the current token matches the expected value. * * @param expected the expected value of the current token token * @return true if the current token did match, or false if the current token did not match * @throws IllegalStateException if this method was called before the stream was {@link #start() started} */ public boolean matches( char expected ) throws IllegalStateException { return !completed && currentToken().matches(expected); }
/** * Determine if the current token matches the expected token type. * * @param expectedType the expected token type of the current token * @return true if the current token did match, or false if the current token did not match * @throws IllegalStateException if this method was called before the stream was {@link #start() started} */ public boolean matches( int expectedType ) throws IllegalStateException { return !completed && currentToken().matches(expectedType); }
/** * Determine if the current token matches the expected value. * * @param expected the expected value of the current token token * @return true if the current token did match, or false if the current token did not match * @throws IllegalStateException if this method was called before the stream was {@link #start() started} */ public boolean matches( char expected ) throws IllegalStateException { return !completed && currentToken().matches(expected); }