Class ELParser
java.lang.Object
org.apache.jasper.compiler.ELParser
This class implements a parser for EL expressions.
It takes strings of the form xxx${..}yyy${..}zzz etc, and turn it into
a ELNode.Nodes.
Currently, it only handles text outside ${..} and functions in ${ ..}.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static classprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ELParser.Tokenprivate ELNode.Nodesprivate booleanprivate ELNode.Nodesprivate Stringprivate intprivate booleanprivate ELParser.Tokenprivate static final String[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate intgetIndex()private booleanhasNext()private booleanprivate booleanisELReserved(String id) Test if an id is a reserved word in ELprivate charnextChar()private ELParser.Tokenstatic ELNode.NodesParse an EL expressionprivate ELNode.NodesparseEL()Parse an EL expression string '${...} or #{...}'private booleanParse for a function FunctionInvokation ::= (identifier ':')? identifier '(' (Expression (,Expression)*)? ')' Note: currently we don't parse arguments In EL 1.2, method can include parameters, so we need to exclude cases such as a.b().private ELParser.TokenparseQuotedChars(char quote) private intpeekChar()private voidsetIndex(int i) private voidprivate StringSkip until an EL expression ('${' or '#{') is reached, allowing escape sequences '\\', '\$', and '\#'.
-
Field Details
-
curToken
-
prevToken
-
expr
-
ELexpr
-
index
private int index -
expression
-
escapeBS
private boolean escapeBS -
isDollarExpr
private boolean isDollarExpr -
reservedWords
-
-
Constructor Details
-
ELParser
-
-
Method Details
-
parse
Parse an EL expression- Parameters:
expression- The input expression string of the form ( (Char* | (('${' | '#{') Char* '}') )+- Returns:
- Parsed EL expression in ELNode.Nodes
-
parseEL
Parse an EL expression string '${...} or #{...}'- Returns:
- An ELNode.Nodes representing the EL expression TODO: Currently only parsed into functions and text strings. This should be rewritten for a full parser.
-
parseFunction
private boolean parseFunction()Parse for a function FunctionInvokation ::= (identifier ':')? identifier '(' (Expression (,Expression)*)? ')' Note: currently we don't parse arguments In EL 1.2, method can include parameters, so we need to exclude cases such as a.b(). -
isELReserved
Test if an id is a reserved word in EL -
skipUntilEL
Skip until an EL expression ('${' or '#{') is reached, allowing escape sequences '\\', '\$', and '\#'.- Returns:
- The text string up to the EL expression
-
hasNext
private boolean hasNext() -
nextToken
-
parseQuotedChars
-
skipSpaces
private void skipSpaces() -
hasNextChar
private boolean hasNextChar() -
nextChar
private char nextChar() -
peekChar
private int peekChar() -
getIndex
private int getIndex() -
setIndex
private void setIndex(int i)
-