@@ -745,13 +745,30 @@ public void setHtml4ModeCompatibleWithXhtml1Schemata(
745745 // ]NOCPP]
746746
747747 // For the token handler to call
748+
748749 /**
749750 * Sets the tokenizer state and the associated element name. This should
750751 * only ever used to put the tokenizer into one of the states that have
751752 * a special end tag expectation.
752753 *
753754 * @param specialTokenizerState
754755 * the tokenizer state to set
756+ */
757+ public void setState (int specialTokenizerState ) {
758+ this .stateSave = specialTokenizerState ;
759+ this .endTagExpectation = null ;
760+ this .endTagExpectationAsArray = null ;
761+ }
762+
763+ // [NOCPP[
764+
765+ /**
766+ * Sets the tokenizer state and the associated element name. This should
767+ * only ever used to put the tokenizer into one of the states that have
768+ * a special end tag expectation. For use from the tokenizer test harness.
769+ *
770+ * @param specialTokenizerState
771+ * the tokenizer state to set
755772 * @param endTagExpectation
756773 * the expected end tag for transitioning back to normal
757774 */
@@ -768,6 +785,8 @@ public void setStateAndEndTagExpectation(int specialTokenizerState,
768785 endTagExpectationToArray ();
769786 }
770787
788+ // ]NOCPP]
789+
771790 /**
772791 * Sets the tokenizer state and the associated element name. This should
773792 * only ever used to put the tokenizer into one of the states that have
@@ -3858,11 +3877,17 @@ private void ensureBufferSpace(int inputLength) throws SAXException {
38583877 c = checkChar (buf , pos );
38593878 /*
38603879 * ASSERT! when entering this state, set index to 0 and
3861- * call clearStrBufBeforeUse() assert (contentModelElement !=
3862- * null); Let's implement the above without lookahead.
3863- * strBuf is the 'temporary buffer'.
3880+ * call clearStrBufBeforeUse(); Let's implement the above
3881+ * without lookahead. strBuf is the 'temporary buffer'.
38643882 */
3865- if (index < endTagExpectationAsArray .length ) {
3883+ if (endTagExpectationAsArray == null ) {
3884+ tokenHandler .characters (Tokenizer .LT_SOLIDUS ,
3885+ 0 , 2 );
3886+ cstart = pos ;
3887+ reconsume = true ;
3888+ state = transition (state , returnState , reconsume , pos );
3889+ continue stateloop ;
3890+ } else if (index < endTagExpectationAsArray .length ) {
38663891 char e = endTagExpectationAsArray [index ];
38673892 char folded = c ;
38683893 if (c >= 'A' && c <= 'Z' ) {
0 commit comments