private char LA(int i) { if ( currentPosition + ( i - 1 ) >= this.endPosition ) { return (char) -1; } return getXPath().charAt( this.currentPosition + (i - 1) ); }
private Token leftBracket() { Token token = new Token( TokenTypes.LEFT_BRACKET, getXPath(), this.currentPosition, this.currentPosition+1 ); consume(); return token; }
private Token rightBracket() { Token token = new Token( TokenTypes.RIGHT_BRACKET, getXPath(), this.currentPosition, this.currentPosition+1 ); consume(); return token; }
private Token dollar() { Token token = new Token( TokenTypes.DOLLAR, getXPath(), this.currentPosition, this.currentPosition+1 ); consume(); return token; }
private Token pipe() { Token token = new Token( TokenTypes.PIPE, getXPath(), this.currentPosition, this.currentPosition+1 ); consume(); return token; }
private Token comma() { Token token = new Token( TokenTypes.COMMA, getXPath(), this.currentPosition, this.currentPosition+1 ); consume(); return token; }
private Token minus() { Token token = new Token( TokenTypes.MINUS, getXPath(), this.currentPosition, this.currentPosition+1 ); consume(); return token; }
private Token colon() { Token token = new Token( TokenTypes.COLON, getXPath(), this.currentPosition, this.currentPosition+1 ); consume(); return token; }
private Token leftParen() { Token token = new Token( TokenTypes.LEFT_PAREN, getXPath(), this.currentPosition, this.currentPosition+1 ); consume(); return token; }
private Token equals() { Token token = new Token( TokenTypes.EQUALS, getXPath(), this.currentPosition, this.currentPosition+1 ); consume(); return token; }
private Token star() { int tokenType = expectOperator ? TokenTypes.STAR_OPERATOR : TokenTypes.STAR; Token token = new Token( tokenType, getXPath(), this.currentPosition, this.currentPosition+1 ); consume(); return token; }
private Token plus() { Token token = new Token( TokenTypes.PLUS, getXPath(), this.currentPosition, this.currentPosition+1 ); consume(); return token; }
private Token at() { Token token = new Token( TokenTypes.AT, getXPath(), this.currentPosition, this.currentPosition+1 ); consume(); return token; }
private Token rightParen() { Token token = new Token( TokenTypes.RIGHT_PAREN, getXPath(), this.currentPosition, this.currentPosition+1 ); consume(); return token; }
private XPathSyntaxException createSyntaxException(String message) { String xpath = this.lexer.getXPath(); int position = LT(1).getTokenBegin(); return new XPathSyntaxException( xpath, position, message ); }
private void throwInvalidAxis(String invalidAxis) throws SAXPathException { String xpath = this.lexer.getXPath(); int position = LT(1).getTokenBegin(); String message = "Expected valid axis name instead of [" + invalidAxis + "]"; throw new XPathSyntaxException( xpath, position, message ); } }
private Token doubleColon() { Token token = new Token( TokenTypes.DOUBLE_COLON, getXPath(), this.currentPosition, this.currentPosition+2 ); consume(); consume(); return token; }
private Token notEquals() { Token token = new Token( TokenTypes.NOT_EQUALS, getXPath(), this.currentPosition, this.currentPosition + 2 ); consume(); consume(); return token; }
private Token or() { Token token = null; if ( ( LA(1) == 'o' ) && ( LA(2) == 'r' ) ) { token = new Token( TokenTypes.OR, getXPath(), this.currentPosition, this.currentPosition+2 ); consume(); consume(); } return token; }
private Token identifier() { Token token = null; int start = this.currentPosition; while ( hasMoreChars() ) { if ( Verifier.isXMLNCNameCharacter( LA(1) ) ) { consume(); } else { break; } } token = new Token( TokenTypes.IDENTIFIER, getXPath(), start, this.currentPosition ); return token; }