(char quote)
| 353 | * Parse a string in single or double quotes, allowing for escape sequences '\\', '\"' and "\'" |
| 354 | */ |
| 355 | private Token parseQuotedChars(char quote) { |
| 356 | StringBuilder buf = new StringBuilder(); |
| 357 | buf.append(quote); |
| 358 | boolean foundQuote = false; |
| 359 | while (hasNextChar()) { |
| 360 | char ch = nextChar(); |
| 361 | if (ch == '\\') { |
| 362 | ch = nextChar(); |
| 363 | if (ch == '\\' || ch == '\'' || ch == '\"') { |
| 364 | buf.append(ch); |
| 365 | } else { |
| 366 | throw new IllegalArgumentException( |
| 367 | Localizer.getMessage("org.apache.jasper.compiler.ELParser.invalidQuoting", expression)); |
| 368 | } |
| 369 | } else if (ch == quote) { |
| 370 | foundQuote = true; |
| 371 | buf.append(ch); |
| 372 | break; |
| 373 | } else { |
| 374 | buf.append(ch); |
| 375 | } |
| 376 | } |
| 377 | if (!foundQuote) { |
| 378 | throw new IllegalArgumentException( |
| 379 | Localizer.getMessage("org.apache.jasper.compiler.ELParser.missingQuote", expression)); |
| 380 | } |
| 381 | return new QuotedString(getAndResetWhiteSpace(), buf.toString()); |
| 382 | } |
| 383 | |
| 384 | /* |
| 385 | * A collection of low level parse methods dealing with character in the EL expression buffer. |
no test coverage detected