diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-01-15 01:19:10 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-01-15 01:19:10 -0800 |
| commit | 8ff80b09ccd7e680829d0911d965ad4b0d6f7939 (patch) | |
| tree | 399da1a15ed749fa10cec8bf62dcde5e93ef3f3f /grammars | |
| parent | 9b70cb4f624aa19c09ea73b3d9e0f50c032602c5 (diff) | |
Major overhaul of how different modes of behavior work. Approximately 2x
speedup and 2x memory footprint reduction. Also removed --mode and
VM_HIDE (~ operator), and added --context. Printing works better now.
Diffstat (limited to 'grammars')
| -rw-r--r-- | grammars/bpeg.bp | 3 | ||||
| -rw-r--r-- | grammars/builtins.bp | 20 |
2 files changed, 1 insertions, 22 deletions
diff --git a/grammars/bpeg.bp b/grammars/bpeg.bp index 23a2250..e8d7259 100644 --- a/grammars/bpeg.bp +++ b/grammars/bpeg.bp @@ -11,7 +11,7 @@ String-pattern: ..$$ % (\n / Nodent / Escape / `\ pat [`;]) pat: simple-pat !(__("!="/"==")) / suffixed-pat simple-pat: Upto-and / Dot / String / Chars / Nodent / Escape-range - / Escape / Repeat / Optional / No / Hide / After / Before / Capture + / Escape / Repeat / Optional / No / After / Before / Capture / Ref / parens suffixed-pat: ( @@ -41,7 +41,6 @@ escape-sequence: ( / `x 2 `0-9,a-f,A-F ) No: `! (__@pat / @!=(''=>"Expected a pattern after the exclamation mark")) -Hide: `~ (__@pat / @!=(''=>"Expected a pattern after the tilde")) Nodent: `\ `N Upto-and: ".." [__@first=simple-pat] [__`%__@second=simple-pat] Repeat: ( diff --git a/grammars/builtins.bp b/grammars/builtins.bp index 59104c3..fcc1f20 100644 --- a/grammars/builtins.bp +++ b/grammars/builtins.bp @@ -9,26 +9,6 @@ is-text-file: >32(\t/\n/\r/\x20-x7e/!\x00-x7f utf8-codepoint/$$) # Meta-rules for acting on everything: pattern: !'' # Not defined by default replacement: !'' # Not defined by default -replace-all: ( - (include-binary-files / is-text-file) - +(..replacement%\n) ..%\n -) -find-all: ( - (include-binary-files / is-text-file) - *(!..pattern ~(..\n)) - +(+(..@pattern) ..(\n/$$) / ~(..\n)) - [!<\n => "\n"] -) -find-lines: ( - (include-binary-files / is-text-file) - *(!(pattern$) ~(..\n)) - +(@pattern (\n/$$) / ~(..\n)) - [!<\n => "\n"] -) -only-matches: ( - (include-binary-files / is-text-file) - +(..@pattern%\n =>'@1\n') -) # Helper definitions (commonly used) url: ( |
