Parse URIs starting with numbers

This commit is contained in:
orbifx 2022-11-13 13:41:14 +00:00
parent c15e8e2a0d
commit be1c67aa13
3 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,4 @@
(executable
(name cli)
(modules cli)
(libraries text parsers))
(libraries parsers))

View File

@ -8,7 +8,7 @@ open Text_parse.Cursor
module Angled (F : Fn) = struct
type t = F.t
let s cur = function '<' -> letter (char_at cur 1) | _ -> false
let s cur = function '<' -> let c = char_at cur 1 in letter c || digit c | _ -> false
let e _cur = function '>' -> true | _ -> false
let parse cur acc = F.angled_uri (segment_string (unwrap 1 cur)) acc
end

View File

@ -8,3 +8,4 @@ end
let newline = function '\n' -> true | _ -> false
let printable ch = ch >= ' ' && ch <= '~'
let letter ch = (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')
let digit = function '0' .. '9' -> true | _ -> false