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
|
Xpointers: module
{
PATH: con "/dis/lib/w3c/xpointers.dis";
One, Ole, Oge, Omul, Odiv, Omod, Oand, Oor, Oneg,
Onodetype, Onametest, Ofilter, Opath: con 'A'+iota;
# axis types
Aancestor,
Aancestor_or_self,
Aattribute,
Achild,
Adescendant,
Adescendant_or_self,
Afollowing,
Afollowing_sibling,
Anamespace,
Aparent,
Apreceding,
Apreceding_sibling,
Aself: con iota;
Xstep: adt {
axis: int; # Aancestor, ... (above)
op: int; # Onametest or Onodetype
ns: string;
name: string;
arg: string; # optional parameter to processing-instruction
preds: cyclic list of ref Xpath;
text: fn(nil: self ref Xstep): string;
axisname: fn(i: int): string;
};
Xpath: adt {
pick{
E =>
op: int;
l, r: cyclic ref Xpath;
Fn =>
ns: string;
name: string;
args: cyclic list of ref Xpath;
Var =>
ns: string;
name: string;
Path =>
abs: int;
steps: list of ref Xstep;
Int =>
val: big;
Real =>
val: real;
Str =>
s: string;
}
text: fn(nil: self ref Xpath): string;
};
init: fn();
framework: fn(s: string): (string, list of (string, string, string), string);
# predefined schemes
element: fn(s: string): (string, list of int, string);
xmlns: fn(s: string): (string, string, string);
xpointer: fn(s: string): (ref Xpath, string);
};
|