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
()
| 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() |
no test coverage detected