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

Method parseDirective

java/org/apache/jasper/compiler/Parser.java:436–483  ·  view source on GitHub ↗
(Node parent)

Source from the content-addressed store, hash-verified

434 * AttributeDirective | 'variable VariableDirective S? '%>'
435 */
436 private void parseDirective(Node parent) throws JasperException {
437 reader.skipSpaces();
438
439 String directive = null;
440 if (reader.matches("page")) {
441 directive = "<%@ page";
442 if (isTagFile) {
443 err.jspError(reader.mark(), "jsp.error.directive.istagfile", directive);
444 }
445 parsePageDirective(parent);
446 } else if (reader.matches("include")) {
447 directive = "<%@ include";
448 parseIncludeDirective(parent);
449 } else if (reader.matches("taglib")) {
450 if (directivesOnly) {
451 // No need to get the tagLibInfo objects. This also suppresses
452 // parsing of any tag files used in this tag file.
453 return;
454 }
455 directive = "<%@ taglib";
456 parseTaglibDirective(parent);
457 } else if (reader.matches("tag")) {
458 directive = "<%@ tag";
459 if (!isTagFile) {
460 err.jspError(reader.mark(), "jsp.error.directive.isnottagfile", directive);
461 }
462 parseTagDirective(parent);
463 } else if (reader.matches("attribute")) {
464 directive = "<%@ attribute";
465 if (!isTagFile) {
466 err.jspError(reader.mark(), "jsp.error.directive.isnottagfile", directive);
467 }
468 parseAttributeDirective(parent);
469 } else if (reader.matches("variable")) {
470 directive = "<%@ variable";
471 if (!isTagFile) {
472 err.jspError(reader.mark(), "jsp.error.directive.isnottagfile", directive);
473 }
474 parseVariableDirective(parent);
475 } else {
476 err.jspError(reader.mark(), "jsp.error.invalid.directive");
477 }
478
479 reader.skipSpaces();
480 if (!reader.matches("%>")) {
481 err.jspError(start, "jsp.error.unterminated", directive);
482 }
483 }
484
485 /*
486 * Parses a directive with the following syntax:

Callers 4

parseElementsMethod · 0.95
parseFileDirectivesMethod · 0.95

Calls 10

parsePageDirectiveMethod · 0.95
parseIncludeDirectiveMethod · 0.95
parseTaglibDirectiveMethod · 0.95
parseTagDirectiveMethod · 0.95
matchesMethod · 0.65
jspErrorMethod · 0.65
skipSpacesMethod · 0.45
markMethod · 0.45

Tested by

no test coverage detected