Created
March 6, 2021 20:50
-
-
Save yanndegat/329737d2bf28901d3cfdccae600537cc to your computer and use it in GitHub Desktop.
gerbil srfi 115 issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import :std/srfi/115) [47/1454] | |
;; URL parsing regexp | |
;; this is roughly following the regexp in Appendix B of rfc 3986, except for using | |
;; `*' instead of `+' for the scheme part (it is checked later anyway, and | |
;; we don't want to parse it as a path element), and the user@host:port is | |
;; parsed here. | |
(define rx-url | |
(regexp '(+ bos | |
(?? ($ (* (~ (":/?#")))) ":") ; 1- scheme opt | |
(?? "//" ; slash-slash authority opt | |
(?? ($ (* (~ ("/?#@")))) "@") ; 2- user@ opt | |
(?? (or ; | |
(?? "[" ($ (* (or alnum ":")) ; 3- ipv6 host opt | |
":" ; | |
(* (or alnum ":"))) "]") ; | |
(?? ($ (* (~ ("/?#:"))))))) ; 4- host opt | |
(?? ":" ($ (* num)))) ; 5- :port opt | |
($ (* (~ ("?#")))) ; 6- path | |
(?? "?" ($ (* (~ ("#"))))) ; 7- query | |
(?? "#" ($ (* any))) ; 8- fragment | |
eos))) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) | |
(displayln (regexp-match-submatch | |
(regexp-search rx-url "ssh://git@host.com:22/foo/bar.git?ref=master&foo=bar") | |
4)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment