Package org.apache.catalina.ssi
Class ExpressionTokenizer
- java.lang.Object
-
- org.apache.catalina.ssi.ExpressionTokenizer
-
public class ExpressionTokenizer extends java.lang.ObjectParses an expression string to return the individual tokens. This is patterned similar to the StreamTokenizer in the JDK but customized for SSI conditional expression parsing.
-
-
Field Summary
Fields Modifier and Type Field Description static intTOKEN_ANDToken type for the AND operator.static intTOKEN_ENDToken type indicating end of expression.static intTOKEN_EQToken type for the equality operator.static intTOKEN_GEToken type for the greater-than-or-equal operator.static intTOKEN_GTToken type for the greater-than operator.static intTOKEN_LBRACEToken type for a left brace.static intTOKEN_LEToken type for the less-than-or-equal operator.static intTOKEN_LTToken type for the less-than operator.static intTOKEN_NOTToken type for the NOT operator.static intTOKEN_NOT_EQToken type for the not-equal operator.static intTOKEN_ORToken type for the OR operator.static intTOKEN_RBRACEToken type for a right brace.static intTOKEN_STRINGToken type for a string literal.
-
Constructor Summary
Constructors Constructor Description ExpressionTokenizer(java.lang.String expr)Creates a new parser for the specified expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetIndex()Returns the current index in the expression.java.lang.StringgetTokenValue()Returns the string value of the most recently parsed token.booleanhasMoreTokens()Checks if there are more tokens available.protected booleanisMetaChar(char c)Checks if the given character is a meta character used for tokenization.intnextToken()Parses the next token from the expression.
-
-
-
Field Detail
-
TOKEN_STRING
public static final int TOKEN_STRING
Token type for a string literal.- See Also:
- Constant Field Values
-
TOKEN_AND
public static final int TOKEN_AND
Token type for the AND operator.- See Also:
- Constant Field Values
-
TOKEN_OR
public static final int TOKEN_OR
Token type for the OR operator.- See Also:
- Constant Field Values
-
TOKEN_NOT
public static final int TOKEN_NOT
Token type for the NOT operator.- See Also:
- Constant Field Values
-
TOKEN_EQ
public static final int TOKEN_EQ
Token type for the equality operator.- See Also:
- Constant Field Values
-
TOKEN_NOT_EQ
public static final int TOKEN_NOT_EQ
Token type for the not-equal operator.- See Also:
- Constant Field Values
-
TOKEN_RBRACE
public static final int TOKEN_RBRACE
Token type for a right brace.- See Also:
- Constant Field Values
-
TOKEN_LBRACE
public static final int TOKEN_LBRACE
Token type for a left brace.- See Also:
- Constant Field Values
-
TOKEN_GE
public static final int TOKEN_GE
Token type for the greater-than-or-equal operator.- See Also:
- Constant Field Values
-
TOKEN_LE
public static final int TOKEN_LE
Token type for the less-than-or-equal operator.- See Also:
- Constant Field Values
-
TOKEN_GT
public static final int TOKEN_GT
Token type for the greater-than operator.- See Also:
- Constant Field Values
-
TOKEN_LT
public static final int TOKEN_LT
Token type for the less-than operator.- See Also:
- Constant Field Values
-
TOKEN_END
public static final int TOKEN_END
Token type indicating end of expression.- See Also:
- Constant Field Values
-
-
Method Detail
-
hasMoreTokens
public boolean hasMoreTokens()
Checks if there are more tokens available.- Returns:
trueif there are more tokens
-
getIndex
public int getIndex()
Returns the current index in the expression.- Returns:
- the current index for error reporting purposes
-
isMetaChar
protected boolean isMetaChar(char c)
Checks if the given character is a meta character used for tokenization.- Parameters:
c- the character to check- Returns:
trueif the character is whitespace or an operator character
-
nextToken
public int nextToken()
Parses the next token from the expression.- Returns:
- the next token type constant
-
getTokenValue
public java.lang.String getTokenValue()
Returns the string value of the most recently parsed token.- Returns:
- the string value if the token was of type TOKEN_STRING, otherwise
null
-
-