let rec main buf lexbuf =
__ocaml_lex_main_rec buf lexbuf 0
and __ocaml_lex_main_rec buf lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 100 "utils/SExprLexer.mll"
( found_newline lexbuf 0; main buf lexbuf )
# 282 "utils/SExprLexer.ml"
| 1 ->
# 101 "utils/SExprLexer.mll"
( main buf lexbuf )
# 287 "utils/SExprLexer.ml"
| 2 ->
# 102 "utils/SExprLexer.mll"
( LPAREN )
# 292 "utils/SExprLexer.ml"
| 3 ->
# 103 "utils/SExprLexer.mll"
( RPAREN )
# 297 "utils/SExprLexer.ml"
| 4 ->
# 105 "utils/SExprLexer.mll"
(
scan_string buf (lexeme_start_p lexbuf) lexbuf;
let str = Buffer.contents buf in
Buffer.clear buf;
STRING (HString.mk_hstring str)
)
# 307 "utils/SExprLexer.ml"
| 5 ->
# 111 "utils/SExprLexer.mll"
( HASH_SEMI )
# 312 "utils/SExprLexer.ml"
| 6 ->
# 113 "utils/SExprLexer.mll"
(
scan_block_comment buf [lexeme_start_p lexbuf] lexbuf;
main buf lexbuf
)
# 320 "utils/SExprLexer.ml"
| 7 ->
# 117 "utils/SExprLexer.mll"
( main_failure lexbuf "illegal end of comment" )
# 325 "utils/SExprLexer.ml"
| 8 ->
# 119 "utils/SExprLexer.mll"
(
scan_quoted buf (lexeme_start_p lexbuf) lexbuf;
let str = Buffer.contents buf in
Buffer.clear buf;
STRING (HString.mk_hstring ("|"^ str ^"|"))
)
# 335 "utils/SExprLexer.ml"
| 9 ->
# 127 "utils/SExprLexer.mll"
( main_failure lexbuf "comment tokens in unquoted atom" )
# 340 "utils/SExprLexer.ml"
| 10 ->
let
# 128 "utils/SExprLexer.mll"
str
# 346 "utils/SExprLexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 128 "utils/SExprLexer.mll"
( STRING (HString.mk_hstring str) )
# 350 "utils/SExprLexer.ml"
| 11 ->
# 130 "utils/SExprLexer.mll"
( EOF )
# 355 "utils/SExprLexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_main_rec buf lexbuf __ocaml_lex_state
and scan_string buf start lexbuf =
__ocaml_lex_scan_string_rec buf start lexbuf 19
and __ocaml_lex_scan_string_rec buf start lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 133 "utils/SExprLexer.mll"
( () )
# 367 "utils/SExprLexer.ml"
| 1 ->
# 135 "utils/SExprLexer.mll"
(
found_newline lexbuf (lexeme_len lexbuf - 2);
scan_string buf start lexbuf
)
# 375 "utils/SExprLexer.ml"
| 2 ->
# 140 "utils/SExprLexer.mll"
(
found_newline lexbuf (lexeme_len lexbuf - 3);
scan_string buf start lexbuf
)
# 383 "utils/SExprLexer.ml"
| 3 ->
let
# 144 "utils/SExprLexer.mll"
c
# 389 "utils/SExprLexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 1) in
# 145 "utils/SExprLexer.mll"
(
Buffer.add_char buf (char_for_backslash c);
scan_string buf start lexbuf
)
# 396 "utils/SExprLexer.ml"
| 4 ->
let
# 149 "utils/SExprLexer.mll"
c1
# 402 "utils/SExprLexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 1)
and
# 149 "utils/SExprLexer.mll"
c2
# 407 "utils/SExprLexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 2)
and
# 149 "utils/SExprLexer.mll"
c3
# 412 "utils/SExprLexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 3) in
# 150 "utils/SExprLexer.mll"
(
let v = dec_code c1 c2 c3 in
if v > 255 then (
let { pos_lnum; pos_bol; pos_cnum; _ } = lexeme_end_p lexbuf in
let msg =
sprintf
"Sexplib.Lexer.scan_string: illegal escape at line %d char %d: `\\%c%c%c'"
pos_lnum (pos_cnum - pos_bol - 3)
c1 c2 c3 in
failwith msg);
Buffer.add_char buf (Char.chr v);
scan_string buf start lexbuf
)
# 429 "utils/SExprLexer.ml"
| 5 ->
let
# 164 "utils/SExprLexer.mll"
c1
# 435 "utils/SExprLexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 2)
and
# 164 "utils/SExprLexer.mll"
c2
# 440 "utils/SExprLexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 3) in
# 165 "utils/SExprLexer.mll"
(
let v = hex_code c1 c2 in
Buffer.add_char buf (Char.chr v);
scan_string buf start lexbuf
)
# 448 "utils/SExprLexer.ml"
| 6 ->
let
# 170 "utils/SExprLexer.mll"
c
# 454 "utils/SExprLexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 1) in
# 171 "utils/SExprLexer.mll"
(
Buffer.add_char buf '\\';
Buffer.add_char buf c;
scan_string buf start lexbuf
)
# 462 "utils/SExprLexer.ml"
| 7 ->
# 177 "utils/SExprLexer.mll"
(
found_newline lexbuf 0;
Buffer.add_char buf lf;
scan_string buf start lexbuf
)
# 471 "utils/SExprLexer.ml"
| 8 ->
# 183 "utils/SExprLexer.mll"
(
Buffer.add_string buf (lexeme lexbuf);
scan_string buf start lexbuf
)
# 479 "utils/SExprLexer.ml"
| 9 ->
# 188 "utils/SExprLexer.mll"
(
let msg =
sprintf
"Sexplib.Lexer.scan_string: unterminated string at line %d char %d"
start.pos_lnum (start.pos_cnum - start.pos_bol)
in
failwith msg
)
# 491 "utils/SExprLexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_scan_string_rec buf start lexbuf __ocaml_lex_state
and scan_quoted buf start lexbuf =
__ocaml_lex_scan_quoted_rec buf start lexbuf 36
and __ocaml_lex_scan_quoted_rec buf start lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 198 "utils/SExprLexer.mll"
( () )
# 503 "utils/SExprLexer.ml"
| 1 ->
# 200 "utils/SExprLexer.mll"
(
found_newline lexbuf (lexeme_len lexbuf - 2);
scan_quoted buf start lexbuf
)
# 511 "utils/SExprLexer.ml"
| 2 ->
# 205 "utils/SExprLexer.mll"
(
found_newline lexbuf (lexeme_len lexbuf - 3);
scan_quoted buf start lexbuf
)
# 519 "utils/SExprLexer.ml"
| 3 ->
let
# 209 "utils/SExprLexer.mll"
c
# 525 "utils/SExprLexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 1) in
# 210 "utils/SExprLexer.mll"
(
Buffer.add_char buf (char_for_backslash c);
scan_quoted buf start lexbuf
)
# 532 "utils/SExprLexer.ml"
| 4 ->
let
# 214 "utils/SExprLexer.mll"
c1
# 538 "utils/SExprLexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 1)
and
# 214 "utils/SExprLexer.mll"
c2
# 543 "utils/SExprLexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 2)
and
# 214 "utils/SExprLexer.mll"
c3
# 548 "utils/SExprLexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 3) in
# 215 "utils/SExprLexer.mll"
(
let v = dec_code c1 c2 c3 in
if v > 255 then (
let { pos_lnum; pos_bol; pos_cnum; _ } = lexeme_end_p lexbuf in
let msg =
sprintf
"Sexplib.Lexer.scan_quoted: illegal escape at line %d char %d: `\\%c%c%c'"
pos_lnum (pos_cnum - pos_bol - 3)
c1 c2 c3 in
failwith msg);
Buffer.add_char buf (Char.chr v);
scan_quoted buf start lexbuf
)
# 565 "utils/SExprLexer.ml"
| 5 ->
let
# 229 "utils/SExprLexer.mll"
c1
# 571 "utils/SExprLexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 2)
and
# 229 "utils/SExprLexer.mll"
c2
# 576 "utils/SExprLexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 3) in
# 230 "utils/SExprLexer.mll"
(
let v = hex_code c1 c2 in
Buffer.add_char buf (Char.chr v);
scan_quoted buf start lexbuf
)
# 584 "utils/SExprLexer.ml"
| 6 ->
let
# 235 "utils/SExprLexer.mll"
c
# 590 "utils/SExprLexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 1) in
# 236 "utils/SExprLexer.mll"
(
Buffer.add_char buf '\\';
Buffer.add_char buf c;
scan_quoted buf start lexbuf
)
# 598 "utils/SExprLexer.ml"
| 7 ->
# 242 "utils/SExprLexer.mll"
(
found_newline lexbuf 0;
Buffer.add_char buf lf;
scan_quoted buf start lexbuf
)
# 607 "utils/SExprLexer.ml"
| 8 ->
# 248 "utils/SExprLexer.mll"
(
Buffer.add_string buf (lexeme lexbuf);
scan_quoted buf start lexbuf
)
# 615 "utils/SExprLexer.ml"
| 9 ->
# 253 "utils/SExprLexer.mll"
(
let msg =
sprintf
"Sexplib.Lexer.scan_quoted: unterminated ident at line %d char %d"
start.pos_lnum (start.pos_cnum - start.pos_bol)
in
failwith msg
)
# 627 "utils/SExprLexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_scan_quoted_rec buf start lexbuf __ocaml_lex_state
and scan_block_comment buf locs lexbuf =
__ocaml_lex_scan_block_comment_rec buf locs lexbuf 53
and __ocaml_lex_scan_block_comment_rec buf locs lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 264 "utils/SExprLexer.mll"
( found_newline lexbuf 0; scan_block_comment buf locs lexbuf )
# 639 "utils/SExprLexer.ml"
| 1 ->
# 265 "utils/SExprLexer.mll"
( scan_block_comment buf locs lexbuf )
# 644 "utils/SExprLexer.ml"
| 2 ->
# 267 "utils/SExprLexer.mll"
(
let cur = lexeme_end_p lexbuf in
let start = { cur with pos_cnum = cur.pos_cnum - 1 } in
scan_string buf start lexbuf;
Buffer.clear buf;
scan_block_comment buf locs lexbuf
)
# 655 "utils/SExprLexer.ml"
| 3 ->
# 275 "utils/SExprLexer.mll"
(
let cur = lexeme_end_p lexbuf in
let start = { cur with pos_cnum = cur.pos_cnum - 2 } in
scan_block_comment buf (start :: locs) lexbuf
)
# 664 "utils/SExprLexer.ml"
| 4 ->
# 281 "utils/SExprLexer.mll"
(
match locs with
| [_] -> ()
| _ :: t -> scan_block_comment buf t lexbuf
| [] -> assert false
)
# 674 "utils/SExprLexer.ml"
| 5 ->
# 288 "utils/SExprLexer.mll"
(
match locs with
| [] -> assert false
| { pos_lnum; pos_bol; pos_cnum; _ } :: _ ->
let msg =
sprintf "Sexplib.Lexer.scan_block_comment: unterminated block comment at line %d char %d"
pos_lnum (pos_cnum - pos_bol)
in
failwith msg
)
# 689 "utils/SExprLexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_scan_block_comment_rec buf locs lexbuf __ocaml_lex_state
and ruleTail acc lexbuf =
__ocaml_lex_ruleTail_rec acc lexbuf 64
and __ocaml_lex_ruleTail_rec acc lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 301 "utils/SExprLexer.mll"
( acc )
# 701 "utils/SExprLexer.ml"
| 1 ->
let
# 302 "utils/SExprLexer.mll"
str
# 707 "utils/SExprLexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 302 "utils/SExprLexer.mll"
( ruleTail (acc ^ str) lexbuf )
# 711 "utils/SExprLexer.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_ruleTail_rec acc lexbuf __ocaml_lex_state