diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2020-09-28 22:22:10 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2020-09-28 22:22:10 -0700 |
| commit | 7261a2b3f7439fae18410698741dca6759fe6432 (patch) | |
| tree | c49851dee42ff79322ce02fc2fada42ed2870b71 /grammars | |
| parent | f2f10586bb446cf3c6a3d7cc0965005e94dfcc81 (diff) | |
Url fixes
Diffstat (limited to 'grammars')
| -rw-r--r-- | grammars/builtins.bpeg | 12 |
1 files changed, 5 insertions, 7 deletions
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|..$) |
