1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

parser: Remove push parser debugging code

This commit is contained in:
Nick Wellnhofer
2023-08-29 17:41:18 +02:00
parent cde4499778
commit e48f2695fe
3 changed files with 3 additions and 366 deletions

View File

@@ -41,7 +41,6 @@
#define HTML_PARSER_BUFFER_SIZE 100 #define HTML_PARSER_BUFFER_SIZE 100
/* #define DEBUG */ /* #define DEBUG */
/* #define DEBUG_PUSH */
static int htmlOmittedDefaultValue = 1; static int htmlOmittedDefaultValue = 1;
@@ -5325,18 +5324,6 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
} }
ctxt->checkIndex = base; ctxt->checkIndex = base;
ctxt->endCheckState = quote; ctxt->endCheckState = quote;
#ifdef DEBUG_PUSH
if (next == 0)
xmlGenericError(xmlGenericErrorContext,
"HPP: lookup '%c' failed\n", first);
else if (third == 0)
xmlGenericError(xmlGenericErrorContext,
"HPP: lookup '%c%c' failed\n", first, next);
else
xmlGenericError(xmlGenericErrorContext,
"HPP: lookup '%c%c%c' failed\n", first, next,
third);
#endif
return (-1); return (-1);
} }
@@ -5398,59 +5385,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
htmlParserNodeInfo node_info; htmlParserNodeInfo node_info;
#ifdef DEBUG_PUSH
switch (ctxt->instate) {
case XML_PARSER_EOF:
xmlGenericError(xmlGenericErrorContext,
"HPP: try EOF\n"); break;
case XML_PARSER_START:
xmlGenericError(xmlGenericErrorContext,
"HPP: try START\n"); break;
case XML_PARSER_MISC:
xmlGenericError(xmlGenericErrorContext,
"HPP: try MISC\n");break;
case XML_PARSER_COMMENT:
xmlGenericError(xmlGenericErrorContext,
"HPP: try COMMENT\n");break;
case XML_PARSER_PROLOG:
xmlGenericError(xmlGenericErrorContext,
"HPP: try PROLOG\n");break;
case XML_PARSER_START_TAG:
xmlGenericError(xmlGenericErrorContext,
"HPP: try START_TAG\n");break;
case XML_PARSER_CONTENT:
xmlGenericError(xmlGenericErrorContext,
"HPP: try CONTENT\n");break;
case XML_PARSER_CDATA_SECTION:
xmlGenericError(xmlGenericErrorContext,
"HPP: try CDATA_SECTION\n");break;
case XML_PARSER_END_TAG:
xmlGenericError(xmlGenericErrorContext,
"HPP: try END_TAG\n");break;
case XML_PARSER_ENTITY_DECL:
xmlGenericError(xmlGenericErrorContext,
"HPP: try ENTITY_DECL\n");break;
case XML_PARSER_ENTITY_VALUE:
xmlGenericError(xmlGenericErrorContext,
"HPP: try ENTITY_VALUE\n");break;
case XML_PARSER_ATTRIBUTE_VALUE:
xmlGenericError(xmlGenericErrorContext,
"HPP: try ATTRIBUTE_VALUE\n");break;
case XML_PARSER_DTD:
xmlGenericError(xmlGenericErrorContext,
"HPP: try DTD\n");break;
case XML_PARSER_EPILOG:
xmlGenericError(xmlGenericErrorContext,
"HPP: try EPILOG\n");break;
case XML_PARSER_PI:
xmlGenericError(xmlGenericErrorContext,
"HPP: try PI\n");break;
case XML_PARSER_SYSTEM_LITERAL:
xmlGenericError(xmlGenericErrorContext,
"HPP: try SYSTEM_LITERAL\n");break;
}
#endif
while (1) { while (1) {
in = ctxt->input; in = ctxt->input;
@@ -5515,24 +5449,12 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 1) < 0)) (htmlParseLookupSequence(ctxt, '>', 0, 0, 1) < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: Parsing internal subset\n");
#endif
htmlParseDocTypeDecl(ctxt); htmlParseDocTypeDecl(ctxt);
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
ctxt->instate = XML_PARSER_PROLOG; ctxt->instate = XML_PARSER_PROLOG;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering PROLOG\n");
#endif
} else { } else {
ctxt->instate = XML_PARSER_MISC; ctxt->instate = XML_PARSER_MISC;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering MISC\n");
#endif
} }
break; break;
case XML_PARSER_MISC: case XML_PARSER_MISC:
@@ -5559,10 +5481,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
(in->cur[2] == '-') && (in->cur[3] == '-')) { (in->cur[2] == '-') && (in->cur[3] == '-')) {
if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0)) if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: Parsing Comment\n");
#endif
htmlParseComment(ctxt); htmlParseComment(ctxt);
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
@@ -5571,10 +5489,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: Parsing PI\n");
#endif
htmlParsePI(ctxt); htmlParsePI(ctxt);
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
@@ -5587,27 +5501,15 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 1) < 0)) (htmlParseLookupSequence(ctxt, '>', 0, 0, 1) < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: Parsing internal subset\n");
#endif
htmlParseDocTypeDecl(ctxt); htmlParseDocTypeDecl(ctxt);
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
ctxt->instate = XML_PARSER_PROLOG; ctxt->instate = XML_PARSER_PROLOG;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering PROLOG\n");
#endif
} else if ((cur == '<') && (next == '!') && } else if ((cur == '<') && (next == '!') &&
(avail < 9)) { (avail < 9)) {
goto done; goto done;
} else { } else {
ctxt->instate = XML_PARSER_CONTENT; ctxt->instate = XML_PARSER_CONTENT;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering START_TAG\n");
#endif
} }
break; break;
case XML_PARSER_PROLOG: case XML_PARSER_PROLOG:
@@ -5621,10 +5523,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
(in->cur[2] == '-') && (in->cur[3] == '-')) { (in->cur[2] == '-') && (in->cur[3] == '-')) {
if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0)) if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: Parsing Comment\n");
#endif
htmlParseComment(ctxt); htmlParseComment(ctxt);
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
@@ -5633,10 +5531,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: Parsing PI\n");
#endif
htmlParsePI(ctxt); htmlParsePI(ctxt);
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
@@ -5646,10 +5540,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
goto done; goto done;
} else { } else {
ctxt->instate = XML_PARSER_CONTENT; ctxt->instate = XML_PARSER_CONTENT;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering START_TAG\n");
#endif
} }
break; break;
case XML_PARSER_EPILOG: case XML_PARSER_EPILOG:
@@ -5668,10 +5558,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
(in->cur[2] == '-') && (in->cur[3] == '-')) { (in->cur[2] == '-') && (in->cur[3] == '-')) {
if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0)) if ((!terminate) && (htmlParseLookupCommentEnd(ctxt) < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: Parsing Comment\n");
#endif
htmlParseComment(ctxt); htmlParseComment(ctxt);
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
@@ -5680,10 +5566,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: Parsing PI\n");
#endif
htmlParsePI(ctxt); htmlParsePI(ctxt);
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
@@ -5695,10 +5577,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
ctxt->errNo = XML_ERR_DOCUMENT_END; ctxt->errNo = XML_ERR_DOCUMENT_END;
ctxt->wellFormed = 0; ctxt->wellFormed = 0;
ctxt->instate = XML_PARSER_EOF; ctxt->instate = XML_PARSER_EOF;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering EOF\n");
#endif
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
ctxt->sax->endDocument(ctxt->userData); ctxt->sax->endDocument(ctxt->userData);
goto done; goto done;
@@ -5728,19 +5606,11 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
cur = in->cur[0]; cur = in->cur[0];
if (cur != '<') { if (cur != '<') {
ctxt->instate = XML_PARSER_CONTENT; ctxt->instate = XML_PARSER_CONTENT;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering CONTENT\n");
#endif
break; break;
} }
if (next == '/') { if (next == '/') {
ctxt->instate = XML_PARSER_END_TAG; ctxt->instate = XML_PARSER_END_TAG;
ctxt->checkIndex = 0; ctxt->checkIndex = 0;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering END_TAG\n");
#endif
break; break;
} }
if ((!terminate) && if ((!terminate) &&
@@ -5784,10 +5654,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
ctxt->instate = XML_PARSER_CONTENT; ctxt->instate = XML_PARSER_CONTENT;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering CONTENT\n");
#endif
break; break;
} }
@@ -5812,10 +5678,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
ctxt->instate = XML_PARSER_CONTENT; ctxt->instate = XML_PARSER_CONTENT;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering CONTENT\n");
#endif
break; break;
} }
@@ -5834,10 +5696,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
ctxt->instate = XML_PARSER_CONTENT; ctxt->instate = XML_PARSER_CONTENT;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering CONTENT\n");
#endif
break; break;
} }
case XML_PARSER_CONTENT: { case XML_PARSER_CONTENT: {
@@ -5914,10 +5772,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if ((cur == '<') && (next == '/')) { if ((cur == '<') && (next == '/')) {
ctxt->instate = XML_PARSER_END_TAG; ctxt->instate = XML_PARSER_END_TAG;
ctxt->checkIndex = 0; ctxt->checkIndex = 0;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering END_TAG\n");
#endif
break; break;
} }
} else if ((cur == '<') && (next == '!')) { } else if ((cur == '<') && (next == '!')) {
@@ -5941,10 +5795,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(htmlParseLookupCommentEnd(ctxt) < 0)) (htmlParseLookupCommentEnd(ctxt) < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: Parsing Comment\n");
#endif
htmlParseComment(ctxt); htmlParseComment(ctxt);
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
@@ -5959,10 +5809,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: Parsing PI\n");
#endif
htmlParsePI(ctxt); htmlParsePI(ctxt);
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
@@ -5970,20 +5816,12 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
} else if ((cur == '<') && (next == '/')) { } else if ((cur == '<') && (next == '/')) {
ctxt->instate = XML_PARSER_END_TAG; ctxt->instate = XML_PARSER_END_TAG;
ctxt->checkIndex = 0; ctxt->checkIndex = 0;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering END_TAG\n");
#endif
break; break;
} else if ((cur == '<') && IS_ASCII_LETTER(next)) { } else if ((cur == '<') && IS_ASCII_LETTER(next)) {
if ((!terminate) && (next == 0)) if ((!terminate) && (next == 0))
goto done; goto done;
ctxt->instate = XML_PARSER_START_TAG; ctxt->instate = XML_PARSER_START_TAG;
ctxt->checkIndex = 0; ctxt->checkIndex = 0;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering START_TAG\n");
#endif
break; break;
} else if (cur == '<') { } else if (cur == '<') {
if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
@@ -6002,10 +5840,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
(htmlParseLookupSequence(ctxt, '<', 0, 0, 0) < 0)) (htmlParseLookupSequence(ctxt, '<', 0, 0, 0) < 0))
goto done; goto done;
ctxt->checkIndex = 0; ctxt->checkIndex = 0;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: Parsing char data\n");
#endif
while ((ctxt->instate != XML_PARSER_EOF) && while ((ctxt->instate != XML_PARSER_EOF) &&
(cur != '<') && (in->cur < in->end)) { (cur != '<') && (in->cur < in->end)) {
if (cur == '&') { if (cur == '&') {
@@ -6034,10 +5868,6 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
ctxt->instate = XML_PARSER_CONTENT; ctxt->instate = XML_PARSER_CONTENT;
} }
ctxt->checkIndex = 0; ctxt->checkIndex = 0;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering CONTENT\n");
#endif
break; break;
default: default:
htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR,
@@ -6069,9 +5899,6 @@ done:
BAD_CAST "-//W3C//DTD HTML 4.0 Transitional//EN", BAD_CAST "-//W3C//DTD HTML 4.0 Transitional//EN",
BAD_CAST "http://www.w3.org/TR/REC-html40/loose.dtd"); BAD_CAST "http://www.w3.org/TR/REC-html40/loose.dtd");
} }
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext, "HPP: done %d\n", ret);
#endif
return(ret); return(ret);
} }
@@ -6107,9 +5934,6 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size,
xmlHaltParser(ctxt); xmlHaltParser(ctxt);
return (ctxt->errNo); return (ctxt->errNo);
} }
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size);
#endif
} }
htmlParseTryOrFinish(ctxt, terminate); htmlParseTryOrFinish(ctxt, terminate);
if (terminate) { if (terminate) {
@@ -6202,9 +6026,6 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
"xmlParserInputBufferPush failed\n", NULL, NULL); "xmlParserInputBufferPush failed\n", NULL, NULL);
xmlHaltParser(ctxt); xmlHaltParser(ctxt);
} }
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size);
#endif
} }
ctxt->progressive = 1; ctxt->progressive = 1;

189
parser.c
View File

@@ -10928,62 +10928,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if (ctxt->input == NULL) if (ctxt->input == NULL)
return(0); return(0);
#ifdef DEBUG_PUSH
switch (ctxt->instate) {
case XML_PARSER_EOF:
xmlGenericError(xmlGenericErrorContext,
"PP: try EOF\n"); break;
case XML_PARSER_START:
xmlGenericError(xmlGenericErrorContext,
"PP: try START\n"); break;
case XML_PARSER_XML_DECL:
xmlGenericError(xmlGenericErrorContext,
"PP: try XML_DECL\n"); break;
case XML_PARSER_MISC:
xmlGenericError(xmlGenericErrorContext,
"PP: try MISC\n");break;
case XML_PARSER_COMMENT:
xmlGenericError(xmlGenericErrorContext,
"PP: try COMMENT\n");break;
case XML_PARSER_PROLOG:
xmlGenericError(xmlGenericErrorContext,
"PP: try PROLOG\n");break;
case XML_PARSER_START_TAG:
xmlGenericError(xmlGenericErrorContext,
"PP: try START_TAG\n");break;
case XML_PARSER_CONTENT:
xmlGenericError(xmlGenericErrorContext,
"PP: try CONTENT\n");break;
case XML_PARSER_CDATA_SECTION:
xmlGenericError(xmlGenericErrorContext,
"PP: try CDATA_SECTION\n");break;
case XML_PARSER_END_TAG:
xmlGenericError(xmlGenericErrorContext,
"PP: try END_TAG\n");break;
case XML_PARSER_ENTITY_DECL:
xmlGenericError(xmlGenericErrorContext,
"PP: try ENTITY_DECL\n");break;
case XML_PARSER_ENTITY_VALUE:
xmlGenericError(xmlGenericErrorContext,
"PP: try ENTITY_VALUE\n");break;
case XML_PARSER_ATTRIBUTE_VALUE:
xmlGenericError(xmlGenericErrorContext,
"PP: try ATTRIBUTE_VALUE\n");break;
case XML_PARSER_DTD:
xmlGenericError(xmlGenericErrorContext,
"PP: try DTD\n");break;
case XML_PARSER_EPILOG:
xmlGenericError(xmlGenericErrorContext,
"PP: try EPILOG\n");break;
case XML_PARSER_PI:
xmlGenericError(xmlGenericErrorContext,
"PP: try PI\n");break;
case XML_PARSER_IGNORE:
xmlGenericError(xmlGenericErrorContext,
"PP: try IGNORE\n");break;
}
#endif
if ((ctxt->input != NULL) && if ((ctxt->input != NULL) &&
(ctxt->input->cur - ctxt->input->base > 4096)) { (ctxt->input->cur - ctxt->input->base > 4096)) {
xmlParserShrink(ctxt); xmlParserShrink(ctxt);
@@ -11034,10 +10978,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
&xmlDefaultSAXLocator); &xmlDefaultSAXLocator);
xmlFatalErr(ctxt, XML_ERR_DOCUMENT_EMPTY, NULL); xmlFatalErr(ctxt, XML_ERR_DOCUMENT_EMPTY, NULL);
xmlHaltParser(ctxt); xmlHaltParser(ctxt);
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering EOF\n");
#endif
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
ctxt->sax->endDocument(ctxt->userData); ctxt->sax->endDocument(ctxt->userData);
goto done; goto done;
@@ -11053,10 +10993,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
(ctxt->input->cur[4] == 'l') && (ctxt->input->cur[4] == 'l') &&
(IS_BLANK_CH(ctxt->input->cur[5]))) { (IS_BLANK_CH(ctxt->input->cur[5]))) {
ret += 5; ret += 5;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: Parsing XML Decl\n");
#endif
xmlParseXMLDecl(ctxt); xmlParseXMLDecl(ctxt);
if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) { if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
/* /*
@@ -11085,10 +11021,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
ctxt->instate = XML_PARSER_MISC; ctxt->instate = XML_PARSER_MISC;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering MISC\n");
#endif
break; break;
case XML_PARSER_START_TAG: { case XML_PARSER_START_TAG: {
const xmlChar *name; const xmlChar *name;
@@ -11371,10 +11303,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
goto done; goto done;
SKIPL(base + 3); SKIPL(base + 3);
ctxt->instate = XML_PARSER_CONTENT; ctxt->instate = XML_PARSER_CONTENT;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering CONTENT\n");
#endif
} }
break; break;
} }
@@ -11391,10 +11319,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(!xmlParseLookupString(ctxt, 2, "?>", 2))) (!xmlParseLookupString(ctxt, 2, "?>", 2)))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: Parsing PI\n");
#endif
xmlParsePI(ctxt); xmlParsePI(ctxt);
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
@@ -11404,10 +11328,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if ((!terminate) && if ((!terminate) &&
(!xmlParseLookupString(ctxt, 4, "-->", 3))) (!xmlParseLookupString(ctxt, 4, "-->", 3)))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: Parsing Comment\n");
#endif
xmlParseComment(ctxt); xmlParseComment(ctxt);
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
@@ -11422,20 +11342,12 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
(ctxt->input->cur[8] == 'E')) { (ctxt->input->cur[8] == 'E')) {
if ((!terminate) && (!xmlParseLookupGt(ctxt))) if ((!terminate) && (!xmlParseLookupGt(ctxt)))
goto done; goto done;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: Parsing internal subset\n");
#endif
ctxt->inSubset = 1; ctxt->inSubset = 1;
xmlParseDocTypeDecl(ctxt); xmlParseDocTypeDecl(ctxt);
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
if (RAW == '[') { if (RAW == '[') {
ctxt->instate = XML_PARSER_DTD; ctxt->instate = XML_PARSER_DTD;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering DTD\n");
#endif
} else { } else {
/* /*
* Create and update the external subset. * Create and update the external subset.
@@ -11451,10 +11363,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
ctxt->instate = XML_PARSER_PROLOG; ctxt->instate = XML_PARSER_PROLOG;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering PROLOG\n");
#endif
} }
} else if ((cur == '<') && (next == '!') && } else if ((cur == '<') && (next == '!') &&
(avail < (avail <
@@ -11463,19 +11371,11 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
} else if (ctxt->instate == XML_PARSER_EPILOG) { } else if (ctxt->instate == XML_PARSER_EPILOG) {
xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL); xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL);
xmlHaltParser(ctxt); xmlHaltParser(ctxt);
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering EOF\n");
#endif
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
ctxt->sax->endDocument(ctxt->userData); ctxt->sax->endDocument(ctxt->userData);
goto done; goto done;
} else { } else {
ctxt->instate = XML_PARSER_START_TAG; ctxt->instate = XML_PARSER_START_TAG;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering START_TAG\n");
#endif
} }
break; break;
case XML_PARSER_DTD: { case XML_PARSER_DTD: {
@@ -11494,90 +11394,16 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
if (ctxt->instate == XML_PARSER_EOF) if (ctxt->instate == XML_PARSER_EOF)
goto done; goto done;
ctxt->instate = XML_PARSER_PROLOG; ctxt->instate = XML_PARSER_PROLOG;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering PROLOG\n");
#endif
break; break;
} }
case XML_PARSER_COMMENT: default:
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == COMMENT\n"); "PP: internal error\n");
ctxt->instate = XML_PARSER_CONTENT; ctxt->instate = XML_PARSER_EOF;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering CONTENT\n");
#endif
break;
case XML_PARSER_IGNORE:
xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == IGNORE");
ctxt->instate = XML_PARSER_DTD;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering DTD\n");
#endif
break;
case XML_PARSER_PI:
xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == PI\n");
ctxt->instate = XML_PARSER_CONTENT;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering CONTENT\n");
#endif
break;
case XML_PARSER_ENTITY_DECL:
xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == ENTITY_DECL\n");
ctxt->instate = XML_PARSER_DTD;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering DTD\n");
#endif
break;
case XML_PARSER_ENTITY_VALUE:
xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == ENTITY_VALUE\n");
ctxt->instate = XML_PARSER_CONTENT;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering DTD\n");
#endif
break;
case XML_PARSER_ATTRIBUTE_VALUE:
xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == ATTRIBUTE_VALUE\n");
ctxt->instate = XML_PARSER_START_TAG;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering START_TAG\n");
#endif
break;
case XML_PARSER_SYSTEM_LITERAL:
xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == SYSTEM_LITERAL\n");
ctxt->instate = XML_PARSER_START_TAG;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering START_TAG\n");
#endif
break;
case XML_PARSER_PUBLIC_LITERAL:
xmlGenericError(xmlGenericErrorContext,
"PP: internal error, state == PUBLIC_LITERAL\n");
ctxt->instate = XML_PARSER_START_TAG;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"PP: entering START_TAG\n");
#endif
break; break;
} }
} }
done: done:
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext, "PP: done %d\n", ret);
#endif
return(ret); return(ret);
encoding_error: encoding_error:
if (ctxt->input->end - ctxt->input->cur < 4) { if (ctxt->input->end - ctxt->input->cur < 4) {
@@ -11643,9 +11469,6 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
xmlHaltParser(ctxt); xmlHaltParser(ctxt);
return(ctxt->errNo); return(ctxt->errNo);
} }
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext, "PP: pushed %d\n", size);
#endif
} }
xmlParseTryOrFinish(ctxt, terminate); xmlParseTryOrFinish(ctxt, terminate);
@@ -11786,9 +11609,6 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
xmlFatalErr(ctxt, ctxt->input->buf->error, NULL); xmlFatalErr(ctxt, ctxt->input->buf->error, NULL);
xmlHaltParser(ctxt); xmlHaltParser(ctxt);
} }
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext, "PP: pushed %d\n", size);
#endif
} }
return(ctxt); return(ctxt);
@@ -14119,9 +13939,6 @@ xmlCtxtResetPush(xmlParserCtxtPtr ctxt, const char *chunk,
xmlHaltParser(ctxt); xmlHaltParser(ctxt);
return(1); return(1);
} }
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext, "PP: pushed %d\n", size);
#endif
} }
if (encoding != NULL) { if (encoding != NULL) {

View File

@@ -453,7 +453,6 @@ xmlIsLetter(int c) {
/* #define DEBUG_INPUT */ /* #define DEBUG_INPUT */
/* #define DEBUG_STACK */ /* #define DEBUG_STACK */
/* #define DEBUG_PUSH */
/* we need to keep enough input to show errors in context */ /* we need to keep enough input to show errors in context */