MCPcopy Index your code
hub / github.com/apache/tomcat / parseEL

Method parseEL

java/org/apache/jasper/compiler/ELParser.java:92–130  ·  view source on GitHub ↗

Parse an EL expression string '${...}'. Currently only separates the EL into functions and everything else. @return An ELNode.Nodes representing the EL expression Note: This cannot be refactored to use the standard EL implementation as the EL API does not provide the level of access req

()

Source from the content-addressed store, hash-verified

90 * implementation as the EL API does not provide the level of access required to the parsed expression.
91 */
92 private ELNode.Nodes parseEL() {
93
94 StringBuilder buf = new StringBuilder();
95 ELexpr = new ELNode.Nodes();
96 curToken = null;
97 prevToken = null;
98 int openBraces = 0;
99 while (hasNext()) {
100 curToken = nextToken();
101 if (curToken instanceof Char) {
102 if (curToken.toChar() == '}') {
103 openBraces--;
104 if (openBraces < 0) {
105 break;
106 }
107 } else if (curToken.toChar() == '{') {
108 openBraces++;
109 }
110 buf.append(curToken.toString());
111 } else {
112 // Output whatever is in buffer
113 if (!buf.isEmpty()) {
114 ELexpr.add(new ELNode.ELText(buf.toString()));
115 buf.setLength(0);
116 }
117 if (!parseFunction()) {
118 ELexpr.add(new ELNode.ELText(curToken.toString()));
119 }
120 }
121 }
122 if (curToken != null) {
123 buf.append(curToken.getWhiteSpace());
124 }
125 if (!buf.isEmpty()) {
126 ELexpr.add(new ELNode.ELText(buf.toString()));
127 }
128
129 return ELexpr;
130 }
131
132 /**
133 * Parse for a function FunctionInvocation ::= (identifier ':')? identifier '(' (Expression (,Expression)*)? ')'

Callers 1

parseMethod · 0.95

Calls 10

hasNextMethod · 0.95
nextTokenMethod · 0.95
parseFunctionMethod · 0.95
setLengthMethod · 0.80
getWhiteSpaceMethod · 0.80
toStringMethod · 0.65
addMethod · 0.65
toCharMethod · 0.45
appendMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected