diff options
| author | Charles.Forsyth <devnull@localhost> | 2006-12-22 20:52:35 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2006-12-22 20:52:35 +0000 |
| commit | 46439007cf417cbd9ac8049bb4122c890097a0fa (patch) | |
| tree | 6fdb25e5f3a2b6d5657eb23b35774b631d4d97e4 /module/xml.m | |
| parent | 37da2899f40661e3e9631e497da8dc59b971cbd0 (diff) | |
20060303-partial
Diffstat (limited to 'module/xml.m')
| -rw-r--r-- | module/xml.m | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/module/xml.m b/module/xml.m new file mode 100644 index 00000000..ee83a0c1 --- /dev/null +++ b/module/xml.m @@ -0,0 +1,78 @@ +Xml: module { + PATH: con "/dis/lib/xml.dis"; + Item: adt { + fileoffset: int; + pick { + Tag => + name: string; + attrs: Attributes; + Text => + ch: string; + ws1, ws2: int; + Process => + target: string; + data: string; + Doctype => + name: string; + public: int; + params: list of string; + Stylesheet => + attrs: Attributes; + Error => + loc: Locator; + msg: string; + } + }; + + Locator: adt { + line: int; + systemid: string; + publicid: string; + }; + + Attribute: adt { + name: string; + value: string; + }; + + Attributes: adt { + attrs: list of Attribute; + + all: fn(a: self Attributes): list of Attribute; + get: fn(a: self Attributes, name: string): string; + }; + + Mark: adt { + estack: list of string; + line: int; + offset: int; + readdepth: int; + + str: fn(m: self ref Mark): string; + }; + + Parser: adt { + in: ref Bufio->Iobuf; + eof: int; + lastnl: int; + estack: list of string; + loc: Locator; + warning: chan of (Locator, string); + errormsg: string; + actdepth: int; + readdepth: int; + fileoffset: int; + preelem: string; + ispre: int; + + next: fn(p: self ref Parser): ref Item; + up: fn(p: self ref Parser); + down: fn(p: self ref Parser); + mark: fn(p: self ref Parser): ref Mark; + atmark: fn(p: self ref Parser, m: ref Mark): int; + goto: fn(p: self ref Parser, m: ref Mark); + str2mark: fn(p: self ref Parser, s: string): ref Mark; + }; + init: fn(): string; + open: fn(f: string, warning: chan of (Locator, string), preelem: string): (ref Parser, string); +}; |
