public final String getLikelyEndContextMismatchCause ( SanitizedContentKind contentKind ) { Preconditions . checkArgument ( ! isValidEndContextForContentKind ( contentKind ) ) ; if ( contentKind == SanitizedContentKind . ATTRIBUTES ) { // Special error message for ATTRIBUTES since it has some specific logic. return "an unterminated attribute value, or ending with an unquoted attribute" ; } switch ( state ) { case HTML_TAG_NAME : case HTML_TAG : case HTML_ATTRIBUTE_NAME : case HTML_NORMAL_ATTR_VALUE : return "an unterminated HTML tag or attribute" ; case CSS : return "an unclosed style block or attribute" ; case JS : case JS_LINE_COMMENT : // Line comments are terminated by end of input. return "an unclosed script block or attribute" ; case CSS_COMMENT : case HTML_COMMENT : case JS_BLOCK_COMMENT : return "an unterminated comment" ; case CSS_DQ_STRING : case CSS_SQ_STRING : case JS_DQ_STRING : case JS_SQ_STRING : return "an unterminated string literal" ; case URI : case CSS_URI : case CSS_DQ_URI : case CSS_SQ_URI : return "an unterminated or empty URI" ; case JS_REGEX : return "an unterminated regular expression" ; default : if ( templateNestDepth != 0 ) { return "an unterminated <template> element" ; } else { return "unknown to compiler" ; } } }
Returns a plausible human - readable description of a context mismatch ;