2020-03-25 00:05:39 +04:00
|
|
|
(* The main module of the preprocessor (see [lex]) *)
|
|
|
|
|
|
|
|
(* Regions *)
|
|
|
|
|
|
|
|
module Region = Simple_utils.Region
|
|
|
|
|
|
|
|
val mk_reg : Lexing.lexbuf -> Region.t
|
|
|
|
|
|
|
|
(* Errors *)
|
|
|
|
|
|
|
|
type error =
|
2020-04-03 21:06:35 +04:00
|
|
|
Directive_inside_line
|
2020-03-25 00:05:39 +04:00
|
|
|
| Missing_endif
|
|
|
|
| Invalid_line_indicator of string
|
|
|
|
| No_line_indicator
|
|
|
|
| End_line_indicator
|
2020-04-09 18:18:26 +04:00
|
|
|
| Newline_in_string (* For #include argument only *)
|
|
|
|
| Open_string (* For #include argument only *)
|
2020-03-25 00:05:39 +04:00
|
|
|
| Dangling_endif
|
|
|
|
| Open_region_in_conditional
|
|
|
|
| Dangling_endregion
|
|
|
|
| Conditional_in_region
|
|
|
|
| If_follows_elif
|
|
|
|
| Else_follows_else
|
|
|
|
| Dangling_else
|
|
|
|
| Elif_follows_else
|
|
|
|
| Dangling_elif
|
|
|
|
| Reserved_symbol of string
|
|
|
|
| Multiply_defined_symbol of string
|
|
|
|
| Error_directive of string
|
|
|
|
| Parse_error
|
|
|
|
| No_line_comment_or_blank
|
|
|
|
| Invalid_symbol
|
2020-03-25 21:52:23 +04:00
|
|
|
| File_not_found of string
|
2020-03-26 19:51:08 +04:00
|
|
|
| Invalid_character of char
|
2020-03-25 00:05:39 +04:00
|
|
|
|
|
|
|
val format :
|
|
|
|
?offsets:bool -> error Region.reg -> file:bool -> string Region.reg
|
|
|
|
|
2020-03-26 19:51:08 +04:00
|
|
|
(* Preprocessing a lexing buffer *)
|
2020-03-25 00:05:39 +04:00
|
|
|
|
2020-03-26 19:51:08 +04:00
|
|
|
val lex :
|
|
|
|
EvalOpt.options ->
|
|
|
|
Lexing.lexbuf ->
|
|
|
|
(Buffer.t, Buffer.t * error Region.reg) Stdlib.result
|
2020-03-25 00:05:39 +04:00
|
|
|
|
|
|
|
(* Evaluation of boolean expressions *)
|
|
|
|
|
|
|
|
module Env : Set.S with type elt = string
|
|
|
|
|
|
|
|
val eval : Env.t -> E_AST.t -> bool
|