Top Description Fields Constructors Methods
org.springframework.expression.spel.standard

pack-priv Class Tokenizer

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .List, org.springframework.expression.spel.InternalParseException, .SpelMessage, .SpelParseException

Lex some input data into a stream of tokens that can then be parsed.
Authors
Andy Clement, Juergen Hoeller, Phillip Webb, Sam Brannen
Since
3.0

Field Summary

Modifier and TypeField and Description
private static final String[]
ALTERNATIVE_OPERATOR_NAMES

Alternative textual operator names which must match enum constant names in TokenKind.

private final char[]
private final String
private static final byte[]
private static final byte
private static final byte
private final int
private int
private final List<Token>

Constructor Summary

AccessConstructor and Description
public
Tokenizer(String inputData)

Method Summary

Modifier and TypeMethod and Description
private boolean
isAlphabetic(char ch)

private boolean
isChar(char a, char b)

private boolean
isDigit(char ch)

private boolean
isDoubleSuffix(char ch)

private boolean
private boolean
isExponentChar(char ch)

private boolean
isFloatSuffix(char ch)

private boolean
private boolean
isIdentifier(char ch)

private boolean
isSign(char ch)

private boolean
isTwoCharToken(TokenKind kind)

Check if this might be a two character token.

private void
private void
private void
lexNumericLiteral(boolean firstCharIsZero)

private void
public List<Token>
private void
pushCharToken(TokenKind kind)

Push a token of just one character in length.

private void
pushHexIntToken(char[] data, boolean isLong, int start, int end)

private void
pushIntToken(char[] data, boolean isLong, int start, int end)

private void
pushOneCharOrTwoCharToken(TokenKind kind, int pos, char[] data)

private void
pushPairToken(TokenKind kind)

Push a token of two characters in length.

private void
pushRealToken(char[] data, boolean isFloat, int start, int end)

private void
raiseParseException(int start, SpelMessage msg, Object... inserts)

private char[]
subarray(int start, int end)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALTERNATIVE_OPERATOR_NAMESback to summary
private static final String[] ALTERNATIVE_OPERATOR_NAMES

Alternative textual operator names which must match enum constant names in TokenKind.

Note that AND and OR are also alternative textual names, but they are handled later in InternalSpelExpressionParser.

If this list gets changed, it must remain sorted since we use it with Arrays#binarySearch(Object[], Object).

charsToProcessback to summary
private final char[] charsToProcess
expressionStringback to summary
private final String expressionString
FLAGSback to summary
private static final byte[] FLAGS
IS_DIGITback to summary
private static final byte IS_DIGIT
IS_HEXDIGITback to summary
private static final byte IS_HEXDIGIT
maxback to summary
private final int max
posback to summary
private int pos
tokensback to summary
private final List<Token> tokens

Constructor Detail

Tokenizerback to summary
public Tokenizer(String inputData)

Method Detail

isAlphabeticback to summary
private boolean isAlphabetic(char ch)
isCharback to summary
private boolean isChar(char a, char b)
isDigitback to summary
private boolean isDigit(char ch)
isDoubleSuffixback to summary
private boolean isDoubleSuffix(char ch)
isExhaustedback to summary
private boolean isExhausted()
isExponentCharback to summary
private boolean isExponentChar(char ch)
isFloatSuffixback to summary
private boolean isFloatSuffix(char ch)
isHexadecimalDigitback to summary
private boolean isHexadecimalDigit(char ch)
isIdentifierback to summary
private boolean isIdentifier(char ch)
isSignback to summary
private boolean isSign(char ch)
isTwoCharTokenback to summary
private boolean isTwoCharToken(TokenKind kind)

Check if this might be a two character token.

lexDoubleQuotedStringLiteralback to summary
private void lexDoubleQuotedStringLiteral()
lexIdentifierback to summary
private void lexIdentifier()
lexNumericLiteralback to summary
private void lexNumericLiteral(boolean firstCharIsZero)
lexQuotedStringLiteralback to summary
private void lexQuotedStringLiteral()
processback to summary
public List<Token> process()
pushCharTokenback to summary
private void pushCharToken(TokenKind kind)

Push a token of just one character in length.

pushHexIntTokenback to summary
private void pushHexIntToken(char[] data, boolean isLong, int start, int end)
pushIntTokenback to summary
private void pushIntToken(char[] data, boolean isLong, int start, int end)
pushOneCharOrTwoCharTokenback to summary
private void pushOneCharOrTwoCharToken(TokenKind kind, int pos, char[] data)
pushPairTokenback to summary
private void pushPairToken(TokenKind kind)

Push a token of two characters in length.

pushRealTokenback to summary
private void pushRealToken(char[] data, boolean isFloat, int start, int end)
raiseParseExceptionback to summary
private void raiseParseException(int start, SpelMessage msg, Object... inserts)
subarrayback to summary
private char[] subarray(int start, int end)