Skip to content
Snippets Groups Projects
lxm.mli 1.13 KiB
(** Time-stamp: <modified the 30/05/2008 (at 15:42) by Erwan Jahier> *)

(** Common to lus2lic and lic2loc  *)

(** Lexeme  *)

type t

val dummy : string -> t

val str    : t -> string
val id     : t -> Ident.t
val line   : t -> int 
val file   : t -> string

(** column numbers *)
val cstart : t -> int
val cend   : t -> int


(** lexer/parser interface
    
    In order to able to compute line and colums numbers, 
    the lexer is supposed to:
    - use Lxm.make to return a lexeme to the parser
    - use newline to add a new line 
*)
val make     : Lexing.lexbuf -> t
val new_line : Lexing.lexbuf -> unit

(* remove the quotes from the string *)
val make_string: Lexing.lexbuf -> t


(** compiler interface *)

(** used to attach a source information to a lexeme *)
type 'a srcflagged = { src : t ; it  : 'a }

val flagit : 'a -> t -> 'a srcflagged

(** Returns the last created lexem. Useful to locate syntax errors. *)
val last_made : unit -> t

(** Erreur/Warning printing *)

val details : t -> string
(** prints something like: 'machin' (line:10, col:3 to 7) *)

val position : t -> string
(** prints something like: line:10, col:3 to 7 *)