From 7261a2b3f7439fae18410698741dca6759fe6432 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 28 Sep 2020 22:22:10 -0700 Subject: Url fixes --- grammars/builtins.bpeg | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'grammars') diff --git a/grammars/builtins.bpeg b/grammars/builtins.bpeg index be380d3..bd56431 100644 --- a/grammars/builtins.bpeg +++ b/grammars/builtins.bpeg @@ -23,7 +23,7 @@ find-all: ( define-highlights add-filename *(!..pattern {..\n=>}) - +(>..pattern add-line-number +(..hl-pattern) ..\n / {..\n=>}) + +(>..pattern add-line-number +(..hl-pattern) ..(\n/$) / {..(\n/$)=>}) [{!<\n => "\n"}] ) only-matches: ( @@ -39,20 +39,18 @@ hl-replacement: {@match=replacement define-highlights => "@hl-start;@match;@hl-e define-highlights: highlight @hl-start={=>"\033[31;1m"} @hl-end={=>"\033[0m"} / @hl-start="" @hl-end="" # Helper definitions (commonly used) -#( url: ( "file://" +(`/ *url-char) / "mailto:" email - / ("https"/"http"/"ftp") "://" [+url-char [`: +url-char] `@] (ipv4/ipv6/domain) [`: int] [url-path] + / ("https"/"http"/"ftp") "://" [>..`@ +url-char [`: +url-char] `@] + (ipv4/ipv6/domain) [`: int] [url-path] ) -url-path: +(`/ *url-char) [`? +(+url-char`=+url-char] +url-path: +(`/ *url-char) [`? +(+url-char`=+url-char)%`&] ipv4: 4 int % `. ipv6: 8 (4 Hex) % `: -domain: +(Abc/digit/`-)%`. +domain: +(+(Abc/digit/`-))%`. url-char: Abc/digit/`$/`-/`_/`./`+/`!/`*/`'/`(/`)/`,/`% -url: @(https?|ftp)://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?$@iS -)# indent: \n|+(\t/' ') dedent: $ !(\n|) indented-block: |` ..$ *(\n|..$) -- cgit v1.2.3