summary refs log tree commit diff
path: root/source/xi_lib/parser_utils.ml
diff options
context:
space:
mode:
authorPaweł Dybiec <pdybiec@stud.cs.uni.wroc.pl>2018-10-30 15:32:56 +0100
committerPaweł Dybiec <pdybiec@stud.cs.uni.wroc.pl>2018-10-30 15:32:56 +0100
commitb798ac29c37299b2f761243ae92ab8f7c4c4d7f1 (patch)
treeeb9b9cc9be294fe5bd3acf9a342098ffc0ea06e5 /source/xi_lib/parser_utils.ml
Initial commit
Diffstat (limited to 'source/xi_lib/parser_utils.ml')
-rw-r--r--source/xi_lib/parser_utils.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/xi_lib/parser_utils.ml b/source/xi_lib/parser_utils.ml
new file mode 100644
index 0000000..0600d8b
--- /dev/null
+++ b/source/xi_lib/parser_utils.ml
@@ -0,0 +1,7 @@
+exception InvalidToken of Ast.location * string
+
+let mkLocation pos = 
+    let line   = pos.Lexing.pos_lnum in
+    let column = pos.Lexing.pos_cnum - pos.Lexing.pos_bol + 1 in
+    let file   = pos.Lexing.pos_fname in
+    Ast.Location {line; column; file}
\ No newline at end of file