Package org.apache.velocity.runtime.parser

# Class StandardParserTokenManager

java.lang.Object
org.apache.velocity.runtime.parser.StandardParserTokenManager

All Implemented Interfaces:
  `StandardParserConstants`

public class StandardParserTokenManager extends Object implements StandardParserConstants
Token Manager.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected int`
`curChar`
`PrintStream`
`debugStream`
Debug output.
`protected CharStream`
`input_stream`
`static final int[]`
`jjnewLexState`
Lex State array.
`static final String[]`
`jjstrLiteralImages`
Token literal values.
`static final String[]`
`lexStateNames`
Lexer state names.
`StandardParser`
`parser`

### Fields inherited from interface org.apache.velocity.runtime.parser.StandardParserConstants

`ALPHA_CHAR, ALT_VAL, BRACKETED_WORD, COLON, COMMA, DEFAULT, DIGIT, DIRECTIVE, DIRECTIVE_CHAR, DIRECTIVE_TERMINATOR, DIVIDE, DOLLAR, DOLLARBANG, DOT, DOUBLE_ESCAPE, DOUBLEDOT, ELSE, ELSEIF, EMPTY_INDEX, END, EOF, EQUALS, ESCAPE, ESCAPE_DIRECTIVE, EXPONENT, FALSE, FLOATING_POINT_LITERAL, FORMAL_COMMENT, HASH, IDENTIFIER, IDENTIFIER_CHAR, IF_DIRECTIVE, IN_FORMAL_COMMENT, IN_MULTI_LINE_COMMENT, IN_MULTILINE_COMMENT, IN_SINGLE_LINE_COMMENT, IN_TEXTBLOCK, INDEX_LBRACKET, INDEX_RBRACKET, INLINE_TEXT, INTEGER_LITERAL, LBRACKET, LCURLY, LEFT_CURLEY, LETTER, LOGICAL_AND, LOGICAL_EQUALS, LOGICAL_GE, LOGICAL_GT, LOGICAL_LE, LOGICAL_LT, LOGICAL_NOT, LOGICAL_NOT_EQUALS, LOGICAL_OR, LOGICAL_OR_2, LONE_SYMBOL, LPAREN, MINUS, MODULUS, MULTI_LINE_COMMENT, MULTIPLY, NEWLINE, OLD_ALPHA_CHAR, OLD_IDENTIFIER, OLD_IDENTIFIER_CHAR, OLD_REFMODIFIER, PIPE, PLUS, PRE_DIRECTIVE, PRE_OLD_REFERENCE, PRE_REFERENCE, RBRACKET, RCURLY, REFERENCE, REFERENCE_TERMINATOR, REFINDEX, REFMOD, REFMOD2, REFMOD2_RPAREN, REFMOD3, REFMODIFIER, RIGHT_CURLEY, RPAREN, SET_DIRECTIVE, SINGLE_LINE_COMMENT, SINGLE_LINE_COMMENT_START, STRING_LITERAL, SUFFIX, TEXT, TEXTBLOCK, tokenImage, TRUE, WHITESPACE, WORD, ZERO_WIDTH_WHITESPACE`

## Constructor Summary

Constructors
Constructor
Description
`StandardParserTokenManager(StandardParser parserArg, CharStream stream)`
Constructor with parser.
`StandardParserTokenManager(StandardParser parserArg, CharStream stream, int lexState)`
Constructor with parser.

## Method Summary

Modifier and Type
Method
Description
`void`
`clearStateVars()`
Clears all state variables, resets to start values, clears stateStack.
`int`
`getCurrentLexicalState()`
`Token`
`getNextToken()`
Get the next Token.
`boolean`
`isInSet()`
`protected Token`
`jjFillToken()`
`void`
`ReInit(StandardParser parserArg, CharStream stream)`
Reinitialise parser.
`void`
`ReInit(StandardParser parserArg, CharStream stream, int lexState)`
Reinitialise parser.
`void`
`setDebugStream(PrintStream ds)`
Set debug output.
`void`
`setInSet(boolean value)`
`boolean`
`stateStackPop()`
pops a state off the stack, and restores paren counts
`boolean`
`stateStackPush()`
pushes the current state onto the 'state stack', and maintains the parens counts public because we need it in PD & VM handling
`void`
`switchTo(int lexState)`
Switches to a new state (add some log to the default method)
`void`
`SwitchTo(int lexState)`
Switch to specified lex state.
`static void`
`trace(String message)`
Our own trace method.

### Methods inherited from class java.lang.Object

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

## Field Details

### debugStream

public PrintStream debugStream
Debug output.

### parser

public StandardParser parser

### jjstrLiteralImages

public static final String[] jjstrLiteralImages
Token literal values.

### lexStateNames

public static final String[] lexStateNames
Lexer state names.

### jjnewLexState

public static final int[] jjnewLexState
Lex State array.

### input_stream

protected CharStream input_stream

### curChar

protected int curChar

## Constructor Details

### StandardParserTokenManager

public StandardParserTokenManager(StandardParser parserArg, CharStream stream)
Constructor with parser.

### StandardParserTokenManager

public StandardParserTokenManager(StandardParser parserArg, CharStream stream, int lexState)
Constructor with parser.

## Method Details

### trace

public static void trace(String message)
Our own trace method. Use sparsingly in production, since each and every call will introduce an execution branch and slow down parsing.

### switchTo

public void switchTo(int lexState)
Switches to a new state (add some log to the default method)

### getCurrentLexicalState

public int getCurrentLexicalState()

### stateStackPop

public boolean stateStackPop()
pops a state off the stack, and restores paren counts

Returns:
  boolean : success of operation

### stateStackPush

public boolean stateStackPush()
pushes the current state onto the 'state stack', and maintains the parens counts public because we need it in PD & VM handling

Returns:
  boolean : success. It can fail if the state machine gets messed up (do don't mess it up :)

### clearStateVars

public void clearStateVars()
Clears all state variables, resets to start values, clears stateStack. Call before parsing.

### setInSet

public void setInSet(boolean value)

### isInSet

public boolean isInSet()

### setDebugStream

public void setDebugStream(PrintStream ds)
Set debug output.

### jjFillToken

protected Token jjFillToken()

### getNextToken

public Token getNextToken()
Get the next Token.

### ReInit

public void ReInit(StandardParser parserArg, CharStream stream)
Reinitialise parser.

### ReInit

public void ReInit(StandardParser parserArg, CharStream stream, int lexState)
Reinitialise parser.

### SwitchTo

public void SwitchTo(int lexState)
Switch to specified lex state.