aboutsummaryrefslogtreecommitdiff
path: root/bpeg.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2020-09-11 02:04:01 -0700
committerBruce Hill <bruce@bruce-hill.com>2020-09-11 02:04:01 -0700
commit0c20c39f410d1d76123e8f5318e0624f34cf7908 (patch)
treea271dd7a4274e67f34d016b946ef3e1a007746b0 /bpeg.c
parentf64467af21efab70b8cfab46f3f7f9d36c5b6e5f (diff)
Made more grep-like
Diffstat (limited to 'bpeg.c')
-rw-r--r--bpeg.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bpeg.c b/bpeg.c
index 2515d8b..04e23d2 100644
--- a/bpeg.c
+++ b/bpeg.c
@@ -110,7 +110,10 @@ int main(int argc, char *argv[])
add_def(g, pattern, "pattern", pat);
- const char *grammar = "find = *(@pattern / \\n / .);";
+ const char *grammar = (
+ "find-all = *(matching-line / {&&(\\n/$$)=>});\n"
+ "matching-line = +&@pattern *. $ ?\\n;"
+ );
load_grammar(g, grammar);
}
@@ -138,7 +141,7 @@ int main(int argc, char *argv[])
return 1;
} else {
print_match(m, "\033[0m", verbose);
- printf("\033[0;2m%s\n", m->end);
+ //printf("\033[0;2m%s\n", m->end);
}
return 0;