diff options
| author | Enrico Tassi | 2019-03-25 17:31:55 +0100 |
|---|---|---|
| committer | Enrico Tassi | 2019-03-29 11:05:17 +0100 |
| commit | 7eba2dfda86238cb0941edfd7aafb09f566c36d8 (patch) | |
| tree | 9c1017c90e17d4fc98ecb144ff99d4c8553c1e51 /lib | |
| parent | 4b9636ffd47ea5a0b99df442047ba03d18422738 (diff) | |
[parser] initialization based on Loc.t rather than Loc.source
In this way one can also set the current offsets in a file,
useful if you are parsing a Coq fragment within a file instead
of a full file starting from the first line.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/loc.ml | 2 | ||||
| -rw-r--r-- | lib/loc.mli | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/loc.ml b/lib/loc.ml index 66b7a7da70..6bcdcc0341 100644 --- a/lib/loc.ml +++ b/lib/loc.ml @@ -29,6 +29,8 @@ let create fname line_nb bol_pos bp ep = { line_nb_last = line_nb; bol_pos_last = bol_pos; bp = bp; ep = ep; } +let initial source = create source 1 0 0 0 + let make_loc (bp, ep) = { fname = ToplevelInput; line_nb = -1; bol_pos = 0; line_nb_last = -1; bol_pos_last = 0; bp = bp; ep = ep; diff --git a/lib/loc.mli b/lib/loc.mli index 23df1ebd9a..1eb3cc49e8 100644 --- a/lib/loc.mli +++ b/lib/loc.mli @@ -32,6 +32,9 @@ val create : source -> int -> int -> int -> int -> t (** Create a location from a filename, a line number, a position of the beginning of the line, a start and end position *) +val initial : source -> t +(** Create a location corresponding to the beginning of the given source *) + val unloc : t -> int * int (** Return the start and end position of a location *) |
