org.apache.catalina.ssi

Class ExpressionTokenizer


public class ExpressionTokenizer
extends java.lang.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.

Version:
$Revision: 1.1.2.1 $

Author:
Paul Speed

Field Summary

static int
TOKEN_AND
static int
TOKEN_END
static int
TOKEN_EQ
static int
TOKEN_GE
static int
TOKEN_GT
static int
TOKEN_LBRACE
static int
TOKEN_LE
static int
TOKEN_LT
static int
TOKEN_NOT
static int
TOKEN_NOT_EQ
static int
TOKEN_OR
static int
TOKEN_RBRACE
static int
TOKEN_STRING

Constructor Summary

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

Method Summary

int
getIndex()
Returns the current index for error reporting purposes.
String
getTokenValue()
Returns the String value of the token if it was type TOKEN_STRING.
boolean
hasMoreTokens()
Returns true if there are more tokens.
protected boolean
isMetaChar(char c)
int
nextToken()
Returns the next token type and initializes any state variables accordingly.

Field Details

TOKEN_AND

public static final int TOKEN_AND

Field Value:
1


TOKEN_END

public static final int TOKEN_END

Field Value:
12


TOKEN_EQ

public static final int TOKEN_EQ

Field Value:
4


TOKEN_GE

public static final int TOKEN_GE

Field Value:
8


TOKEN_GT

public static final int TOKEN_GT

Field Value:
10


TOKEN_LBRACE

public static final int TOKEN_LBRACE

Field Value:
7


TOKEN_LE

public static final int TOKEN_LE

Field Value:
9


TOKEN_LT

public static final int TOKEN_LT

Field Value:
11


TOKEN_NOT

public static final int TOKEN_NOT

Field Value:
3


TOKEN_NOT_EQ

public static final int TOKEN_NOT_EQ

Field Value:
5


TOKEN_OR

public static final int TOKEN_OR

Field Value:
2


TOKEN_RBRACE

public static final int TOKEN_RBRACE

Field Value:
6


TOKEN_STRING

public static final int TOKEN_STRING

Field Value:
0

Constructor Details

ExpressionTokenizer

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

Method Details

getIndex

public int getIndex()
Returns the current index for error reporting purposes.


getTokenValue

public String getTokenValue()
Returns the String value of the token if it was type TOKEN_STRING. Otherwise null is returned.


hasMoreTokens

public boolean hasMoreTokens()
Returns true if there are more tokens.


isMetaChar

protected boolean isMetaChar(char c)


nextToken

public int nextToken()
Returns the next token type and initializes any state variables accordingly.


Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.