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

Method skipELExpression

java/org/apache/jasper/compiler/JspReader.java:491–528  ·  view source on GitHub ↗

Parse ELExpressionBody that is a body of ${} or #{} expression. Initial reader position is expected to be just after '${' or '#{' characters. In case of success, this method returns Mark for the last character before the terminating '}' and reader is positioned just after the '}' ch

()

Source from the content-addressed store, hash-verified

489 * @return Mark for the last character of EL expression or <code>null</code>
490 */
491 Mark skipELExpression() {
492 // ELExpressionBody.
493 // Starts with "#{" or "${". Ends with "}".
494 // May contain quoted "{", "}", '{', or '}' and nested "{...}"
495 Mark last = mark();
496 boolean singleQuoted = false;
497 boolean doubleQuoted = false;
498 int nesting = 0;
499 int currentChar;
500 do {
501 currentChar = nextChar(last);
502 while (currentChar == '\\' && (singleQuoted || doubleQuoted)) {
503 // skip character following '\' within quotes
504 // No need to update 'last', as neither of these characters
505 // can be the closing '}'.
506 nextChar();
507 currentChar = nextChar();
508 }
509 if (currentChar == -1) {
510 return null;
511 }
512 if (currentChar == '"' && !singleQuoted) {
513 doubleQuoted = !doubleQuoted;
514 } else if (currentChar == '\'' && !doubleQuoted) {
515 singleQuoted = !singleQuoted;
516 } else if (currentChar == '{' && !doubleQuoted && !singleQuoted) {
517 nesting++;
518 } else if (currentChar == '}' && !doubleQuoted && !singleQuoted) {
519 // Note: This also matches the terminating '}' at which point
520 // nesting will be set to -1 - hence the test for
521 // while (currentChar != '}' || nesting > -1 ||...) below
522 // to continue the loop until the final '}' is detected
523 nesting--;
524 }
525 } while (currentChar != '}' || singleQuoted || doubleQuoted || nesting > -1);
526
527 return last;
528 }
529
530 final boolean isSpace() {
531 // Note: If this logic changes, also update Node.TemplateText.rtrim()

Callers 2

skipUntilIgnoreEscMethod · 0.95
parseELExpressionMethod · 0.80

Calls 2

markMethod · 0.95
nextCharMethod · 0.95

Tested by

no test coverage detected