- Timestamp:
- 03/04/08 22:06:31 (7 months ago)
- Location:
- src/Pugs
- Files:
-
- 11 modified
-
AST.hs (modified) (3 diffs)
-
AST/Internals.hs (modified) (1 diff)
-
AST/Internals/Instances.hs (modified) (1 diff)
-
AST/Pad.hs (modified) (1 diff)
-
Compile.hs (modified) (1 diff)
-
Compile/Pugs.hs (modified) (1 diff)
-
Eval.hs (modified) (3 diffs)
-
Internals/Cast.hs (modified) (1 diff)
-
Internals/ID.hs (modified) (1 diff)
-
Monads.hs (modified) (1 diff)
-
Parser/Operator.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/AST.hs
r19810 r20058 196 196 merge _ old = case old of 197 197 PEConstant{ pe_proto = MkRef (ICode oldCV) } 198 | Just mc<- fromTypeable oldCV -> protoEntry198 | Just (mc :: VMultiCode) <- fromTypeable oldCV -> protoEntry 199 199 { pe_proto = MkRef . ICode $ protoCode 200 200 { mc_assoc = code_assoc c `mappend` code_assoc mc … … 449 449 readCodesFromRef :: VRef -> Eval [VCode] 450 450 readCodesFromRef (MkRef (ICode c)) 451 | Just mc<- fromTypeable c = do451 | Just (mc :: VMultiCode) <- fromTypeable c = do 452 452 let names@(pivot:_) = Set.elems (mc_variants mc) 453 453 rvs <- fmap concat . forM names $ \var -> do … … 460 460 rvsGlobal <- readCodesFromRef =<< fromVal cvGlobal 461 461 return (rvsGlobal ++ rvs) 462 | Just cv<- fromTypeable c = return [cv]462 | Just (cv :: VCode) <- fromTypeable c = return [cv] 463 463 readCodesFromRef ref = do 464 464 code <- fromVal =<< readRef ref -
src/Pugs/AST/Internals.hs
r16627 r20058 2086 2086 instance YAML VRef where 2087 2087 asYAML (MkRef (ICode cv)) 2088 | Just mc<- fromTypeable cv = do2088 | Just (mc :: VMultiCode) <- fromTypeable cv = do 2089 2089 mcC <- asYAML (mc :: VMultiCode) 2090 2090 return $ mkTagNode (tagHs "VMultiCode") $ ESeq [mcC] -
src/Pugs/AST/Internals/Instances.hs
r16627 r20058 115 115 instance YAML VRef where 116 116 asYAML (MkRef (ICode cv)) 117 | Just mc<- fromTypeable cv = do117 | Just (mc :: VMultiCode) <- fromTypeable cv = do 118 118 mcC <- asYAML (mc :: VMultiCode) 119 119 return $ mkTagNode (tagHs "VMultiCode") $ ESeq [mcC] -
src/Pugs/AST/Pad.hs
r17047 r20058 80 80 PEConstant{ pe_proto = MkRef (ICode newCV), pe_flags = flags } 81 81 PEConstant{ pe_proto = MkRef (ICode oldCV) } 82 | Just newMC<- fromTypeable newCV83 , Just oldMC<- fromTypeable oldCV82 | Just (newMC :: VMultiCode) <- fromTypeable newCV 83 , Just (oldMC :: VMultiCode) <- fromTypeable oldCV 84 84 = PEConstant 85 85 { pe_type = mc_type newMC -- XXX - Select a narrower type? -
src/Pugs/Compile.hs
r17701 r20058 74 74 where 75 75 entries = sortBy padSort [ (cast var, readPadEntry ref) | (var, ref) <- padToList pad ] 76 canCompile (name@('&':_) , sym) = do77 ref<- sym76 canCompile (name@('&':_) :: String, sym) = do 77 (ref :: VRef) <- sym 78 78 case ref of 79 79 MkRef ICode{} -> do -
src/Pugs/Compile/Pugs.hs
r16627 r20058 21 21 22 22 joinMany :: [Str] -> Str 23 joinMany xs = Str. joincm (filter (not . Str.null) xs)23 joinMany xs = Str.intercalate cm (filter (not . Str.null) xs) 24 24 25 25 instance (Compile x) => Compile [x] where -
src/Pugs/Eval.hs
r17873 r20058 185 185 evalRef ref = do 186 186 if refType ref == (mkType "Thunk") then forceRef ref else do 187 val <- catchT $ \ esc-> do187 val <- catchT $ \(esc :: Val -> Eval ()) -> do 188 188 MkEnv{ envContext = cxt, envLValue = lv } <- ask 189 189 let typ = typeOfCxt cxt … … 281 281 Nothing 282 282 | SType <- sig -> return . VType . cast $ if isQualifiedVar var 283 then cast $ Buf. join(__"::") [cast pkg, cast name]283 then cast $ Buf.intercalate (__"::") [cast pkg, cast name] 284 284 else name 285 285 | isGlobalVar var || pkg `notElem` [emptyPkg, callerPkg, outerPkg, contextPkg] -> do … … 1484 1484 --- not scalarRef! -- use the new "transparent IType" thing! 1485 1485 case showType (typeOfSigilVar var) of 1486 "Hash" -> ($ v) . fix $ \ redox -> case x of1486 "Hash" -> ($ v) . fix $ \(redo :: Val -> Eval Val) x -> case x of 1487 1487 VRef (MkRef (IHash h)) -> return (VRef $ hashRef h) 1488 1488 VRef ref@(MkRef IScalar{}) -> redo =<< readRef ref 1489 1489 _ -> fmap (VRef . hashRef) (fromVal v :: Eval VHash) 1490 "Array" -> ($ v) . fix $ \ redox -> case x of1490 "Array" -> ($ v) . fix $ \(redo :: Val -> Eval Val) x -> case x of 1491 1491 VRef (MkRef (IArray a)) -> return (VRef $ arrayRef a) 1492 1492 VRef ref@(MkRef IScalar{}) -> redo =<< readRef ref -
src/Pugs/Internals/Cast.hs
r15468 r20058 82 82 castBack = UTF8.pack 83 83 84 instance ((:<:) ByteString) String where 85 castBack = UTF8.unpack 86 84 87 #endif -
src/Pugs/Internals/ID.hs
r17047 r20058 89 89 cast = cast . idBuf 90 90 91 instance ((:<:) String) ID where 92 castBack = cast 93 91 94 instance ((:<:) ID) ByteString where 92 95 castBack = idBuf -
src/Pugs/Monads.hs
r17044 r20058 252 252 recloseRef :: VRef -> STM VRef 253 253 recloseRef (MkRef (ICode cv)) 254 | Just vcode<- fromTypeable cv = do254 | Just (vcode :: VCode) <- fromTypeable cv = do 255 255 vcode' <- recloseCode vcode 256 256 return . MkRef . ICode $ vcode' -
src/Pugs/Parser/Operator.hs
r19198 r20058 27 27 28 28 newtype OpName = MkOpName ID 29 deriving (Show, Eq, Typeable, (:>:) String, (:>:) ByteString, (:<:) ByteString, (:>:) ID )29 deriving (Show, Eq, Typeable, (:>:) String, (:>:) ByteString, (:<:) ByteString, (:>:) ID, (:<:) String, (:<:) ID) 30 30 31 31 instance Ord OpName where 32 32 compare (MkOpName MkID{ idKey = a, idBuf = x }) (MkOpName MkID{ idKey = b, idBuf = y }) 33 33 = compare (Buf.length y) (Buf.length x) `mappend` compare b a 34 35 instance ((:<:) OpName) ByteString where 36 castBack (MkOpName id) = castBack id 34 37 35 38 -- Not yet transcribed into a full optable parser with dynamic precedence … … 650 653 notFollowedBy (char '(' <|> (char ':' >> char ':')) 651 654 possiblyApplyMacro $ App (Var var) Nothing [] 652 parseOneTerm (name , categ) = do655 parseOneTerm (name :: OpName, categ) = do 653 656 symbol (cast name) 654 657 return MkVar
