From 611ebeedddf9041edd21575da063c6e23539e693 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 11 May 2021 11:37:46 -0400 Subject: [PATCH] Fix max multiplicity count parsing --- lib/imbecile/regex/parser.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/imbecile/regex/parser.rb b/lib/imbecile/regex/parser.rb index 003eb66..f506005 100644 --- a/lib/imbecile/regex/parser.rb +++ b/lib/imbecile/regex/parser.rb @@ -177,14 +177,13 @@ module Imbecile min_count = min_count.to_i if comma.to_s == "" max_count = min_count - else - max_count = nil - end - if max_count.to_s != "" + elsif max_count.to_s != "" max_count = max_count.to_i if max_count < min_count raise Error.new("Maximum repetition count cannot be less than minimum repetition count") end + else + max_count = nil end @pattern = pattern [min_count, max_count]