summaryrefslogtreecommitdiff
path: root/src/util.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.ml')
-rw-r--r--src/util.ml8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util.ml b/src/util.ml
index c2ec4c4..9ce9387 100644
--- a/src/util.ml
+++ b/src/util.ml
@@ -1,3 +1,11 @@
+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