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

Method parseQuotedChars

java/org/apache/jasper/compiler/ELParser.java:355–382  ·  view source on GitHub ↗
(char quote)

Source from the content-addressed store, hash-verified

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.

Callers 1

nextTokenMethod · 0.95

Calls 6

hasNextCharMethod · 0.95
nextCharMethod · 0.95
getMessageMethod · 0.95
getAndResetWhiteSpaceMethod · 0.95
toStringMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected