Changeset 2944 for src/Pugs/Prim/Match.hs
- Timestamp:
- 05/10/05 21:29:10 (4 years ago)
- svk:copy_cache_prev:
- 4498
- Files:
-
- 1 modified
-
src/Pugs/Prim/Match.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Prim/Match.hs
r2942 r2944 20 20 hasSrc <- liftIO $ doesDirectoryExist pwd2 21 21 let pwd = if hasSrc then pwd2 else pwd1 22 pge <- liftIO $ evalPGE pwd (encodeUTF8 cs) (encodeUTF8 re) 22 glob <- askGlobal 23 let syms = [ (name, tvar) | (('<':name), [(_, tvar)]) <- padToList glob ] 24 subrules <- forM syms $ \(name, tvar) -> do 25 ref <- liftSTM $ readTVar tvar 26 (VRule rule) <- fromVal =<< readRef ref 27 return (name, rxRule rule) 28 pge <- liftIO $ evalPGE pwd (encodeUTF8 cs) (encodeUTF8 re) subrules 23 29 rv <- tryIO Nothing $ fmap Just (readIO $ decodeUTF8 pge) 24 30 let matchToVal PGE_Fail = VMatch mkMatchFail … … 32 38 case rv of 33 39 Just m -> fromVal (matchToVal m) 34 Nothing -> fail ("Cannot parse PGE: " ++ pge) 40 Nothing -> do 41 liftIO $ putStrLn ("*** Cannot parse PGE: " ++ re ++ "\n*** Error: " ++ pge) 42 return mkMatchFail 35 43 36 44 doMatch cs MkRulePCRE{ rxRegex = re } = do
