@@ -69,17 +69,18 @@ type env = full_variable -> variable_contents option
69
69
self-reference [_] *)
70
70
type fident = name option list * variable * (string * string ) option
71
71
72
- (* * Maps on all variables appearing in a filter. The case where package
73
- variables are renamed differently and appear in a filter ident of the form
74
- [%{pkg1+pkg2:var}%] is not supported and raises [Invalid_argument]. *)
72
+ (* * Maps on all variables appearing in a filter.
73
+
74
+ @raise Invalid_argument when package variables are renamed differently and
75
+ appear in a filter ident of the form [%{pkg1+pkg2:var}%] *)
75
76
val map_variables : (full_variable -> full_variable ) -> filter -> filter
76
77
77
78
(* * Same limitation as [map_variables] *)
78
79
val map_variables_in_string :
79
80
(full_variable -> full_variable ) -> string -> string
80
81
81
- (* * Does not handle rewriting the variables to different names (which can't be
82
- expressed with a {!fident} anymore), and raises [Invalid_argument] *)
82
+ (* * @raise Invalid_argument when rewriting the variables to different names
83
+ (which can't be expressed with a {!fident} anymore) *)
83
84
val map_variables_in_fident :
84
85
(full_variable -> full_variable ) -> fident -> fident
85
86
@@ -88,25 +89,27 @@ val distribute_negations: ?neg:bool -> filter -> filter
88
89
89
90
(* * Rewrites string interpolations within a string. [default] is applied to the
90
91
fident string (e.g. what's between [%{] and [}%]) when the expansion is
91
- undefined. If unspecified, this raises [Failure].
92
+ undefined.
92
93
93
94
With [partial], [default] defaults to the identity, and is otherwise
94
95
expected to return a fident. In this case, the returned string is supposed
95
96
to be expanded again (expansion results are escaped, escapes are otherwise
96
- kept). This makes the function idempotent *)
97
+ kept). This makes the function idempotent.
98
+
99
+ @raise Failure if [default] is unspecified *)
97
100
val expand_string :
98
101
?partial : bool -> ?default : (string -> string ) -> env -> string -> string
99
102
100
103
(* * Returns the (beginning, end) offsets and substrings of any unclosed [%{]
101
104
expansions *)
102
105
val unclosed_expansions : string -> ((int * int ) * string ) list
103
106
104
- (* * Computes the value of a filter. May raise [Failure] if [default] isn't
105
- provided *)
107
+ (* * Computes the value of a filter.
108
+ @raise Failure if [default] isn't provided *)
106
109
val eval : ?default : variable_contents -> env -> filter -> variable_contents
107
110
108
- not a valid bool and no default supplied . *)
109
111
(* * Like {!eval} but casts the result to a bool.
112
+ @raise Invalid_argument if not a valid bool and no [default] supplied *)
110
113
val eval_to_bool : ?default : bool -> env -> filter -> bool
111
114
112
115
(* * Same as {!eval_to_bool}, but takes an option as filter and returns always
@@ -126,8 +129,8 @@ val ident_of_var: full_variable -> fident
126
129
(* * A fident accessor directly referring a variable with the given name *)
127
130
val ident_of_string : string -> fident
128
131
129
- (* * Resolves a filter ident. Like {!eval}, may raise Failure if no default is
130
- provided *)
132
+ (* * Resolves a filter ident.
133
+ @raise Failure if no default is provided, like {!eval} *)
131
134
val ident_value : ?default : variable_contents -> env -> fident -> variable_contents
132
135
133
136
(* * Like {!ident_value}, but casts the result to a string *)
@@ -170,8 +173,8 @@ val of_formula: ('a -> filter) -> 'a generic_formula -> filter
170
173
doesn't resolve to a valid version, the constraint is dropped unless
171
174
[default_version] is specified.
172
175
173
- May raise, as other filter functions, if [default] is not provided and
174
- filters don't resolve. *)
176
+ @ raise Invalid_argument as other filter functions, if [default] is not
177
+ provided and filters don't resolve *)
175
178
val filter_formula :
176
179
?default_version : version -> ?default : bool ->
177
180
env -> filtered_formula -> formula
0 commit comments