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

Method parseFunction

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

Parse for a function FunctionInvocation ::= (identifier ':')? identifier '(' (Expression (,Expression) )? ')' Note: currently we don't parse arguments

()

Source from the content-addressed store, hash-verified

134 * Note: currently we don't parse arguments
135 */
136 private boolean parseFunction() {
137 if (!(curToken instanceof Id) || isELReserved(curToken.toTrimmedString()) ||
138 prevToken instanceof Char && prevToken.toChar() == '.') {
139 return false;
140 }
141 String s1 = null; // Function prefix
142 String s2 = curToken.toTrimmedString(); // Function name
143 int start = index - curToken.toString().length();
144 Token original = curToken;
145 if (hasNext()) {
146 int mark = getIndex() - whiteSpace.length();
147 curToken = nextToken();
148 if (curToken.toChar() == ':') {
149 if (hasNext()) {
150 Token t2 = nextToken();
151 if (t2 instanceof Id) {
152 s1 = s2;
153 s2 = t2.toTrimmedString();
154 if (hasNext()) {
155 curToken = nextToken();
156 }
157 }
158 }
159 }
160 if (curToken.toChar() == '(') {
161 ELexpr.add(new ELNode.Function(s1, s2, expression.substring(start, index - 1)));
162 return true;
163 }
164 curToken = original;
165 setIndex(mark);
166 }
167 return false;
168 }
169
170 /**
171 * Test if an id is a reserved word in EL

Callers 1

parseELMethod · 0.95

Calls 11

isELReservedMethod · 0.95
hasNextMethod · 0.95
getIndexMethod · 0.95
nextTokenMethod · 0.95
toTrimmedStringMethod · 0.95
setIndexMethod · 0.95
lengthMethod · 0.80
toStringMethod · 0.65
addMethod · 0.65
toTrimmedStringMethod · 0.45
toCharMethod · 0.45

Tested by

no test coverage detected