From ae76deaeb2c25a41a71b9e3e1dd92e25abd2677f Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 16 Sep 2020 20:41:38 -0700 Subject: Removed old code --- compiler.c | 4 ---- grammars/builtins.bpeg | 9 ++++++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/compiler.c b/compiler.c index 99ff44f..fe7ad3f 100644 --- a/compiler.c +++ b/compiler.c @@ -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/' '); -- cgit v1.2.3