Changeset 3372 for src/Pugs/Compile/Parrot.hs
- Timestamp:
- 05/18/05 02:43:25 (4 years ago)
- svk:copy_cache_prev:
- 4945
- Files:
-
- 1 modified
-
src/Pugs/Compile/Parrot.hs (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Compile/Parrot.hs
r3352 r3372 45 45 compile = return 46 46 47 padSort :: (Var, [(TVar Bool, TVar VRef)]) -> (String, [(a, b)]) -> Ordering 47 48 padSort ((a::[Char]), [(_, _)]) ((b::[Char]), [(_, _)]) 48 49 | (head a == ':' && head b == '&') = LT … … 97 98 compile prm = return $ text ".param pmc" <+> varText (paramName prm) 98 99 100 varText :: String -> Doc 99 101 varText ('$':name) = text $ "s__" ++ name 100 102 varText ('@':name) = text $ "a__" ++ name … … 102 104 varText x = error $ "invalid name: " ++ x 103 105 106 varInit :: String -> Doc 104 107 varInit ('$':_) = text $ "PerlUndef" 105 108 varInit ('@':_) = text $ "PerlArray" … … 122 125 return $ map ((tmp <> text "_" <>) . text) strs 123 126 127 incCounter :: String -> (String -> String) -> Eval Doc 124 128 incCounter key f = do 125 129 Just ioRef <- asks envDebug … … 139 143 140 144 145 label :: Doc -> Doc 141 146 label doc = doc <> text ":" 142 147 148 compileCond :: Compile a => String -> [a] -> Eval Doc 143 149 compileCond neg [cond, bodyIf, bodyElse] = do 144 150 [alt, end] <- tempLabels ["else", "endif"] … … 324 330 return $ vcat [ argC, f tmp ] 325 331 332 currentStash :: Eval Doc 326 333 currentStash = fmap text $ asks envStash 334 335 constPMC :: Doc -> Eval Doc 327 336 constPMC doc = do 328 337 tmp <- currentStash … … 332 341 ] 333 342 343 compileArg :: Compile a => a -> Eval (Doc, Doc) 334 344 compileArg exp = do 335 345 tmp <- tempPMC
