# Class ExpressionTokenizer

java.lang.Object
org.apache.catalina.ssi.ExpressionTokenizer

public class ExpressionTokenizer extends Object
Parses 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 final int`
`TOKEN_AND`
Token type for the AND operator.
`static final int`
`TOKEN_END`
Token type indicating end of expression.
`static final int`
`TOKEN_EQ`
Token type for the equality operator.
`static final int`
`TOKEN_GE`
Token type for the greater-than-or-equal operator.
`static final int`
`TOKEN_GT`
Token type for the greater-than operator.
`static final int`
`TOKEN_LBRACE`
Token type for a left brace.
`static final int`
`TOKEN_LE`
Token type for the less-than-or-equal operator.
`static final int`
`TOKEN_LT`
Token type for the less-than operator.
`static final int`
`TOKEN_NOT`
Token type for the NOT operator.
`static final int`
`TOKEN_NOT_EQ`
Token type for the not-equal operator.
`static final int`
`TOKEN_OR`
Token type for the OR operator.
`static final int`
`TOKEN_RBRACE`
Token type for a right brace.
`static final int`
`TOKEN_STRING`
Token type for a string literal.

## Constructor Summary

Constructors
Constructor
Description
`ExpressionTokenizer(String expr)`
Creates a new parser for the specified expression.

## Method Summary

Modifier and Type
Method
Description
`int`
`getIndex()`
Returns the current index in the expression.
`String`
`getTokenValue()`
Returns the string value of the most recently parsed token.
`boolean`
`hasMoreTokens()`
Checks if there are more tokens available.
`protected boolean`
`isMetaChar(char c)`
Checks if the given character is a meta character used for tokenization.
`int`
`nextToken()`
Parses the next token from the expression.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### 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

## Constructor Details

### ExpressionTokenizer

public ExpressionTokenizer(String expr)
Creates a new parser for the specified expression.

Parameters:
  `expr` - The expression

## Method Details

### hasMoreTokens

public boolean hasMoreTokens()
Checks if there are more tokens available.

Returns:
  `true` if 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:
  `true` if 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 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`