diff --git a/src/compiler/api/GF/Compile/Compute/Concrete.hs b/src/compiler/api/GF/Compile/Compute/Concrete.hs index 4503a8ca1..9b77e04ad 100644 --- a/src/compiler/api/GF/Compile/Compute/Concrete.hs +++ b/src/compiler/api/GF/Compile/Compute/Concrete.hs @@ -367,16 +367,6 @@ patternMatch v0 ((env0,ps,args0,t):eqs) = match env0 ps eqs args0 (PString s1, VEmpty) | null s1 -> match env ps eqs args (PSeq min1 max1 p1 min2 max2 p2,v) - -> case value2string v of - Const s -> do let n = length s - lo = min1 `max` (n-fromMaybe n max2) - hi = (n-min2) `min` fromMaybe n max1 - (ds,cs) = splitAt lo s - eqs <- matchStr env (p1:p2:ps) eqs (hi-lo) (reverse ds) cs args - patternMatch v0 eqs - RunTime -> return v0 - NonExist-> patternMatch v0 eqs - (PRep minp maxp p, v) -> case value2string v of Const s -> let n = length s lo = min1 `max` (n-fromMaybe n max2) @@ -388,7 +378,13 @@ patternMatch v0 ((env0,ps,args0,t):eqs) = match env0 ps eqs args0 else patternMatch v0 eqs RunTime -> return v0 NonExist-> patternMatch v0 eqs - (PChar, VStr [_]) -> match env ps eqs args + (PRep minp maxp p, v) + -> case value2string v of + Const s -> do let n = length s `div` (max minp 1) + eqs <- matchRep env n minp maxp p minp maxp p ps ((env,PString []:ps,(arg:args),t) : eqs) (arg:args) + patternMatch v0 eqs + RunTime -> return v0 + NonExist-> patternMatch v0 eqs (PChars cs, VStr [c]) | elem c cs -> match env ps eqs args (PInt n, VInt m)