Changeset 21677
- Timestamp:
- 08/01/08 14:20:21 (4 months ago)
- Location:
- src/Pugs
- Files:
-
- 2 modified
-
Embed/Perl5.hs (modified) (2 diffs)
-
Prim/Match.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Embed/Perl5.hs
r21673 r21677 15 15 import qualified Data.ByteString.UTF8 as Str 16 16 17 evalPCR :: FilePath-> String -> String -> [(String, String)] -> IO String18 evalPCR pathmatch rule subrules = do19 (inp, out, err, pid) <- initPCR path17 evalPCR :: [FilePath] -> String -> String -> [(String, String)] -> IO String 18 evalPCR [path] match rule subrules = do 19 (inp, out, err, pid) <- initPCR $ head path 20 20 (`mapM` subrules) $ \(name, rule) -> do 21 21 let nameStr = escape name … … 357 357 nullEnv = unsafePerformIO (newStablePtr (error "undefined environment")) 358 358 359 evalPCR :: FilePath-> String -> String -> [(String, String)] -> IO String360 evalPCR path match rule subrules = do359 evalPCR :: [FilePath] -> String -> String -> [(String, String)] -> IO String 360 evalPCR paths match rule subrules = do 361 361 let bridgeMod = "Pugs::Runtime::Match::HsBridge" 362 362 bridgeFile = "Pugs/Runtime/Match/HsBridge.pm"; 363 inv <- evalPerl5 (unlines 363 incs = map (\p -> " unshift @INC, '"++p++"';") paths 364 inv <- evalPerl5 (unlines $ 364 365 [ "if (!$INC{'"++bridgeFile++"'}) {" 365 , " unshift @INC, '"++path++"';"366 ," eval q[require '"++bridgeFile++"'] or die $@;"366 ] ++ incs ++ 367 [ " eval q[require '"++bridgeFile++"'] or die $@;" 367 368 , "}" 368 369 , "'"++bridgeMod++"'" -
src/Pugs/Prim/Match.hs
r21673 r21677 33 33 doMatch :: String -> VRule -> Eval VMatch 34 34 doMatch cs rule@MkRulePGE{ rxRule = ruleStr } = do 35 pwd <- io $ getDataFileName "blib6/pugs/perl5/lib" 35 pwd1 <- io $ getDataFileName "perl5/Pugs-Compiler-Rule/lib" 36 pwd2 <- io $ getDataFileName "third-party/Parse-Yapp/lib" 36 37 glob <- askGlobal 37 38 let syms = [ (cast $ v_name var, entry) … … 49 50 let ruleEngine | Just "PGE" <- rv = evalPGE 50 51 | otherwise = evalPCR 51 pge <- io $ ruleEngine pwdcs text subrules52 pge <- io $ ruleEngine [pwd1, pwd2] cs text subrules 52 53 `catchIO` (\e -> return $ show e) 53 54 rv <- tryIO Nothing $ fmap Just (readIO $ decodeUTF8 pge)
