diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2020-09-16 20:41:38 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2020-09-16 20:41:38 -0700 |
| commit | ae76deaeb2c25a41a71b9e3e1dd92e25abd2677f (patch) | |
| tree | eb0edb934cc7cd2811ab6c46d933e5e642f26e50 | |
| parent | f35d3c98b22ac3c708672493d27267de071989cd (diff) | |
Removed old code
| -rw-r--r-- | compiler.c | 4 | ||||
| -rw-r--r-- | grammars/builtins.bpeg | 9 |
2 files changed, 6 insertions, 7 deletions
@@ -252,10 +252,6 @@ vm_op_t *bpeg_simplepattern(file_t *f, const char *str) } // Capture case '@': { - if (matchchar(&str, '@')) { // @@ -> current position - op->op = VM_POSITION; - break; - } op->op = VM_CAPTURE; str = after_spaces(str); if (matchchar(&str, '[')) { diff --git a/grammars/builtins.bpeg b/grammars/builtins.bpeg index 1191bb4..68a7791 100644 --- a/grammars/builtins.bpeg +++ b/grammars/builtins.bpeg @@ -1,3 +1,6 @@ +yes = (/); +no = !(/); + # Meta-rules for acting on everything pattern = !(/); # Not defined by default replacement = !(/); # Not defined by default @@ -7,11 +10,11 @@ find-next = matching-line / {..\n =>} find-next; only-matches = 1+{...@pattern=>'@1\n'}; matching-line = add-linenum 1+(..@pattern) ..$; -is-tty = !(/); # Defined as either always-match or always-fail, depending on stdout -print-linenums = is-tty; +is-tty = no; # Defined as either always-match or always-fail, depending on stdout +print-line-numbers = is-tty; print-filenames = is-tty; add-filename = 0-1(print-filenames (is-tty {=>"\033[33;1;4m@&:\033[0m\n"} / {=>"@&:\n"})); -add-linenum = 0-1(print-linenums (is-tty {=>"\033[2m@#\033[5G|\033[0m "} / {=>"@#| "})); +add-linenum = 0-1(print-line-numbers (is-tty {=>"\033[2m@#\033[5G|\033[0m "} / {=>"@#| "})); # Helper definitions (commonly used) indent = \n|1+(\t/' '); |
