Package org.apache.jasper.compiler
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 class
private static class
private static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ELParser.Token
private ELNode.Nodes
private boolean
private ELNode.Nodes
private String
private int
private boolean
private ELParser.Token
private static final String[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate int
getIndex()
private boolean
hasNext()
private boolean
private boolean
isELReserved
(String id) Test if an id is a reserved word in ELprivate char
nextChar()
private ELParser.Token
static ELNode.Nodes
Parse an EL expressionprivate ELNode.Nodes
parseEL()
Parse an EL expression string '${...} or #{...}'private boolean
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().private ELParser.Token
parseQuotedChars
(char quote) private int
peekChar()
private void
setIndex
(int i) private void
private String
Skip 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)
-