diff options
author | Daniil Baturin <daniil@baturin.org> | 2019-06-30 02:17:45 +0700 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2019-06-30 04:03:03 +0700 |
commit | b280bab4edd89733d364e87adfb8a1e7e5f1b302 (patch) | |
tree | bfd9fed1a8e68b55ce514471419002a388ad7509 /src/util.ml | |
parent | aa3d09c3fff12e379fd189ceaf55644574ff5c43 (diff) | |
download | vyos1x-config-b280bab4edd89733d364e87adfb8a1e7e5f1b302.tar.gz vyos1x-config-b280bab4edd89733d364e87adfb8a1e7e5f1b302.zip |
T1478: Improved lexing error reporting, including proper support for single quoted strings.
Diffstat (limited to 'src/util.ml')
-rw-r--r-- | src/util.ml | 8 |
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 |