diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2020-09-14 01:21:49 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2020-09-14 01:21:49 -0700 |
| commit | a82164505e89dc8257ef87844dfef1476e235a7f (patch) | |
| tree | f545e4a76b0ff0472bf6046b951230672ad18ce4 /grammars | |
| parent | 9f2d5464d6fd2c2aeb6dc234c64bd3aafe22d6e0 (diff) | |
Added nodent support (|)
Diffstat (limited to 'grammars')
| -rw-r--r-- | grammars/builtins.bpeg | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/grammars/builtins.bpeg b/grammars/builtins.bpeg index c871408..df03104 100644 --- a/grammars/builtins.bpeg +++ b/grammars/builtins.bpeg @@ -2,12 +2,15 @@ pattern = !(/); # Not defined by default replacement = !(/); # Not defined by default replace-all = +(...@replacement) ...; -find-all = {... >matching-line =>} +(matching-line/non-matching-line) ?{!<\n => "\n"}; +find-all = +find-next%\n ?{!<\n => "\n"}; +find-next = matching-line / {..\n =>} find-next; only-matches = +{...@pattern=>'@1\n'}; -matching-line = +(..@pattern)..$ ?\n; -non-matching-line = {..$=>}; +matching-line = +(..@pattern) ..$; # Helper definitions (commonly used) +indent = \n |+(\t/' '); +dedent = >(\n !|); +indented-block = |` ..$ *(\n|..$); crlf = \r\n; cr = \r; r = \r; anglebraces = `< *(anglebraces / !`>.) `>; |
