From e5eb09198d2a86dbb55ba63665a7bd7eb5fad19f Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Wed, 30 Aug 2017 20:01:44 -0400 Subject: [PATCH 1/5] Begin migration towards "one output function to rule them all." Consolidated the basic reporting functions that share the same signature. This also resulted in eliminating a string, and adding a new string to disambiguate between errors and warnings. --- include/tidyenum.h | 2 +- src/clean.c | 2 +- src/language_en.h | 6 +- src/language_fr.h | 2 +- src/lexer.c | 22 +-- src/message.c | 252 ++++++++++++------------------- src/message.h | 3 - src/parser.c | 362 ++++++++++++++++++++++----------------------- src/tags.c | 2 +- src/tidylib.c | 28 ++-- 10 files changed, 304 insertions(+), 377 deletions(-) diff --git a/include/tidyenum.h b/include/tidyenum.h index 58454fe..d21e1ca 100644 --- a/include/tidyenum.h +++ b/include/tidyenum.h @@ -260,7 +260,6 @@ extern "C" { FN(BAD_SURROGATE_TAIL) \ /* ReportWarning */ \ FN(BAD_SUMMARY_HTML5) \ - FN(COERCE_TO_ENDTAG_WARN) \ FN(NESTED_EMPHASIS) \ FN(NESTED_QUOTATION) \ FN(OBSOLETE_ELEMENT) \ @@ -271,6 +270,7 @@ extern "C" { FN(ELEMENT_NOT_EMPTY) \ FN(UNEXPECTED_END_OF_FILE) \ FN(UNEXPECTED_ENDTAG) \ + FN(UNEXPECTED_ENDTAG_ERR) \ FN(MOVED_STYLE_TO_HEAD) \ FN(FOUND_STYLE_IN_BODY) diff --git a/src/clean.c b/src/clean.c index 9ef3d8b..7b56f34 100644 --- a/src/clean.c +++ b/src/clean.c @@ -1986,7 +1986,7 @@ void TY_(CleanWord2000)( TidyDocImpl* doc, Node *node) * meaning this result would not ordinarily be displayed. */ Node* next; - TY_(ReportError)(doc, NULL, node, PROPRIETARY_ELEMENT); + TY_(ReportNotice)(doc, NULL, node, PROPRIETARY_ELEMENT); DiscardContainer( doc, node, &next ); node = next; continue; diff --git a/src/language_en.h b/src/language_en.h index 976acda..d597834 100644 --- a/src/language_en.h +++ b/src/language_en.h @@ -1891,17 +1891,17 @@ static languageDefinition language_en = { whichPluralForm_en, { { BAD_SURROGATE_TAIL, 0, "Leading (High) surrogate pair U+%04X, with no trailing (Low) entity, replaced with U+FFFD." }, /* ReportSurrogateError */ { BAD_SUMMARY_HTML5, 0, "The summary attribute on the %s element is obsolete in HTML5" }, /* ReportWarning */ - { COERCE_TO_ENDTAG_WARN, 0, "<%s> is probably intended as " }, /* ReportWarning */ { NESTED_EMPHASIS, 0, "nested emphasis %s" }, /* ReportWarning */ { NESTED_QUOTATION, 0, "nested q elements, possible typo." }, /* ReportWarning */ { OBSOLETE_ELEMENT, 0, "replacing obsolete element %s with %s" }, /* ReportWarning */ { REMOVED_HTML5, 0, "%s element removed from HTML5" }, /* ReportWarning */ { XML_DECLARATION_DETECTED, 0, "An XML declaration was detected. Did you mean to use input-xml?" }, /* ReportWarning */ - { COERCE_TO_ENDTAG, 0, "<%s> is probably intended as " }, /* ReportError, ReportWarning */ + { COERCE_TO_ENDTAG, 0, "<%s> is probably intended as " }, /* ReportWarning */ { ELEMENT_NOT_EMPTY, 0, "%s element not empty or not closed" }, /* ReportError, ReportAttrError */ { UNEXPECTED_END_OF_FILE, 0, "unexpected end of file %s" }, /* ReportError, ReportAttrError */ - { UNEXPECTED_ENDTAG, 0, "unexpected " }, /* ReportError, ReportFatal */ + { UNEXPECTED_ENDTAG, 0, "unexpected " }, /* ReportWarning */ + { UNEXPECTED_ENDTAG_ERR, 0, "unexpected " }, /* ReportError */ { MOVED_STYLE_TO_HEAD, 0, "moved