stretch.mli 1.96 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
(******************************************************************************)
(*                                                                            *)
(*                                   Menhir                                   *)
(*                                                                            *)
(*                       François Pottier, Inria Paris                        *)
(*              Yann Régis-Gianas, PPS, Université Paris Diderot              *)
(*                                                                            *)
(*  Copyright Inria. All rights reserved. This file is distributed under the  *)
(*  terms of the GNU General Public License version 2, as described in the    *)
(*  file LICENSE.                                                             *)
(*                                                                            *)
(******************************************************************************)

14
15
16
17
18
19
20
(* A stretch is a fragment of a source file. It holds the file name,
   the line number, and the line count (that is, the length) of the
   fragment. These are used for generating #line directives when the
   fragment is copied to an output file. It also holds the textual
   content of the fragment, as a string. The [raw_content] field holds
   the text that was found in the source file, while the [content]
   field holds the same text after transformation by the lexer (which
21
22
   may substitute keywords, insert padding, insert parentheses, etc.).
   See [Lexer.mk_stretch] and its various call sites in [Lexer]. *)
23
24

type t = {
25
26
27
28
29
30
    stretch_filename    : string;
    stretch_linenum     : int;
    stretch_linecount   : int;
    stretch_raw_content : string;
    stretch_content     : string;
    stretch_keywords    : Keyword.keyword list
POTTIER Francois's avatar
POTTIER Francois committed
31
  }
32

33
(* An OCaml type is either a stretch (if it was found in some
34
35
36
37
38
39
   source file) or a string (if it was inferred via [Infer]). *)

type ocamltype =
  | Declared of t
  | Inferred of string