Files
mercury/extras/xml/README
Zoltan Somogyi ce14206488 Clean up several aspects of extras/xml.
extras/xml/parsing.m:
extras/xml/unicode.m:
extras/xml/xml.cat.m:
extras/xml/xml.doc.m:
extras/xml/xml.dtd.m:
extras/xml/xml.encoding.m:
extras/xml/xml.m:
extras/xml/xml.ns.m:
extras/xml/xml.parse.chars.m:
extras/xml/xml.parse.m:
    Use predmode declarations when possible.

    Flatten camelCase.

    Add prefixes to the names of function symbols and fields
    if this avoid ambiguity, either with other parts of this code,
    or with standard Mercury function symbols or predicates.

    Replace uses of graphic characters such as ',' and '-' as
    general purpose function symbols with normal, alphanumeric
    function symbols. (Uses of graphic characters to stand for themselves
    in xml.parse.chars.m are unaffected.)

    Replace uses of graphic symbols such as ',' '->' and '[|]' as type names.

    Improve some other names as well.

    Convert (C->T;E) to (if C then T else E).

    Replace tabs with spaces.

    Delete unused imports.

    Make the order of definitions match the order of declarations.

extras/xml/tryit.m:
    Put the code for handling a single command line argument into its own
    predicate.

    Replace see/seen with read_named_file_as_string.

    Avoid using !IO to pass around the parser state.

    Instead of writing out the parse tree as a single very long line,
    convert both the DTD and the HTML code to a prettyprinter doc,
    and print that. This makes the output actually readable, and
    also makes it usefully diffable as well.

extras/xml/Mmakefile:
    Replace the old do-nothing check action with one that actually does
    check whether the code in this directory can do at least one simple task,
    the one mentioned in in samples/README. It would be nice of we had
    more tests, more extensive tests, or (preferably) both, but that would
    require someone who knows the code significantly better than I do.

    Add a rule for making the tags file.

    Compile the modules in this directory with the same default mmc flags
    as we use in the compiler directory.

extras/xml/XML_FLAGS:
    The default flags for modules in this directory.

extras/xml/Mercury.options:
    The non-default flags for modules in this directory.

extras/xml/samples/newsarticles.exp:
    The expected output of running the updated tryit program on the
    (just one) sample input in this directory.

extras/xml/README:
extras/xml/samples/README:
    Replace some obsolete references, and improve formatting.
2022-06-24 07:26:55 +10:00

40 lines
1.8 KiB
Plaintext

This directory contains an XML parsing library.
The parser is implemented using higher order parsing combinators.
It follows the grammar in the XML 1.0 recommendation (see http://www.w3c.org
for more on the recommendation). Unfortunately this means that it isn't quite
conformant because the english text of the recommendation contradicts
the given grammar in a number of places, some of which I have fixed,
and some of which I haven't.
The parser includes external parsed entities, but doesn't deal very well
with non-parsed external entities very well yet (due to some of the
aforementioned contradictions in the recommendation). It is non-validating,
but it does parse the DTD and expand entity and parameter-entity references.
The files in this directory are:
README This file.
xml.m A wrapper module.
xml.cat.m Implements catalog file parsing.
xml.doc.m Defines the types for representing documents.
xml.dtd.m Defines the types for representing DTDs.
xml.encoding.m Implements algorithms used for manipulating
different encoding mechanisms (eg ASCII, UTF-8).
xml.parse.m The main parser.
xml.parse.chars.m A piece of the parser which is split off for
compile time performance.
unicode.m Defines a bunch of functions that return the
unicode number for various ascii characters.
parsing.m Defines the parsing combinators used by the parser.
tryit.m A sample driver program which parses documents
and prints any error messages.
Mmakefile A control file for mmake to build the sample program.
samples A directory including instructions on how to run the
XML parser and some sample files.