Skip to content

Commit

Permalink
fix broken patch
Browse files Browse the repository at this point in the history
  • Loading branch information
krangelov committed Aug 26, 2024
1 parent 4282873 commit 92cd2df
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/compiler/api/GF/Compile/Compute/Concrete.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 92cd2df

Please sign in to comment.