diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2020-09-24 22:06:17 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2020-09-24 22:06:17 -0700 |
| commit | e1e927687089cf6af26f32fd0a1177c82e45ae5c (patch) | |
| tree | fcf120b8fe8514160ba0fa35072b5737f87a35f1 /grammars | |
| parent | 938ff73730b49488e06677fed8c2980638cbeeca (diff) | |
Fixed major performance issue with finding patterns
Diffstat (limited to 'grammars')
| -rw-r--r-- | grammars/builtins.bpeg | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/grammars/builtins.bpeg b/grammars/builtins.bpeg index 7f45f52..7a7aa06 100644 --- a/grammars/builtins.bpeg +++ b/grammars/builtins.bpeg @@ -22,7 +22,9 @@ find-all: ( (include-binary-files / is-text-file) define-highlights add-filename - 1+find-next%\n 0-1{!<\n => "\n"} + 0+ (!..pattern {..\n=>}) + 1+ (>..pattern add-line-number 1+(..hl-pattern) ..\n / {..\n=>}) + 0-1{!<\n => "\n"} ) only-matches: ( (include-binary-files / is-text-file) @@ -30,8 +32,6 @@ only-matches: ( add-filename 1+{...@hl-pattern=>'@1\n'} ) -find-next: matching-line / {..\n =>} find-next -matching-line: add-line-number 1+(..hl-pattern) ..$ add-filename: 0-1(print-filenames (is-tty {=>"\033[33;1;4m@&:\033[0m\n"} / {=>"@&:\n"})) add-line-number: 0-1(print-line-numbers (is-tty {=>"\033[2m@#\033[5G|\033[0m "} / {=>"@#| "})) hl-pattern: {@[match]pattern define-highlights => "@[hl-start]@[match]@[hl-end]"} |
