1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
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);
fopen: fn(f: ref Bufio->Iobuf, srcname: string, warning: chan of (Locator, string), preelem: string): (ref Parser, string);
};
|