Various fixes to the old grammar interface
[SXSI/xpathcomp.git] / src / grammar.mli
index 5d5e8ab..dcf0067 100644 (file)
@@ -13,9 +13,9 @@ type n_symbol = n_type Node.t
 type t_symbol = t_type Node.t
 type tn_symbol = [ n_type | t_type ] Node.t
 
-type partial = Node of tn_symbol * partial array | Leaf of node
-
-
+type partial =
+ | Leaf of node
+ | Node of tn_symbol * partial array
 
 
 val is_terminal : [< any_type ] Node.t -> bool
@@ -25,19 +25,22 @@ val is_parameter : [< any_type ] Node.t -> bool
 external get_symbol_at : t -> symbol -> node -> symbol = "caml_grammar_get_symbol_at"
 external first_child : t -> symbol -> node -> node = "caml_grammar_first_child"
 external next_sibling : t -> symbol -> node -> node = "caml_grammar_next_sibling"
+external start_first_child : t -> node -> node = "caml_grammar_start_first_child"
+external start_next_sibling : t -> node -> node = "caml_grammar_start_next_sibling"
 external parameter : [< any_type ] Node.t -> p_symbol = "%identity"
 external terminal : [< any_type ] Node.t -> t_symbol = "%identity"
 external non_terminal : [< any_type ] Node.t -> n_symbol = "%identity"
 external get_id1 : t -> n_symbol -> tn_symbol = "caml_grammar_get_id1"
 external get_id2 : t -> n_symbol -> tn_symbol = "caml_grammar_get_id2"
-external get_param_pos : t -> n_symbol -> int = "caml_grammar_get_param_pos"
+val get_param_pos : n_symbol -> int
+external nil_symbol : t -> t_symbol = "caml_grammar_nil_id"
 val num_params : n_symbol -> int
 val num_children : [< t_type | n_type ] Node.t -> int
 external is_nil : t -> t_symbol -> bool = "caml_grammar_is_nil"
 
 val tag : t_symbol -> Tag.t
+val symbol : n_symbol -> int
 val tag_operations : t -> Tag.operations
 
 
-
 val load : string -> bool -> t