Package org.exolab.adaptx.xpath.engine
Class Lexer
java.lang.Object
org.exolab.adaptx.xpath.engine.Lexer
A Lexical Analizer of XPath patterns and expressions
- Version:
- $Revision: 4047 $ $Date: 2004-01-10 00:04:23 +0100 (Sat, 10 Jan 2004) $
- Author:
- Keith Visco
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final Token[]
the delimiter set of an ExprLexerstatic final char
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Counts the number of times nextToken can be called without returning nullboolean
Determines if there are any tokens availablestatic boolean
isAdditiveOp
(Token token) static boolean
isAxisIdentifier
(Token token) static boolean
isBinaryOp
(Token token) boolean
isDelimiter
(char ch) Determines if the specified char is a delimiterstatic boolean
isDigit
(char ch) Returns true if the char argument is a digitstatic boolean
isEqualityOp
(Token token) static boolean
isLetter
(char ch) Returns true if the char argument is a letterstatic boolean
isMultiplicativeOp
(Token token) static boolean
isNCNameChar
(char ch) Returns true if the char argument is an NCNameChar, as defined by the XML Namespaces recommendation http://www.w3c.org/TR/1999/REC-xml-names-199904114boolean
isOperator
(Token token) static boolean
isQNameChar
(char ch) Returns true if the char argument is an QName character, as defined by the XML Namespaces recommendation http://www.w3c.org/TR/1999/REC-xml-names-199904114static boolean
isRelationalOp
(Token token) static boolean
isWhitespace
(char ch) lookAhead
(int offset) Allows looking ahead for tokens without affecting the token sequence as called by nextToken or previousToken.Retrieves the next available tokenvoid
pushBack()
Moves the position of this Lexer back onevoid
Resets the position of the token pointer to the beginningtoString()
-
Field Details
-
FORWARD_SLASH
public static final char FORWARD_SLASH- See Also:
-
L_PAREN
public static final char L_PAREN- See Also:
-
R_PAREN
public static final char R_PAREN- See Also:
-
L_BRACKET
public static final char L_BRACKET- See Also:
-
R_BRACKET
public static final char R_BRACKET- See Also:
-
PERIOD
public static final char PERIOD- See Also:
-
COMMA
public static final char COMMA- See Also:
-
AT_SYMBOL
public static final char AT_SYMBOL- See Also:
-
DOLLAR_SYMBOL
public static final char DOLLAR_SYMBOL- See Also:
-
S_QUOTE
public static final char S_QUOTE- See Also:
-
D_QUOTE
public static final char D_QUOTE- See Also:
-
VERT_BAR
public static final char VERT_BAR- See Also:
-
COLON
public static final char COLON- See Also:
-
SPACE
public static final char SPACE- See Also:
-
TAB
public static final char TAB- See Also:
-
LF
public static final char LF- See Also:
-
CR
public static final char CR- See Also:
-
NEGATION_OP
public static final char NEGATION_OP- See Also:
-
EQUALS_OP
public static final char EQUALS_OP- See Also:
-
ADDITION_OP
public static final char ADDITION_OP- See Also:
-
SUBTRACTION_OP
public static final char SUBTRACTION_OP- See Also:
-
LESS_THAN_OP
public static final char LESS_THAN_OP- See Also:
-
GREATER_THAN_OP
public static final char GREATER_THAN_OP- See Also:
-
MULTIPLY_OP
public static final char MULTIPLY_OP- See Also:
-
tokenSet
the delimiter set of an ExprLexer
-
-
Constructor Details
-
Lexer
Creates a new ExprLexer using the given String- Throws:
ParseException
-
-
Method Details
-
countTokens
public int countTokens()Counts the number of times nextToken can be called without returning null -
hasMoreTokens
public boolean hasMoreTokens()Determines if there are any tokens available- Returns:
- true if there are tokens available, otherwise false
-
isDelimiter
public boolean isDelimiter(char ch) Determines if the specified char is a delimiter- Parameters:
ch
- the char to compare to the delimiters- Returns:
- true if the String argument is a delimiter
-
isOperator
-
isAdditiveOp
-
isAxisIdentifier
-
isBinaryOp
-
isEqualityOp
-
isRelationalOp
-
isMultiplicativeOp
-
isDigit
public static boolean isDigit(char ch) Returns true if the char argument is a digit- Returns:
- true if the char argument is a digit
-
isLetter
public static boolean isLetter(char ch) Returns true if the char argument is a letter- Returns:
- true if the char argument is a letter
-
isNCNameChar
public static boolean isNCNameChar(char ch) Returns true if the char argument is an NCNameChar, as defined by the XML Namespaces recommendation http://www.w3c.org/TR/1999/REC-xml-names-199904114- Returns:
- true if the char argument is an NCNameChar
-
isQNameChar
public static boolean isQNameChar(char ch) Returns true if the char argument is an QName character, as defined by the XML Namespaces recommendation http://www.w3c.org/TR/1999/REC-xml-names-199904114- Returns:
- true if the char argument is an QName character
-
isWhitespace
public static boolean isWhitespace(char ch) -
lookAhead
Allows looking ahead for tokens without affecting the token sequence as called by nextToken or previousToken. If offset based on the next token, so an offset of 0 will- Parameters:
offset
- the number of tokens to lookAhead- Returns:
- the next token
- Throws:
IllegalArgumentException
- if offset is less than 0.
-
nextToken
Retrieves the next available token- Returns:
- the next available token or null if there are none
-
pushBack
public void pushBack()Moves the position of this Lexer back one -
resetPosition
public void resetPosition()Resets the position of the token pointer to the beginning -
toString
-
toStringPrevious
-
toStringRemainder
-