Skip to content

Commit c30be56

Browse files
committed
replay conditional compilation
1 parent edd8a7d commit c30be56

File tree

2 files changed

+603
-2
lines changed

2 files changed

+603
-2
lines changed

parsing/lexer.mli

+24
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ val init : unit -> unit
1919
val token: Lexing.lexbuf -> Parser.token
2020
val skip_hash_bang: Lexing.lexbuf -> unit
2121

22+
type directive_type
23+
2224
type error =
2325
| Illegal_character of char
2426
| Illegal_escape of string
@@ -28,6 +30,14 @@ type error =
2830
| Keyword_as_label of string
2931
| Invalid_literal of string
3032
| Invalid_directive of string * string option
33+
| Unterminated_paren_in_conditional
34+
| Unterminated_if
35+
| Unterminated_else
36+
| Unexpected_token_in_conditional
37+
| Expect_hash_then_in_conditional
38+
| Illegal_semver of string
39+
| Unexpected_directive
40+
| Conditional_expr_expected_type of directive_type * directive_type
3141
;;
3242

3343
exception Error of error * Location.t
@@ -61,3 +71,17 @@ val set_preprocessor :
6171
(unit -> unit) ->
6272
((Lexing.lexbuf -> Parser.token) -> Lexing.lexbuf -> Parser.token) ->
6373
unit
74+
75+
(** semantic version predicate *)
76+
val semver : Location.t -> string -> string -> bool
77+
78+
val filter_directive_from_lexbuf : Lexing.lexbuf -> (int * int) list
79+
80+
val replace_directive_int : string -> int -> unit
81+
val replace_directive_string : string -> string -> unit
82+
val replace_directive_bool : string -> bool -> unit
83+
val remove_directive_built_in_value : string -> unit
84+
85+
(** @return false means failed to define *)
86+
val define_key_value : string -> string -> bool
87+
val list_variables : Format.formatter -> unit

0 commit comments

Comments
 (0)