summaryrefslogtreecommitdiff
path: root/src/util.ml
blob: 9ce93877ceee037643e61a40072c48cad2137106 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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)

let default default_value opt =
  match opt with
  | None -> default_value
  | Some value -> value