Small optimization (replace lor 1 by + 1)
[SXSI/xpathcomp.git] / src / grammar2.mli
1 type t
2
3 type node = [ `Start ] Node.t
4
5 type n_type = [ `NonTerminal ]
6 type t_type = [ `Terminal ]
7 type r_type = [ `Rule ]
8 type any_type = [ n_type | t_type ]
9 type rhs = [ r_type ] Node.t
10
11 type n_symbol = n_type Node.t
12 type t_symbol = t_type Node.t
13 type tn_symbol = [ any_type ] Node.t
14
15
16 type partial =
17     Leaf of node
18   | Node0 of tn_symbol
19   | Node1 of tn_symbol * partial
20   | Node2 of tn_symbol * partial * partial
21
22 type conf = C0 | C1 | C2 | C3 | C4 | C5 | C6
23
24 val parse : string -> t
25 val save : t -> string -> unit
26 val load : string -> t
27 val tag_operations : t -> Tag.operations
28
29 val start_tag : t -> node -> tn_symbol
30 val is_terminal : t -> [< any_type ] Node.t -> bool
31 val is_non_terminal : t -> [< any_type ] Node.t -> bool
32 external terminal : [< any_type ] Node.t -> t_symbol = "%identity"
33 external non_terminal : [< any_type ] Node.t -> n_symbol = "%identity"
34 val nil_symbol : t_symbol
35 val tag : t_symbol -> Tag.t
36 val start_first_child : t -> node -> node
37 val start_next_sibling : t -> node -> node
38 val get_rule : t -> n_symbol -> rhs
39 val get_conf : rhs ->  conf
40 val get_rank : rhs -> int
41 val get_id1_rank : rhs -> int
42 val get_id2_rank : rhs -> int
43 val get_id2_pos : rhs -> int
44 val get_id1 : rhs -> tn_symbol
45 val get_id2 : rhs -> tn_symbol