let rec uri lexbuf =
__ocaml_lex_uri_rec lexbuf 0
and __ocaml_lex_uri_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 108 "urilex.mll"
scheme
# 6681 "urilex.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos (lexbuf.Lexing.lex_curr_pos + -1) in
# 109 "urilex.mll"
(
let (authority_opt, (path, (query, fragment))) =
hier_part_qf lexbuf in
{ scheme = Some scheme
; authority = authority_opt
; path = path
; query = query
; fragment = fragment
}
)
# 6695 "urilex.ml"
| 1 ->
# 121 "urilex.mll"
(
let (path, (query, fragment)) =
path_query_fragment lexbuf
in
{ scheme = None
; authority = None
; path = path
; query = query
; fragment = fragment
}
)
# 6710 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_uri_rec lexbuf __ocaml_lex_state
and hier_part_qf lexbuf =
__ocaml_lex_hier_part_qf_rec lexbuf 3
and __ocaml_lex_hier_part_qf_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 135 "urilex.mll"
(
authority_path_abempty_qf lexbuf
)
# 6724 "urilex.ml"
| 1 ->
# 140 "urilex.mll"
(
(None, path_query_fragment lexbuf)
)
# 6731 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_hier_part_qf_rec lexbuf __ocaml_lex_state
and path_query_fragment lexbuf =
__ocaml_lex_path_query_fragment_rec lexbuf 6
and __ocaml_lex_path_query_fragment_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 145 "urilex.mll"
path
# 6743 "urilex.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 146 "urilex.mll"
( (path, query_fragment lexbuf)
)
# 6748 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_path_query_fragment_rec lexbuf __ocaml_lex_state
and host_portopt lexbuf =
lexbuf.Lexing.lex_mem <- Array.create 18 (-1) ;
lexbuf.Lexing.lex_mem.(11) <- lexbuf.Lexing.lex_curr_pos ;
lexbuf.Lexing.lex_mem.(10) <- lexbuf.Lexing.lex_curr_pos ;
lexbuf.Lexing.lex_mem.(9) <- lexbuf.Lexing.lex_curr_pos ;
__ocaml_lex_host_portopt_rec lexbuf 20
and __ocaml_lex_host_portopt_rec lexbuf __ocaml_lex_state =
match Lexing.new_engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 150 "urilex.mll"
is_lit
# 6764 "urilex.ml"
= Lexing.sub_lexeme_opt lexbuf lexbuf.Lexing.lex_mem.(4) lexbuf.Lexing.lex_mem.(3)
and
# 151 "urilex.mll"
is_ipv4
# 6769 "urilex.ml"
= Lexing.sub_lexeme_opt lexbuf lexbuf.Lexing.lex_mem.(2) lexbuf.Lexing.lex_mem.(1)
and
# 152 "urilex.mll"
is_reg_name
# 6774 "urilex.ml"
= Lexing.sub_lexeme_opt lexbuf lexbuf.Lexing.lex_mem.(6) lexbuf.Lexing.lex_mem.(5)
and
# 154 "urilex.mll"
host
# 6779 "urilex.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_mem.(0)
and
# 156 "urilex.mll"
port_opt_txt
# 6784 "urilex.ml"
= Lexing.sub_lexeme_opt lexbuf lexbuf.Lexing.lex_mem.(8) lexbuf.Lexing.lex_mem.(7) in
# 157 "urilex.mll"
(
let host_kind =
(match (is_lit, is_ipv4, is_reg_name) with
Some _, None, None -> IP_literal
| None, Some _, None -> IPv4address
| None, None, Some _ -> Reg_name
| _ -> assert false
)
in
let port_opt =
(match port_opt_txt with
None -> None
| Some txt ->
if txt = ""
then None
else (try Some (int_of_string txt) with _ -> None)
)
in
(host_kind, host, port_opt)
)
# 6808 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_host_portopt_rec lexbuf __ocaml_lex_state
and authority_path_abempty_qf lexbuf =
lexbuf.Lexing.lex_mem <- Array.create 4 (-1) ;
lexbuf.Lexing.lex_mem.(3) <- lexbuf.Lexing.lex_curr_pos ;
lexbuf.Lexing.lex_mem.(2) <- lexbuf.Lexing.lex_curr_pos ;
__ocaml_lex_authority_path_abempty_qf_rec lexbuf 555
and __ocaml_lex_authority_path_abempty_qf_rec lexbuf __ocaml_lex_state =
match Lexing.new_engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 180 "urilex.mll"
userinfo_opt
# 6823 "urilex.ml"
= Lexing.sub_lexeme_opt lexbuf lexbuf.Lexing.lex_mem.(1) lexbuf.Lexing.lex_mem.(0) in
# 181 "urilex.mll"
(
let (host_kind, host, port_opt) = host_portopt lexbuf in
let path = path_abempty_qf lexbuf in
( Some
{ host_kind = host_kind
; host = host
; port = port_opt
; userinfo = userinfo_opt
}
, path
)
)
# 6838 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_authority_path_abempty_qf_rec lexbuf __ocaml_lex_state
and path_abempty_qf lexbuf =
__ocaml_lex_path_abempty_qf_rec lexbuf 560
and __ocaml_lex_path_abempty_qf_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 197 "urilex.mll"
( let path = Lexing.lexeme lexbuf in
(path, query_fragment lexbuf)
)
# 6851 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_path_abempty_qf_rec lexbuf __ocaml_lex_state
and query_fragment lexbuf =
lexbuf.Lexing.lex_mem <- Array.create 4 (-1) ; __ocaml_lex_query_fragment_rec lexbuf 564
and __ocaml_lex_query_fragment_rec lexbuf __ocaml_lex_state =
match Lexing.new_engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 202 "urilex.mll"
query_opt
# 6863 "urilex.ml"
= Lexing.sub_lexeme_opt lexbuf lexbuf.Lexing.lex_mem.(1) lexbuf.Lexing.lex_mem.(0) in
# 203 "urilex.mll"
( (query_opt, fragment lexbuf) )
# 6867 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_query_fragment_rec lexbuf __ocaml_lex_state
and fragment lexbuf =
lexbuf.Lexing.lex_mem <- Array.create 4 (-1) ; __ocaml_lex_fragment_rec lexbuf 568
and __ocaml_lex_fragment_rec lexbuf __ocaml_lex_state =
match Lexing.new_engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 206 "urilex.mll"
fragment_opt
# 6879 "urilex.ml"
= Lexing.sub_lexeme_opt lexbuf lexbuf.Lexing.lex_mem.(1) lexbuf.Lexing.lex_mem.(0) in
# 207 "urilex.mll"
( fragment_opt )
# 6883 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_fragment_rec lexbuf __ocaml_lex_state
and dump_rest lexbuf =
__ocaml_lex_dump_rest_rec lexbuf 572
and __ocaml_lex_dump_rest_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 248 "urilex.mll"
s
# 6895 "urilex.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 249 "urilex.mll"
( s )
# 6899 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_dump_rest_rec lexbuf __ocaml_lex_state
and content_type lexbuf =
lexbuf.Lexing.lex_mem <- Array.create 4 (-1) ; __ocaml_lex_content_type_rec lexbuf 573
and __ocaml_lex_content_type_rec lexbuf __ocaml_lex_state =
match Lexing.new_engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 253 "urilex.mll"
( content_type lexbuf )
# 6910 "urilex.ml"
| 1 ->
let
# 254 "urilex.mll"
mtype
# 6916 "urilex.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_mem.(0)
and
# 254 "urilex.mll"
msubtype
# 6921 "urilex.ml"
= Lexing.sub_lexeme lexbuf (lexbuf.Lexing.lex_mem.(0) + 1) lexbuf.Lexing.lex_mem.(1) in
# 255 "urilex.mll"
( try
let pars = parameters [] lexbuf in
`Ok (mtype, msubtype, pars)
with
| Failure msg -> `Error msg
| e -> `Error (Printexc.to_string e)
)
# 6931 "urilex.ml"
| 2 ->
# 264 "urilex.mll"
( `Error (Printf.sprintf "bad Content-Type: %S" (dump_rest lexbuf)) )
# 6936 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_content_type_rec lexbuf __ocaml_lex_state
and parameters acc lexbuf =
__ocaml_lex_parameters_rec acc lexbuf 579
and __ocaml_lex_parameters_rec acc lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 268 "urilex.mll"
( List.rev acc )
# 6947 "urilex.ml"
| 1 ->
# 270 "urilex.mll"
( let p = parameter lexbuf in
parameters (p :: acc) lexbuf
)
# 6954 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_parameters_rec acc lexbuf __ocaml_lex_state
and parameter lexbuf =
lexbuf.Lexing.lex_mem <- Array.create 2 (-1) ; __ocaml_lex_parameter_rec lexbuf 581
and __ocaml_lex_parameter_rec lexbuf __ocaml_lex_state =
match Lexing.new_engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 275 "urilex.mll"
par_name
# 6966 "urilex.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_mem.(0) (lexbuf.Lexing.lex_curr_pos + -1) in
# 276 "urilex.mll"
( let v = parameter_value lexbuf in
(par_name, v)
)
# 6972 "urilex.ml"
| 1 ->
# 281 "urilex.mll"
( failwith "expected parameter, found %S" (dump_rest lexbuf) )
# 6977 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_parameter_rec lexbuf __ocaml_lex_state
and parameter_value lexbuf =
lexbuf.Lexing.lex_mem <- Array.create 2 (-1) ; __ocaml_lex_parameter_value_rec lexbuf 585
and __ocaml_lex_parameter_value_rec lexbuf __ocaml_lex_state =
match Lexing.new_engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 284 "urilex.mll"
t
# 6989 "urilex.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_mem.(0) in
# 285 "urilex.mll"
( t )
# 6993 "urilex.ml"
| 1 ->
# 287 "urilex.mll"
( inside_quoted_string (Buffer.create 40) lexbuf )
# 6998 "urilex.ml"
| 2 ->
# 289 "urilex.mll"
( failwith "expected parameter's value, found %S" (dump_rest lexbuf) )
# 7003 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_parameter_value_rec lexbuf __ocaml_lex_state
and inside_quoted_string buf lexbuf =
__ocaml_lex_inside_quoted_string_rec buf lexbuf 589
and __ocaml_lex_inside_quoted_string_rec buf lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 293 "urilex.mll"
( Buffer.contents buf )
# 7014 "urilex.ml"
| 1 ->
# 295 "urilex.mll"
( let c = escaped_char lexbuf in
let () = Buffer.add_char buf c in
inside_quoted_string buf lexbuf
)
# 7022 "urilex.ml"
| 2 ->
let
# 299 "urilex.mll"
txt
# 7028 "urilex.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 300 "urilex.mll"
( let () = Buffer.add_string buf txt in
inside_quoted_string buf lexbuf
)
# 7034 "urilex.ml"
| 3 ->
# 304 "urilex.mll"
( failwith "expected HTTP's TEXT, found %S" (dump_rest lexbuf) )
# 7039 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_inside_quoted_string_rec buf lexbuf __ocaml_lex_state
and escaped_char lexbuf =
__ocaml_lex_escaped_char_rec lexbuf 593
and __ocaml_lex_escaped_char_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 307 "urilex.mll"
c
# 7051 "urilex.ml"
= Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
# 308 "urilex.mll"
( c )
# 7055 "urilex.ml"
| 1 ->
let
# 309 "urilex.mll"
c
# 7061 "urilex.ml"
= Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
# 310 "urilex.mll"
( failwith "expected \\x00..\\x7F after backslash, found %C" c )
# 7065 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_escaped_char_rec lexbuf __ocaml_lex_state
and cookie_string lexbuf =
__ocaml_lex_cookie_string_rec lexbuf 596
and __ocaml_lex_cookie_string_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 317 "urilex.mll"
( cookie_pair [] lexbuf )
# 7076 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_cookie_string_rec lexbuf __ocaml_lex_state
and cookie_pair acc lexbuf =
__ocaml_lex_cookie_pair_rec acc lexbuf 597
and __ocaml_lex_cookie_pair_rec acc lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 320 "urilex.mll"
cn
# 7088 "urilex.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos (lexbuf.Lexing.lex_curr_pos + -1) in
# 321 "urilex.mll"
( let cv = cookie_value lexbuf in
cookie_pair_cont ((cn, cv) :: acc) lexbuf
)
# 7094 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_cookie_pair_rec acc lexbuf __ocaml_lex_state
and cookie_pair_cont acc lexbuf =
__ocaml_lex_cookie_pair_cont_rec acc lexbuf 600
and __ocaml_lex_cookie_pair_cont_rec acc lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 327 "urilex.mll"
( List.rev acc )
# 7105 "urilex.ml"
| 1 ->
# 329 "urilex.mll"
( cookie_pair acc lexbuf )
# 7110 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_cookie_pair_cont_rec acc lexbuf __ocaml_lex_state
and cookie_name lexbuf =
__ocaml_lex_cookie_name_rec lexbuf 605
and __ocaml_lex_cookie_name_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 333 "urilex.mll"
( Lexing.lexeme lexbuf )
# 7121 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_cookie_name_rec lexbuf __ocaml_lex_state
and cookie_value lexbuf =
__ocaml_lex_cookie_value_rec lexbuf 607
and __ocaml_lex_cookie_value_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 336 "urilex.mll"
v
# 7133 "urilex.ml"
= Lexing.sub_lexeme lexbuf (lexbuf.Lexing.lex_start_pos + 1) (lexbuf.Lexing.lex_curr_pos + -1) in
# 337 "urilex.mll"
( v )
# 7137 "urilex.ml"
| 1 ->
let
# 338 "urilex.mll"
v
# 7143 "urilex.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 339 "urilex.mll"
( v )
# 7147 "urilex.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_cookie_value_rec lexbuf __ocaml_lex_state