From 0e96b8551b5293ffeadfebc31b85a165b0a74b99 Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Tue, 25 Jul 2017 21:08:44 -0500 Subject: create general regex simplification pass Move the previous special-case logic for removing 1-1 repeats into this pass. --- parse-pattern.y | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'parse-pattern.y') diff --git a/parse-pattern.y b/parse-pattern.y index 2c0556a..e5acd3c 100644 --- a/parse-pattern.y +++ b/parse-pattern.y @@ -62,13 +62,7 @@ input: ; molecule: - repeat sequence { - if ($1.min == 1 && $1.max == 1) { - $$ = $2; - } else { - $$ = mkatom(&(struct atom) { .type = ATOM_REPETITION, .u = { .repeat = { .counts = $1, .child = $2 } } }); - } - } + repeat sequence { $$ = mkatom(&(struct atom) { .type = ATOM_REPETITION, .u = { .repeat = { .counts = $1, .child = $2 } } }); } ; repeat: -- cgit v1.2.3