Package org.apache.jasper.compiler
Class ELParser
- java.lang.Object
-
- org.apache.jasper.compiler.ELParser
-
public class ELParser extends java.lang.ObjectThis 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 classELParser.Charprivate static classELParser.Idprivate static classELParser.QuotedStringprivate static classELParser.Token
-
Field Summary
Fields Modifier and Type Field Description private ELParser.TokencurTokenprivate ELNode.NodesELexprprivate booleanescapeBSprivate ELNode.Nodesexprprivate java.lang.Stringexpressionprivate intindexprivate booleanisDollarExprprivate ELParser.TokenprevTokenprivate 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 intgetIndex()private booleanhasNext()private booleanhasNextChar()private booleanisELReserved(java.lang.String id)Test if an id is a reserved word in ELprivate charnextChar()private ELParser.TokennextToken()static ELNode.Nodesparse(java.lang.String expression)Parse an EL expressionprivate ELNode.NodesparseEL()Parse an EL expression string '${...} or #{...}'private booleanparseFunction()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.TokenparseQuotedChars(char quote)private intpeekChar()private voidsetIndex(int i)private voidskipSpaces()private java.lang.StringskipUntilEL()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)
-
-