Changeset 3119 for src/Pugs/Prim/Match.hs
- Timestamp:
- 05/12/05 21:45:17 (4 years ago)
- svk:copy_cache_prev:
- 4536
- Files:
-
- 1 modified
-
src/Pugs/Prim/Match.hs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Prim/Match.hs
r3103 r3119 149 149 return $ VBool $ x' `cmp` y' 150 150 151 rxSplit :: VRule -> String -> Eval [ String]151 rxSplit :: VRule -> String -> Eval [Val] 152 152 rxSplit _ [] = return [] 153 153 rxSplit rx str = do 154 154 match <- str `doMatch` rx 155 if not (matchOk match) then return [ str] else do155 if not (matchOk match) then return [VStr str] else do 156 156 if matchFrom match == matchTo match 157 157 then do 158 158 let (c:cs) = str 159 159 rest <- rxSplit rx (cs) 160 return ( [c]:rest)160 return (VStr [c]:rest) 161 161 else do 162 162 let before = genericTake (matchFrom match) str 163 163 after = genericDrop (matchTo match) str 164 164 rest <- rxSplit rx after 165 strs <- mapM fromVal (matchSubPos match) 166 return $ (before:concat strs) ++ rest 165 return $ (VStr before:matchSubPos match) ++ rest
