Moved Pos and Region to lib_utils so that source locations in lib_utils may use those.
This commit is contained in:
parent
5b577c1fa4
commit
e2ef15a9b9
@ -1,24 +1,24 @@
|
|||||||
type file_location = {
|
(* type file_location = { *)
|
||||||
filename : string ;
|
(* filename : string ; *)
|
||||||
start_line : int ;
|
(* start_line : int ; *)
|
||||||
start_column : int ;
|
(* start_column : int ; *)
|
||||||
end_line : int ;
|
(* end_line : int ; *)
|
||||||
end_column : int ;
|
(* end_column : int ; *)
|
||||||
}
|
(* } *)
|
||||||
|
|
||||||
type virtual_location = string
|
type virtual_location = string
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
| File of file_location
|
| File of Region.t (* file_location *)
|
||||||
| Virtual of virtual_location
|
| Virtual of virtual_location
|
||||||
|
|
||||||
let make (start_pos:Lexing.position) (end_pos:Lexing.position) : t =
|
let make (start_pos:Lexing.position) (end_pos:Lexing.position) : t =
|
||||||
let filename = start_pos.pos_fname in
|
(* TODO: give correct unicode offsets (the random number is here so
|
||||||
let start_line = start_pos.pos_lnum in
|
that searching for wrong souce locations appearing in messages
|
||||||
let end_line = end_pos.pos_lnum in
|
will quickly lead here *)
|
||||||
let start_column = start_pos.pos_cnum - start_pos.pos_bol in
|
File (Region.make
|
||||||
let end_column = end_pos.pos_cnum - end_pos.pos_bol in
|
~start:(Pos.make ~byte:start_pos ~point_num:(-1897000) ~point_bol:(-1897000))
|
||||||
File { filename ; start_line ; start_column ; end_line ; end_column }
|
~stop:(Pos.make ~byte:end_pos ~point_num:(-1897000) ~point_bol:(-1897000)))
|
||||||
|
|
||||||
let virtual_location s = Virtual s
|
let virtual_location s = Virtual s
|
||||||
let dummy = virtual_location "dummy"
|
let dummy = virtual_location "dummy"
|
||||||
|
@ -21,3 +21,5 @@ module Map = X_map
|
|||||||
module Dictionary = Dictionary
|
module Dictionary = Dictionary
|
||||||
module Environment = Environment
|
module Environment = Environment
|
||||||
module Tree = Tree
|
module Tree = Tree
|
||||||
|
module Region = Region
|
||||||
|
module Pos = Pos
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
aliased to [token].
|
aliased to [token].
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
module Region = Tezos_utils.Region
|
||||||
|
module Pos = Tezos_utils.Pos
|
||||||
|
|
||||||
type lexeme = string
|
type lexeme = string
|
||||||
|
|
||||||
(* TOKENS *)
|
(* TOKENS *)
|
||||||
|
@ -9,6 +9,8 @@ type lexeme = string
|
|||||||
|
|
||||||
let sprintf = Printf.sprintf
|
let sprintf = Printf.sprintf
|
||||||
|
|
||||||
|
module Region = Tezos_utils.Region
|
||||||
|
module Pos = Tezos_utils.Pos
|
||||||
module SMap = Utils.String.Map
|
module SMap = Utils.String.Map
|
||||||
module SSet = Utils.String.Set
|
module SSet = Utils.String.Set
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
module Region = Tezos_utils.Region
|
||||||
|
|
||||||
type lexeme = string
|
type lexeme = string
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
(* This module defines the sorts of markup recognised by the LIGO
|
(* This module defines the sorts of markup recognised by the LIGO
|
||||||
lexer *)
|
lexer *)
|
||||||
|
|
||||||
|
module Region = Tezos_utils.Region
|
||||||
|
|
||||||
(* A lexeme is piece of concrete syntax belonging to a token. In
|
(* A lexeme is piece of concrete syntax belonging to a token. In
|
||||||
algebraic terms, a token is also a piece of abstract lexical
|
algebraic terms, a token is also a piece of abstract lexical
|
||||||
syntax. Lexical units emcompass both markup and lexemes. *)
|
syntax. Lexical units emcompass both markup and lexemes. *)
|
||||||
|
Loading…
Reference in New Issue
Block a user