Open CafeKrem opened 3 years ago
we should a way to express something like this :
pattern := {String repeat: 3 . 100 } asMatcher. self assert: (pattern match: { '1' . '2' . '3' . 100}) isMatch. self deny: (pattern match: { '1' . '2' . 100}) isMatch. self assert: (pattern match: { '1' . '2' . '3' . 100 . 100}) isMatch. self deny: (pattern match: { 100}) isMatch
maybe use Interval
pattern := {String repeat: #(1 3) . 100} asMatcher "repeat between 1 and 3 times" self assert: (pattern match: { '1' . '2' . '3' . 100}) isMatch. self assert: (pattern match: { '1' . '2' . 100}) isMatch. self assert: (pattern match: { '1' . '2' . '3' . 100 . 100}) isMatch. self deny: (pattern match: { 100}) isMatch. self assert: (pattern match: {'1' . 100 }) isMatch
an other case
pattern := { #'@a' . #'@b' } repeat: 2
is equals to ?
pattern := { #'@a' . #'@b'. #'@a' . #'@b' }
or
pattern := { #'@a' . #'@b'. #'@a'1 . #'@b1' }
is it an option ?
we should a way to express something like this :
maybe use Interval