taurus v0.9.0
direct_parse handles DTD entities — path to deleting legacy parser
The legacy parser (parser_new.c, 1955 lines) existed primarily to
handle DTD internal subsets with custom entity declarations. This
release makes direct_parse DTD-aware, enabling deletion of the
legacy parser in a future release.
Changes
-
DOCTYPE extraction: when
direct_parseencounters
<!DOCTYPE name [subset]>, it extracts the internal subset and
parses it viataurus_dtd_parse_internal_subset(reusing the
existing DTD parser). A DOCTYPE node is created so
taurus_document_internal_subsetexposes the name. -
Entity expansion: when a DTD is present and text/attr content
contains&, entities are eagerly expanded via
taurus_decode_entities_view_with_dtd. Predefined entities
(&etc.) still use the lazy expansion path when no DTD. -
Parse-path gate: the DTD internal-subset gate in
taurus_parse
is removed.direct_parsenow handles DTD inputs directly —
no more forced legacy-parser fallback for<!DOCTYPE>inputs. -
Serializer:
serialize_text_internalnow routes through
taurus_text_get_contentso borrowed text nodes with entities
are materialized + expanded before output.
Verified
<!DOCTYPE root [<!ENTITY foo "Hello">]><root>&foo;</root> parses
via direct_parse with text content "Hello" (was "&foo;"
before this change).
Next steps (future releases)
Once confidence builds that direct_parse handles all real-world
DTD inputs:
- Remove
flat_parsefallback fromtaurus_parse. - Delete the legacy parser (
parser_new.c, ~1955 lines). - Delete
flat_parser.c+flat_promote.c(~1245 lines). - Total: ~3200 lines of parser code removed.