Class 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 ${ ..}.
    • Field Detail

      • 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
    • Constructor Detail

      • ELParser

        public ELParser​(java.lang.String expression)
    • 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()
      • 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)