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

Method parseToken

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

Parse a space delimited token. If quoted the token will consume all characters up to a matching quote, otherwise, it consumes up to the first delimiter character. @param quoted If true accept quoted strings.

(boolean quoted)

Source from the content-addressed store, hash-verified

539 * @param quoted If <strong>true</strong> accept quoted strings.
540 */
541 String parseToken(boolean quoted) throws JasperException {
542 StringBuilder StringBuilder = new StringBuilder();
543 skipSpaces();
544 StringBuilder.setLength(0);
545
546 if (!hasMoreInput()) {
547 return "";
548 }
549
550 int ch = peekChar();
551
552 if (quoted) {
553 if (ch == '"' || ch == '\'') {
554
555 char endQuote = ch == '"' ? '"' : '\'';
556 // Consume the open quote:
557 ch = nextChar();
558 for (ch = nextChar(); ch != -1 && ch != endQuote; ch = nextChar()) {
559 if (ch == '\\') {
560 ch = nextChar();
561 }
562 StringBuilder.append((char) ch);
563 }
564 // Check end of quote, skip closing quote:
565 if (ch == -1) {
566 err.jspError(mark(), "jsp.error.quotes.unterminated");
567 }
568 } else {
569 err.jspError(mark(), "jsp.error.attr.quoted");
570 }
571 } else {
572 if (!isDelimiter()) {
573 // Read value until delimiter is found:
574 do {
575 ch = nextChar();
576 // Take care of the quoting here.
577 if (ch == '\\') {
578 if (peekChar() == '"' || peekChar() == '\'' || peekChar() == '>' || peekChar() == '%') {
579 ch = nextChar();
580 }
581 }
582 StringBuilder.append((char) ch);
583 } while (!isDelimiter());
584 }
585 }
586
587 return StringBuilder.toString();
588 }
589
590
591 /**

Callers 2

parseCustomTagMethod · 0.45
checkUnbalancedEndTagMethod · 0.45

Calls 10

skipSpacesMethod · 0.95
hasMoreInputMethod · 0.95
peekCharMethod · 0.95
nextCharMethod · 0.95
markMethod · 0.95
isDelimiterMethod · 0.95
setLengthMethod · 0.80
jspErrorMethod · 0.65
toStringMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected