commit 69d0e225e3e562d43c1c1feba501a757bfba147c
parent 14d5147c03e09aefd9153b6b1f1ff0622d341947
Author: Drew DeVault <sir@cmpwn.com>
Date: Mon, 18 Apr 2022 15:14:14 +0200
format::xml: remove module
Moved to https://git.sr.ht/~sircmpwn/hare-xml
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
7 files changed, 0 insertions(+), 865 deletions(-)
diff --git a/format/xml/+test.ha b/format/xml/+test.ha
@@ -1,131 +0,0 @@
-// License: MPL-2.0
-// (c) 2022 Alexey Yerin <yyp@disroot.org>
-// (c) 2021 Bor Grošelj Simić <bor.groseljsimic@telemach.net>
-// (c) 2021 Drew DeVault <sir@cmpwn.com>
-// (c) 2021 Eyal Sawady <ecs@d2evs.net>
-use io;
-use bufio;
-use fmt;
-use strings;
-
-@test fn basic() void = {
- xmltest("<?xml version='1.0' encoding='utf-8' ?>
-<root>
- <hello name='foobar'>world</hello>
- <foobar bar='foobaz' />
-</root>", [
- "root": elementstart,
- "\n\t": text,
- "hello": elementstart,
- ("name", "foobar"): attribute,
- "world": text,
- "hello": elementend,
- "\n\t": text,
- "foobar": elementstart,
- ("bar", "foobaz"): attribute,
- "foobar": elementend,
- "\n": text,
- "root": elementend,
- ], void);
-};
-
-@test fn comments() void = {
- xmltest("<?xml version='1.0' encoding='utf-8' ?>
-<!-- hello -- world -->
-<root>
- <hello name='foobar'>world<!----></hello>
-</root>", [
- "root": elementstart,
- "\n\t": text,
- "hello": elementstart,
- ("name", "foobar"): attribute,
- "world": text,
- "hello": elementend,
- "\n": text,
- "root": elementend,
- ], void);
-};
-
-@test fn entities() void = {
- xmltest("<?xml version='1.0' encoding='utf-8' ?>
-<root>
- <hello name='foobar &!!'><world> "'</hello>
-</root>", [
- "root": elementstart,
- "\n\t": text,
- "hello": elementstart,
- ("name", "foobar &!!"): attribute,
- "<world> \"'": text,
- "hello": elementend,
- "\n": text,
- "root": elementend,
- ], void);
-};
-
-@test fn cdata() void = {
- xmltest("<?xml version='1.0' encoding='utf-8' ?>
-<root>
- <![CDATA[Hello world &foo <bar>]]>
-</root>", [
- "root": elementstart,
- "\n\t": text,
- "Hello world &foo <bar>": text,
- "\n": text,
- "root": elementend,
- ], void);
-};
-
-@test fn errors() void = {
- xmltest("<?xml version='1.0' encoding='utf-8' ?>
-<!--
-comment which spans
-multiple lines
--->
-<root>
- <hello name='foobar'></world>
-</root>", [
- "root": elementstart,
- "\n\t": text,
- "hello": elementstart,
- ("name", "foobar"): attribute,
- ], 7);
-};
-
-fn xmltest(input: str, expected: []token, err: (void | size)) void = {
- let in = bufio::fixed(strings::toutf8(input), io::mode::READ);
- let parser = parse(&in) as *parser;
- for (let i = 0z; i < len(expected); i += 1) {
- let tok = match (scan(parser)) {
- case let tok: token =>
- yield tok;
- case void =>
- abort("Expected token, got void");
- case let err: syntaxerr =>
- fmt::fatal("{}", strerror(err));
- };
- match (tok) {
- case let el: elementstart =>
- let ex = expected[i] as elementstart;
- assert(el == ex);
- case let at: attribute =>
- let ex = expected[i] as attribute;
- assert(at.0 == ex.0 && at.1 == ex.1);
- case let tx: text =>
- let ex = expected[i] as text;
- if (tx != ex) {
- fmt::errorfln("=== wanted\n{}", ex)!;
- fmt::errorfln("=== got\n{}", tx)!;
- abort();
- };
- case let el: elementend =>
- let ex = expected[i] as elementend;
- assert(el == ex);
- };
- };
- match (err) {
- case void =>
- assert(scan(parser) is void);
- case let z: size =>
- assert(scan(parser) as syntaxerr: size == z);
- };
-};
diff --git a/format/xml/README b/format/xml/README
@@ -1,14 +0,0 @@
-format::xml provides a simple parser of the useful subset of the XML 1.0 (Fifth
-Edition) specification as defined by the W3C. Features omitted are:
-
-- Support for user-defined entities
-- Support for UTF-16 inputs or a UTF-8 BOM
-- Any considerations for the "Namespaces in XML 1.0" specification
-
-Attempting to parse an input file which does not conform to the supported subset
-of XML will return a syntax error. The purpose of this module is to support most
-XML files found in the wild, without supporting the lesser-used features that
-lead to problems like "billion laughs" vulnerabilities. If a fully conformant
-XML parser is required for your application, you will need to use a third-party
-XML implementation. Such an implementation should be able to shadow the standard
-library version and present a compatible API.
diff --git a/format/xml/chars.ha b/format/xml/chars.ha
@@ -1,32 +0,0 @@
-// License: MPL-2.0
-// (c) 2021 Drew DeVault <sir@cmpwn.com>
-use ascii;
-
-fn isnamestart(rn: rune) bool = {
- if (rn == ':' || rn == '_' || ascii::isalpha(rn)) return true;
- let rn = rn: u32;
- return
- (rn >= 0xC0 && rn <= 0xD6) ||
- (rn >= 0xD8 && rn <= 0xF6) ||
- (rn >= 0xF8 && rn <= 0x2FF) ||
- (rn >= 0x370 && rn <= 0x37D) ||
- (rn >= 0x37F && rn <= 0x1FFF) ||
- (rn >= 0x200C && rn <= 0x200D) ||
- (rn >= 0x2070 && rn <= 0x218F) ||
- (rn >= 0x2C00 && rn <= 0x2FEF) ||
- (rn >= 0x3001 && rn <= 0xD7FF) ||
- (rn >= 0xF900 && rn <= 0xFDCF) ||
- (rn >= 0xFDF0 && rn <= 0xFFFD) ||
- (rn >= 0x10000 && rn <= 0xEFFFF);
-};
-
-fn isname(rn: rune) bool = {
- if (isnamestart(rn) || rn == '-' || rn == '.' || ascii::isdigit(rn)) {
- return true;
- };
- let rn = rn: u32;
- return
- (rn == 0xB7) ||
- (rn >= 0x300 && rn <= 0x36F) ||
- (rn >= 0x203F && rn <= 0x2040);
-};
diff --git a/format/xml/parser.ha b/format/xml/parser.ha
@@ -1,568 +0,0 @@
-// License: MPL-2.0
-// (c) 2022 Alexey Yerin <yyp@disroot.org>
-// (c) 2021 Drew DeVault <sir@cmpwn.com>
-// (c) 2021 Eyal Sawady <ecs@d2evs.net>
-// (c) 2022 Sebastian <sebastian@sebsite.pw>
-
-// Are you an intrepid programmer seeking to fork this module to create a more
-// sophisticated XML parser supporting a broader set of features? Good news: all
-// of the features you need to implement are annotated throughout with
-// "XXX: Deliberate ommission" comments.
-use ascii;
-use bufio;
-use encoding::utf8;
-use io;
-use strconv;
-use strings;
-use strio;
-
-// Creates an XML parser. The caller must call [[parser_free]] when they are
-// finished with it.
-//
-// Hare's XML parser only supports UTF-8 encoded input files.
-//
-// This function will attempt to read the XML prologue before returning, and
-// will return an error if it is not valid.
-export fn parse(in: io::handle) (*parser | error) = {
- // XXX: The main reason we allocate this instead of returning it on the
- // stack is so that we have a consistent address for the bufio buffer.
- // This is kind of lame, maybe we can avoid that.
- let par = alloc(parser {
- in = null: *bufio::bufstream,
- close = false,
- namebuf = strio::dynamic(),
- entbuf = strio::dynamic(),
- textbuf = strio::dynamic(),
- line = 1,
- ...
- });
- if (bufio::isbuffered(in)) {
- par.in = in as *io::stream: *bufio::bufstream;
- } else {
- par.in = alloc(bufio::buffered(in, par.buf[..], []));
- par.close = true;
- };
- match (prolog(par)) {
- case void => void;
- case let err: error =>
- parser_free(par);
- return err;
- };
- return par;
-};
-
-// Frees the resources associated with this parser. Does not close the
-// underlying I/O handle.
-export fn parser_free(par: *parser) void = {
- if (par.close) {
- free(par.in);
- };
- io::close(&par.namebuf);
- io::close(&par.entbuf);
- io::close(&par.textbuf);
- for (let i = 0z; i < len(par.tags); i += 1) {
- free(par.tags[i]);
- };
- free(par.tags);
- free(par);
-};
-
-// Scans for and returns the next [[token]]. Tokens are borrowed from the parser
-// and are not valid on subsequent calls to [[scan]]; use [[token_dup]] to
-// extend their lifetime.
-export fn scan(par: *parser) (token | void | error) = {
- switch (par.state) {
- case state::ROOT, state::ATTRS => want(par, OPTWS)?;
- case => void;
- };
- let rn: rune = match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- if (par.state == state::ROOT) {
- return par.line: syntaxerr;
- } else {
- return;
- };
- case let rn: rune =>
- yield rn;
- };
- switch (par.state) {
- case state::ROOT, state::ELEMENT =>
- switch (rn) {
- case '<' =>
- const next = match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- bufio::unreadrune(par.in, rn);
- yield rn;
- };
- bufio::unreadrune(par.in, rn);
- switch (next) {
- case '!' =>
- return scan_comment(par);
- case '?' =>
- return scan_pi(par);
- case => void;
- };
- let el = scan_element(par)?;
- par.state = state::ATTRS;
- return el;
- case =>
- if (par.state == state::ROOT) {
- return par.line: syntaxerr;
- };
- bufio::unreadrune(par.in, rn);
- return scan_content(par)?;
- };
- case state::ATTRS =>
- if (rn == '/') {
- want(par, '>')?;
- par.state = state::ELEMENT;
- return poptag(par, "")?: elementend;
- } else if (rn == '>') {
- par.state = state::ELEMENT;
- return scan(par)?;
- } else if (!isnamestart(rn)) {
- return par.line: syntaxerr;
- };
- bufio::unreadrune(par.in, rn);
- return scan_attr(par)?;
- };
-};
-
-fn poptag(par: *parser, expect: str) (str | error) = {
- if (len(par.tags) == 0) {
- return par.line: syntaxerr;
- };
- let pop = par.tags[len(par.tags) - 1];
- delete(par.tags[len(par.tags) - 1]);
- defer free(pop);
- if (expect != "" && expect != pop) {
- return par.line: syntaxerr;
- };
- strio::reset(&par.namebuf);
- strio::concat(&par.namebuf, pop)!;
- return strio::string(&par.namebuf);
-};
-
-fn scan_attr(par: *parser) (token | error) = {
- let name = scan_name(par, &par.namebuf)?;
- want(par, OPTWS, '=', OPTWS)?;
- let quot = quote(par)?;
- strio::reset(&par.textbuf);
- for (true) match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- rn = switch (rn) {
- case '<' =>
- return par.line: syntaxerr;
- case '&' =>
- bufio::unreadrune(par.in, rn);
- yield scan_entity(par)?;
- case '\n' =>
- par.line += 1;
- yield rn;
- case =>
- yield rn;
- };
- if (rn == quot) break;
- strio::appendrune(&par.textbuf, rn)?;
- };
- return (name, strio::string(&par.textbuf)): attribute;
-};
-
-fn scan_comment(par: *parser) (token | void | error) = {
- want(par, "<!")?;
- match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- switch (rn) {
- case '-' => // Comments
- want(par, '-')?;
- case '[' =>
- want(par, "CDATA[")?;
- if (par.state != state::ELEMENT) {
- return par.line: syntaxerr;
- };
- return scan_cdata(par)?;
- case =>
- return par.line: syntaxerr;
- };
- };
- for (true) {
- const rn = match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- if (rn == '\n') par.line += 1;
- yield rn;
- };
- if (rn != '-') continue;
- const rn = match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- if (rn == '\n') par.line += 1;
- yield rn;
- };
- if (rn != '-') continue;
- const rn = match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- yield rn;
- };
- switch (rn) {
- case '>' =>
- break;
- case '\n' =>
- par.line += 1;
- case => void;
- };
- };
- return scan(par);
-};
-
-fn scan_cdata(par: *parser) (text | error) = {
- strio::reset(&par.textbuf);
- for (true) {
- const rn = match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- yield rn;
- };
- if (rn != ']') {
- if (rn == '\n') par.line += 1;
- strio::appendrune(&par.textbuf, rn)!;
- continue;
- };
- const rn = match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- yield rn;
- };
- if (rn != ']') {
- if (rn == '\n') par.line += 1;
- strio::appendrune(&par.textbuf, rn)!;
- continue;
- };
- const rn = match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- yield rn;
- };
- switch (rn) {
- case '>' =>
- break;
- case '\n' =>
- par.line += 1;
- case => void;
- };
- strio::appendrune(&par.textbuf, rn)!;
- };
- return strio::string(&par.textbuf): text;
-};
-
-fn scan_content(par: *parser) (text | error) = {
- strio::reset(&par.textbuf);
- for (true) match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- break;
- case let rn: rune =>
- rn = switch (rn) {
- case '<' =>
- bufio::unreadrune(par.in, rn);
- break;
- case '&', '%' =>
- bufio::unreadrune(par.in, rn);
- yield scan_entity(par)?;
- case '\n' =>
- par.line += 1;
- yield rn;
- case =>
- yield rn;
- };
- strio::appendrune(&par.textbuf, rn)?;
- };
- return strio::string(&par.textbuf);
-};
-
-fn scan_element(par: *parser) (token | error) = {
- want(par, '<')?;
- let close = false;
- match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- switch (rn) {
- case '/' =>
- close = true;
- case '\n' =>
- par.line += 1;
- bufio::unreadrune(par.in, rn);
- case =>
- bufio::unreadrune(par.in, rn);
- };
- };
- let name = scan_name(par, &par.namebuf)?;
- if (close) {
- poptag(par, name)?;
- return name: elementend;
- } else {
- append(par.tags, strings::dup(name));
- return name: elementstart;
- };
-};
-
-fn scan_entity(par: *parser) (rune | error) = {
- want(par, '&')?;
- let rn = match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- yield rn;
- };
- switch (rn) {
- case '#' =>
- return scan_charref(par);
- case '%' =>
- return par.line: syntaxerr; // XXX: Deliberate omission: PEReference
- case '\n' =>
- return par.line: syntaxerr;
- case =>
- bufio::unreadrune(par.in, rn);
- return scan_namedent(par);
- };
-};
-
-fn scan_charref(par: *parser) (rune | error) = {
- let base = strconv::base::DEC;
- match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- if (rn == 'x') {
- base = strconv::base::HEX;
- } else {
- bufio::unreadrune(par.in, rn);
- };
- };
-
- strio::reset(&par.entbuf);
- for (true) {
- let rn = match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- yield rn;
- };
- if (ascii::isdigit(rn)) {
- strio::appendrune(&par.entbuf, rn)?;
- } else if (rn == ';') {
- break;
- } else {
- return par.line: syntaxerr;
- };
- };
- if (len(strio::string(&par.entbuf)) == 0) {
- return par.line: syntaxerr;
- };
- match (strconv::stou32b(strio::string(&par.entbuf), base)) {
- case let u: u32 =>
- return u: rune;
- case (strconv::invalid | strconv::overflow) =>
- return par.line: syntaxerr;
- };
-};
-
-fn scan_namedent(par: *parser) (rune | error) = {
- const name = scan_name(par, &par.entbuf)?;
- want(par, ';')?;
- const map = [
- ("lt", '<'),
- ("gt", '>'),
- ("amp", '&'),
- ("apos", '\''),
- ("quot", '"'),
- ];
- for (let i = 0z; i < len(map); i += 1) {
- if (map[i].0 == name) {
- return map[i].1;
- };
- };
- // XXX: Deliberate ommission: this only supports the pre-defined
- // entities as defined by XML 1.0 (Fifth Edition) section 4.6.
- return par.line: syntaxerr;
-};
-
-fn scan_name(par: *parser, buf: *strio::dynamic_stream) (str | error) = {
- strio::reset(buf);
-
- const rn = match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- yield rn;
- };
- if (!isnamestart(rn)) {
- return par.line: syntaxerr;
- };
- strio::appendrune(buf, rn)!;
-
- for (true) match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- if (isname(rn)) {
- strio::appendrune(buf, rn)!;
- } else {
- bufio::unreadrune(par.in, rn);
- break;
- };
- };
-
- return strio::string(buf);
-};
-
-fn scan_pi(par: *parser) (void | error) = {
- abort(); // TODO: Processor instructions
-};
-
-fn prolog(par: *parser) (void | error) = {
- // XXX: Deliberate omission(s):
- // - UTF-8 BOM detection
- // - UTF-16 support
- want(par, "<?xml", WS)?;
-
- want(par, "version", OPTWS, '=', OPTWS)?;
- let quot = quote(par)?;
- want(par, OPTWS, "1.")?;
- for (true) match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- break;
- case let rn: rune =>
- if (!ascii::isdigit(rn)) {
- bufio::unreadrune(par.in, rn);
- break;
- };
- };
- want(par, quot)?;
-
- let hadws = want(par, OPTWS)?;
- let encoding = match (bufio::scanrune(par.in)) {
- case io::EOF =>
- yield false;
- case let rn: rune =>
- bufio::unreadrune(par.in, rn);
- yield hadws && rn == 'e';
- };
- if (encoding) {
- let attr = scan_attr(par)? as attribute;
- if (attr.0 != "encoding") {
- return par.line: syntaxerr;
- };
- // XXX: Deliberate omission: all values other than utf-8
- if (!ascii::validstr(attr.1)) {
- return utf8::invalid;
- };
- if (ascii::strcasecmp(attr.1, "utf-8") != 0) {
- return utf8::invalid;
- };
- };
-
- let hadws = want(par, OPTWS)?;
- let standalone = match (bufio::scanrune(par.in)) {
- case io::EOF =>
- yield false;
- case let rn: rune =>
- bufio::unreadrune(par.in, rn);
- yield hadws && rn == 's';
- };
- if (standalone) {
- let attr = scan_attr(par)? as attribute;
- if (attr.0 != "standalone") {
- return par.line: syntaxerr;
- };
- // XXX: Deliberate omission: non-standalone documents
- if (!ascii::validstr(attr.1)) {
- return par.line: syntaxerr;
- };
- if (ascii::strcasecmp(attr.1, "yes") != 0) {
- return par.line: syntaxerr;
- };
- };
-
- want(par, OPTWS, "?>", OPTWS)?;
- // TODO: Parse doctypedecl & misc
- return;
-};
-
-// Mandatory if true
-type whitespace = bool;
-def WS: whitespace = true;
-def OPTWS: whitespace = false;
-
-fn quote(par: *parser) (rune | error) = {
- match (bufio::scanrune(par.in)?) {
- case let rn: rune =>
- switch (rn) {
- case '"', '\'' =>
- return rn;
- case =>
- return par.line: syntaxerr;
- };
- case =>
- return par.line: syntaxerr;
- };
-};
-
-fn want(par: *parser, tok: (rune | str | whitespace)...) (bool | error) = {
- let hadws = false;
- for (let i = 0z; i < len(tok); i += 1) match (tok[i]) {
- case let x: rune =>
- let have = match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- return par.line: syntaxerr;
- case let rn: rune =>
- yield rn;
- };
- if (have != x) {
- return par.line: syntaxerr;
- };
- if (x == '\n') {
- par.line += 1;
- };
- case let x: str =>
- let iter = strings::iter(x);
- for (true) match (strings::next(&iter)) {
- case let rn: rune =>
- want(par, rn)?;
- case void =>
- break;
- };
- case let ws: whitespace =>
- let n = 0;
- for (true; n += 1) match (bufio::scanrune(par.in)?) {
- case io::EOF =>
- break;
- case let rn: rune =>
- if (!ascii::isspace(rn)) {
- bufio::unreadrune(par.in, rn);
- break;
- };
- if (rn == '\n') {
- par.line += 1;
- };
- };
- if (ws && n < 1) {
- return par.line: syntaxerr;
- };
- hadws = n >= 1;
- };
- return hadws;
-};
diff --git a/format/xml/types.ha b/format/xml/types.ha
@@ -1,64 +0,0 @@
-// License: MPL-2.0
-// (c) 2022 Alexey Yerin <yyp@disroot.org>
-// (c) 2021 Drew DeVault <sir@cmpwn.com>
-// (c) 2021 Eyal Sawady <ecs@d2evs.net>
-use bufio;
-use encoding::utf8;
-use fmt;
-use io;
-use os;
-use strio;
-
-export type parser = struct {
- in: *bufio::bufstream,
- buf: [os::BUFSIZ]u8,
- close: bool,
- state: state,
- tags: []str,
- line: size,
-
- // strio buffers:
- namebuf: strio::dynamic_stream,
- entbuf: strio::dynamic_stream,
- textbuf: strio::dynamic_stream,
-};
-
-export type state = enum {
- ROOT,
- ELEMENT,
- ATTRS,
-};
-
-// The start of an XML element, e.g. <example
-export type elementstart = str;
-
-// The end of an XML element, e.g. /> or </example>
-export type elementend = str;
-
-// An attribute of an XML element, e.g. foo="bar"
-export type attribute = (str, str);
-
-// Text content of an XML element, e.g. baz or <![CDATA[baz]]>
-export type text = str;
-
-// Any valid XML token
-export type token = (elementstart | elementend | attribute | text);
-
-// A syntax error was encountered in the document.
-export type syntaxerr = !size;
-
-// Any error which can occur during XML parsing.
-export type error = !(syntaxerr | utf8::invalid | io::error);
-
-// Converts an [[error]] to a user-friendly string representation.
-export fn strerror(err: error) const str = {
- static let buf: [2048]u8 = [0...];
- match (err) {
- case let err: syntaxerr =>
- return fmt::bsprintf(buf, "Syntax error on line {}", err: size);
- case utf8::invalid =>
- return "Document is not valid UTF-8";
- case let err: io::error =>
- return io::strerror(err);
- };
-};
diff --git a/scripts/gen-stdlib b/scripts/gen-stdlib
@@ -540,24 +540,6 @@ format_ini() {
gen_ssa format::ini bufio encoding::utf8 fmt io strings
}
-gensrcs_format_xml() {
- gen_srcs format::xml \
- types.ha \
- parser.ha \
- chars.ha \
- $*
-}
-
-format_xml() {
- if [ $testing -eq 0 ]
- then
- gensrcs_format_xml
- else
- gensrcs_format_xml +test.ha
- fi
- gen_ssa format::xml fmt io bufio strings ascii strio os
-}
-
fs() {
gen_srcs fs \
types.ha \
@@ -1306,7 +1288,6 @@ fmt
fnmatch
format::elf
format::ini
-format::xml
fs
getopt
glob
diff --git a/stdlib.mk b/stdlib.mk
@@ -336,12 +336,6 @@ stdlib_deps_any+=$(stdlib_format_ini_any)
stdlib_format_ini_linux=$(stdlib_format_ini_any)
stdlib_format_ini_freebsd=$(stdlib_format_ini_any)
-# gen_lib format::xml (any)
-stdlib_format_xml_any=$(HARECACHE)/format/xml/format_xml-any.o
-stdlib_deps_any+=$(stdlib_format_xml_any)
-stdlib_format_xml_linux=$(stdlib_format_xml_any)
-stdlib_format_xml_freebsd=$(stdlib_format_xml_any)
-
# gen_lib fs (any)
stdlib_fs_any=$(HARECACHE)/fs/fs-any.o
stdlib_deps_any+=$(stdlib_fs_any)
@@ -1068,18 +1062,6 @@ $(HARECACHE)/format/ini/format_ini-any.ssa: $(stdlib_format_ini_any_srcs) $(stdl
@HARECACHE=$(HARECACHE) $(HAREC) $(HAREFLAGS) -o $@ -Nformat::ini \
-t$(HARECACHE)/format/ini/format_ini.td $(stdlib_format_ini_any_srcs)
-# format::xml (+any)
-stdlib_format_xml_any_srcs= \
- $(STDLIB)/format/xml/types.ha \
- $(STDLIB)/format/xml/parser.ha \
- $(STDLIB)/format/xml/chars.ha
-
-$(HARECACHE)/format/xml/format_xml-any.ssa: $(stdlib_format_xml_any_srcs) $(stdlib_rt) $(stdlib_fmt_$(PLATFORM)) $(stdlib_io_$(PLATFORM)) $(stdlib_bufio_$(PLATFORM)) $(stdlib_strings_$(PLATFORM)) $(stdlib_ascii_$(PLATFORM)) $(stdlib_strio_$(PLATFORM)) $(stdlib_os_$(PLATFORM))
- @printf 'HAREC \t$@\n'
- @mkdir -p $(HARECACHE)/format/xml
- @HARECACHE=$(HARECACHE) $(HAREC) $(HAREFLAGS) -o $@ -Nformat::xml \
- -t$(HARECACHE)/format/xml/format_xml.td $(stdlib_format_xml_any_srcs)
-
# fs (+any)
stdlib_fs_any_srcs= \
$(STDLIB)/fs/types.ha \
@@ -2273,12 +2255,6 @@ testlib_deps_any+=$(testlib_format_ini_any)
testlib_format_ini_linux=$(testlib_format_ini_any)
testlib_format_ini_freebsd=$(testlib_format_ini_any)
-# gen_lib format::xml (any)
-testlib_format_xml_any=$(TESTCACHE)/format/xml/format_xml-any.o
-testlib_deps_any+=$(testlib_format_xml_any)
-testlib_format_xml_linux=$(testlib_format_xml_any)
-testlib_format_xml_freebsd=$(testlib_format_xml_any)
-
# gen_lib fs (any)
testlib_fs_any=$(TESTCACHE)/fs/fs-any.o
testlib_deps_any+=$(testlib_fs_any)
@@ -3025,19 +3001,6 @@ $(TESTCACHE)/format/ini/format_ini-any.ssa: $(testlib_format_ini_any_srcs) $(tes
@HARECACHE=$(TESTCACHE) $(HAREC) $(TESTHAREFLAGS) -o $@ -Nformat::ini \
-t$(TESTCACHE)/format/ini/format_ini.td $(testlib_format_ini_any_srcs)
-# format::xml (+any)
-testlib_format_xml_any_srcs= \
- $(STDLIB)/format/xml/types.ha \
- $(STDLIB)/format/xml/parser.ha \
- $(STDLIB)/format/xml/chars.ha \
- $(STDLIB)/format/xml/+test.ha
-
-$(TESTCACHE)/format/xml/format_xml-any.ssa: $(testlib_format_xml_any_srcs) $(testlib_rt) $(testlib_fmt_$(PLATFORM)) $(testlib_io_$(PLATFORM)) $(testlib_bufio_$(PLATFORM)) $(testlib_strings_$(PLATFORM)) $(testlib_ascii_$(PLATFORM)) $(testlib_strio_$(PLATFORM)) $(testlib_os_$(PLATFORM))
- @printf 'HAREC \t$@\n'
- @mkdir -p $(TESTCACHE)/format/xml
- @HARECACHE=$(TESTCACHE) $(HAREC) $(TESTHAREFLAGS) -o $@ -Nformat::xml \
- -t$(TESTCACHE)/format/xml/format_xml.td $(testlib_format_xml_any_srcs)
-
# fs (+any)
testlib_fs_any_srcs= \
$(STDLIB)/fs/types.ha \