77 ; authority : string
88 ; path : string
99 ; query : string option
10+ ; fragment : string option
1011 }
1112
1213let int_of_hex_char c =
@@ -84,7 +85,8 @@ and uri = parse
8485([^ ':' '/' '?' '#' ]+ as scheme ':' ) ?
8586(" //" ([^ '/' '?' '#' ]* as authority)) ?
8687([^ '?' '#' ]* as path)
87- (('?' ([^ '#' ]* as raw_query) '#' ?)) ?
88+ ('?' ([^ '#' ]* as raw_query)) ?
89+ ('#' (_ * as fragment)) ?
8890{
8991 let scheme = scheme |> Option. value ~default: " file" in
9092 let authority =
@@ -102,15 +104,15 @@ and uri = parse
102104 | None -> None
103105 | Some c -> Some (query (Buffer. create (String. length c)) (Lexing. from_string c))
104106 in
105- { scheme; authority; path; query }
107+ { scheme; authority; path; query; fragment }
106108}
107109
108110and path = parse
109- | " " { { scheme = " file" ; authority = " " ; path = " /" ; query = None } }
110- | " //" ([^ '/' ]* as authority) (['/' ]_* as path) { { scheme = " file" ; authority; path ; query = None } }
111- | " //" ([^ '/' ]* as authority) { { scheme = " file" ; authority; path = " /" ; query = None } }
112- | (" /" _* as path) { { scheme = " file" ; authority = " " ; path ; query = None } }
113- | (_* as path) { { scheme = " file" ; authority = " " ; path = " /" ^ path ; query = None } }
111+ | " " { { scheme = " file" ; authority = " " ; path = " /" ; query = None ; fragment = None } }
112+ | " //" ([^ '/' ]* as authority) (['/' ]_* as path) { { scheme = " file" ; authority; path ; query = None ; fragment = None } }
113+ | " //" ([^ '/' ]* as authority) { { scheme = " file" ; authority; path = " /" ; query = None ; fragment = None } }
114+ | (" /" _* as path) { { scheme = " file" ; authority = " " ; path ; query = None ; fragment = None } }
115+ | (_* as path) { { scheme = " file" ; authority = " " ; path = " /" ^ path ; query = None ; fragment = None } }
114116
115117{
116118 let of_string s =
0 commit comments