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

Method parseJspAttributeAndBody

java/org/apache/jasper/compiler/Parser.java:949–977  ·  view source on GitHub ↗

Attempts to parse 'JspAttributeAndBody' production. Returns true if it matched, or false if not. Assumes EmptyBody is okay as well. JspAttributeAndBody ::= ( '>' # S? ( '<jsp:attribute' NamedAttributes )? '<jsp:body' ( JspBodyBody | <TRANSLATION_ERROR> ) S? ETag )

(Node parent, String tag, String bodyType)

Source from the content-addressed store, hash-verified

947 * <TRANSLATION_ERROR> ) S? ETag )
948 */
949 private boolean parseJspAttributeAndBody(Node parent, String tag, String bodyType) throws JasperException {
950 boolean result = false;
951
952 if (reader.matchesOptionalSpacesFollowedBy("<jsp:attribute")) {
953 // It may be an EmptyBody, depending on whether there's a "<jsp:body" before the ETag
954
955 // First, parse <jsp:attribute> elements:
956 parseNamedAttributes(parent);
957
958 result = true;
959 }
960
961 if (reader.matchesOptionalSpacesFollowedBy("<jsp:body")) {
962 // ActionBody
963 parseJspBody(parent, bodyType);
964 reader.skipSpaces();
965 if (!reader.matchesETag(tag)) {
966 err.jspError(reader.mark(), "jsp.error.unterminated", "&lt;" + tag);
967 }
968
969 result = true;
970 } else if (result && !reader.matchesETag(tag)) {
971 // If we have <jsp:attribute> but something other than
972 // <jsp:body> or the end tag, translation error.
973 err.jspError(reader.mark(), "jsp.error.jspbody.required", "&lt;" + tag);
974 }
975
976 return result;
977 }
978
979 /*
980 * StandardAction ::= 'include' StdActionContent | 'forward' StdActionContent | 'invoke' StdActionContent | 'doBody'

Callers 1

parseOptionalBodyMethod · 0.95

Calls 7

parseNamedAttributesMethod · 0.95
parseJspBodyMethod · 0.95
matchesETagMethod · 0.80
jspErrorMethod · 0.65
skipSpacesMethod · 0.45
markMethod · 0.45

Tested by

no test coverage detected