Package org.apache.jasper.compiler
Class ELParser
- java.lang.Object
-
- org.apache.jasper.compiler.ELParser
-
public class ELParser extends java.lang.Object
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 Classes Modifier and Type Class Description private static class
ELParser.Char
private static class
ELParser.Id
private static class
ELParser.QuotedString
private static class
ELParser.Token
-
Field Summary
Fields Modifier and Type Field Description private ELParser.Token
curToken
private ELNode.Nodes
ELexpr
private boolean
escapeBS
private ELNode.Nodes
expr
private java.lang.String
expression
private int
index
private boolean
isDollarExpr
private ELParser.Token
prevToken
private static java.lang.String[]
reservedWords
-
Constructor Summary
Constructors Constructor Description ELParser(java.lang.String expression)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private int
getIndex()
private boolean
hasNext()
private boolean
hasNextChar()
private boolean
isELReserved(java.lang.String id)
Test if an id is a reserved word in ELprivate char
nextChar()
private ELParser.Token
nextToken()
static ELNode.Nodes
parse(java.lang.String expression)
Parse an EL expressionprivate ELNode.Nodes
parseEL()
Parse an EL expression string '${...} or #{...}'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().private ELParser.Token
parseQuotedChars(char quote)
private int
peekChar()
private void
setIndex(int i)
private void
skipSpaces()
private java.lang.String
skipUntilEL()
Skip until an EL expression ('${' or '#{') is reached, allowing escape sequences '\\', '\$', and '\#'.
-
-
-
Field Detail
-
curToken
private ELParser.Token curToken
-
prevToken
private ELParser.Token prevToken
-
expr
private ELNode.Nodes expr
-
ELexpr
private ELNode.Nodes ELexpr
-
index
private int index
-
expression
private java.lang.String expression
-
escapeBS
private boolean escapeBS
-
isDollarExpr
private boolean isDollarExpr
-
reservedWords
private static final java.lang.String[] reservedWords
-
-
Method Detail
-
parse
public static ELNode.Nodes parse(java.lang.String expression)
Parse an EL expression- Parameters:
expression
- The input expression string of the form ( (Char* | (('${' | '#{') Char* '}') )+- Returns:
- Parsed EL expression in ELNode.Nodes
-
parseEL
private 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
private boolean isELReserved(java.lang.String id)
Test if an id is a reserved word in EL
-
skipUntilEL
private java.lang.String 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
private ELParser.Token nextToken()
-
parseQuotedChars
private ELParser.Token parseQuotedChars(char quote)
-
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)
-
-