summaryrefslogtreecommitdiff
path: root/parse-pattern.y
diff options
context:
space:
mode:
Diffstat (limited to 'parse-pattern.y')
-rw-r--r--parse-pattern.y8
1 files changed, 7 insertions, 1 deletions
diff --git a/parse-pattern.y b/parse-pattern.y
index e5acd3c..2c0556a 100644
--- a/parse-pattern.y
+++ b/parse-pattern.y
@@ -62,7 +62,13 @@ input:
;
molecule:
- repeat sequence { $$ = mkatom(&(struct atom) { .type = ATOM_REPETITION, .u = { .repeat = { .counts = $1, .child = $2 } } }); }
+ repeat sequence {
+ if ($1.min == 1 && $1.max == 1) {
+ $$ = $2;
+ } else {
+ $$ = mkatom(&(struct atom) { .type = ATOM_REPETITION, .u = { .repeat = { .counts = $1, .child = $2 } } });
+ }
+ }
;
repeat: