From 68f6218444376a72a485bfe56a6a163f10bddf20 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 6 May 2023 13:56:48 -0400 Subject: [PATCH] Fix domains to require a TLD (but allow non-tld domains like "localhost" in URLS) --- grammars/web.bp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grammars/web.bp b/grammars/web.bp index 3e47eba..9845676 100644 --- a/grammars/web.bp +++ b/grammars/web.bp @@ -1,13 +1,14 @@ # This file defines some web-related patterns url: ( ("https"/"http"/"ftp") "://" [>..`@ +url-char [`: +url-char] `@] - (ipv4/ipv6/domain) [`: int] [url-path] + (ipv4/ipv6/domain/domain-segment) [`: int] [url-path] / "mailto:" email / "file://" +(`/ *url-char) ) url-path: +(`/ *url-char) [`? +(+url-char`=+url-char)%`&] ipv4: 4 int % `. ipv6: 8 (4 Hex) % `: -domain: +(+(Abc/digit/`-))%`. +domain-segment: +(Abc/digit/`-) +domain: 2+domain-segment % `. url-char: Abc/digit/`$,-,_,.,+,!,*,',(,),,,% email: +(Abc/digit/`.,-,+) `@ domain