package css-parser

  1. Overview
  2. Docs

A custom lexbuffer that automatically keeps track of the source location. This module is a thin wrapper arounds sedlexing's default buffer, which does not provide this functionality.

type t = {
  1. buf : Sedlexing.lexbuf;
  2. mutable pos : Stdlib.Lexing.position;
  3. mutable pos_mark : Stdlib.Lexing.position;
  4. mutable last_char : int option;
  5. mutable last_char_mark : int option;
}

the lex buffer type

val of_sedlex : ?file:string -> ?pos:Stdlib.Lexing.position -> Sedlexing.lexbuf -> t
val of_ascii_string : ?pos:Stdlib.Lexing.position -> string -> t
val of_ascii_file : string -> t
val mark : t -> int -> unit

The next four functions are used by sedlex internally. See https://www.lexifi.com/sedlex/libdoc/Sedlexing.html.

val backtrack : t -> int
val start : t -> unit
val next_loc : t -> Stdlib.Lexing.position

location of next character

val cr : int
val next : t -> Stdlib.Uchar.t option

next character

val raw : t -> Stdlib.Uchar.t array
val latin1 : ?skip:int -> ?drop:int -> t -> string
val utf8 : ?skip:int -> ?drop:int -> t -> string
val container_lnum_ref : int Stdlib.ref
val fix_loc : Location.t -> Location.t
val make_loc : ?loc_ghost:bool -> Stdlib.Lexing.position -> Stdlib.Lexing.position -> Location.t
val make_loc_and_fix : ?loc_ghost:bool -> Stdlib.Lexing.position -> Stdlib.Lexing.position -> Location.t
OCaml

Innovation. Community. Security.