e0/lib/util.ml
Michael Zhang e66b515826
Parsing
2022-03-08 02:52:20 -06:00

7 lines
256 B
OCaml

exception Syntax_error of ((int * int) option * string)
let get_lexing_position lexbuf =
let p = Lexing.lexeme_start_p lexbuf in
let line_number = p.Lexing.pos_lnum in
let column = p.Lexing.pos_cnum - p.Lexing.pos_bol + 1 in
(line_number, column)