~ubuntu-branches/ubuntu/trusty/sexplib310/trusty

« back to all changes in this revision

Viewing changes to lib/type_with_layout.mli

  • Committer: Package Import Robot
  • Author(s): Stéphane Glondu
  • Date: 2013-12-03 21:36:45 UTC
  • mfrom: (11.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20131203213645-h1if1c6hxual8p11
Tags: 109.20.00-2
* Team upload
* Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(** S-expressions annotated with relative source positions and comments *)
 
2
 
 
3
module Make (Pos : sig type t val sexp_of_t : t -> Type.t end) : sig
 
4
  module type S = sig
 
5
    (** S-expressions annotated with relative source positions and comments *)
 
6
    type t =
 
7
      | Atom of Pos.t * string * string option (* optional quoted representation *)
 
8
      | List of Pos.t * t_or_comment list * Pos.t (* left & right paren positions *)
 
9
    and t_or_comment =
 
10
      | Sexp of t
 
11
      | Comment of comment
 
12
    and comment =
 
13
      | Plain_comment of Pos.t * string (* line or block comment *)
 
14
      | Sexp_comment of Pos.t * comment list * t (* #! position *)
 
15
 
 
16
    val sexp_of_t : t -> Type.t
 
17
    val sexp_of_comment : comment -> Type.t
 
18
    val sexp_of_t_or_comment : t_or_comment -> Type.t
 
19
  end
 
20
end
 
21
 
 
22
module Parsed : Make(Src_pos.Absolute).S (** parsing produces absolute positions *)
 
23
 
 
24
include Make(Src_pos.Relative).S (* the exposed type contains relative positions *)
 
25
 
 
26
val relativize : Parsed.t_or_comment -> t_or_comment
 
27