Changeset 5360 for src/Pugs/Compile/Pugs.hs
- Timestamp:
- 07/10/05 16:32:40 (4 years ago)
- svk:copy_cache_prev:
- 7349
- Files:
-
- 1 modified
-
src/Pugs/Compile/Pugs.hs (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Compile/Pugs.hs
r5358 r5360 104 104 105 105 instance Compile (String, [(TVar Bool, TVar VRef)]) where 106 compile ((_:'?':_), _) = return empty -- XXX - @?S etc; punt for now 107 compile ((_:'*':_), _) = return empty -- XXX - @*INIT etc; punt for now 108 compile ((_:'=':_), _) = return empty -- XXX - @=POS etc; punt for now 106 compile ((':':'*':_), _) = return empty -- XXX - :*Bool etc; punt for now 109 107 compile (n, tvars) = do 110 tvarsC <- compile tvars 111 return $ prettyDo 112 [ prettyBind "tvars" (text "sequence" `sep1` tvarsC) 108 tvarsC <- fmap (filter (not . isEmpty)) $ mapM compile tvars 109 if null tvarsC then return empty else do 110 return $ prettyDo 111 [ prettyBind "tvars" (text "sequence" `sep1` prettyList tvarsC) 113 112 , text ("return (" ++ show n ++ ", tvars)") 114 113 ] … … 121 120 freshC <- compile fresh 122 121 tvarC <- compile tvar 122 if isEmpty tvarC then return empty else do 123 123 return $ prettyDo 124 124 [ prettyBind "fresh" freshC … … 136 136 vref <- liftSTM $ readTVar fresh 137 137 vrefC <- compile vref 138 if isEmpty vrefC then return empty else do 138 139 return $ prettyDo 139 140 [ prettyBind "vref" vrefC … … 145 146 vsub <- code_fetch cv 146 147 vsubC <- compile vsub 148 if isEmpty vsubC then return empty else do 147 149 return $ prettyDo 148 150 [ prettyBind "vsub" vsubC … … 152 154 sv <- scalar_fetch sv 153 155 svC <- compile sv 156 if isEmpty svC then return empty else do 154 157 return $ prettyDo 155 158 [ prettyBind "sv" svC … … 168 171 compile x = return $ text "return" $+$ parens (text $ show x) 169 172 170 -- This wants a total rewrite. I strongly want Data.Generics at this point now.173 -- We need a compile VObject! 171 174 172 175 -- Haddock can't cope with Template Haskell 173 176 instance Compile VCode where 174 compile MkCode{ subBody = Prim _ } = return $ text "return mkPrim" 177 -- compile MkCode{ subBody = Prim _ } = return $ text "return mkPrim" 178 compile MkCode{ subBody = Prim _ } = return empty 175 179 compile code = do 176 180 bodyC <- compile $ subBody code
