File: code_matcher.mli

package info (click to toggle)
ppxlib 0.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,284 kB
  • sloc: ml: 17,184; sh: 149; makefile: 36; python: 36
file content (26 lines) | stat: -rw-r--r-- 666 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(** Match source code against generated code *)

open! Import

(** Checks that the given code starts with [expected] followed by [@@@deriving.end] or
    [@@@end].

    Raises if there is no [@@@deriving.end].

    If some items don't match, it calls [mismatch_handler] with the location of the source
    items and the expected code.
*)
val match_structure
  :  pos:Lexing.position
  -> expected:structure
  -> mismatch_handler:(Location.t -> structure -> unit)
  -> structure
  -> unit

(** Same for signatures *)
val match_signature
  :  pos:Lexing.position
  -> expected:signature
  -> mismatch_handler:(Location.t -> signature -> unit)
  -> signature
  -> unit