Parse URIs starting with numbers

This commit is contained in:
orbifx 2022-11-13 13:41:14 +00:00
parent c15e8e2a0d
commit 68b0819b01
5 changed files with 5 additions and 12 deletions

View File

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

View File

@ -1,13 +1,9 @@
(lang dune 2.4)
(name text_parse)
(version 1.02)
(homepage "https://cgit.orbitalfox.eu/text-parse-ml")
(source (uri git://orbitalfox.eu/text-parse-ml))
(license EUPL)
(authors "orbifx")
(maintainers "fox@orbitalfox.eu")
(bug_reports "mailto:fox@orbitalfox.eu?subject=Text parse ML Issue:")
(maintainers "orbifx <orbifx@disroot.org>")
(generate_opam_files true)

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

View File

@ -2,11 +2,8 @@
opam-version: "2.0"
version: "1.02"
synopsis: "Applicative text parsing"
maintainer: ["fox@orbitalfox.eu"]
authors: ["orbifx"]
maintainer: ["orbifx <orbifx@disroot.org>"]
license: "EUPL"
homepage: "https://cgit.orbitalfox.eu/text-parse-ml"
bug-reports: "mailto:fox@orbitalfox.eu?subject=Text parse ML Issue:"
depends: [
"dune" {>= "2.4"}
]
@ -24,4 +21,3 @@ build: [
"@doc" {with-doc}
]
]
dev-repo: "git://orbitalfox.eu/text-parse-ml"