Changeset 9054 for src/Pugs/CodeGen

Show
Ignore:
Timestamp:
02/18/06 21:47:47 (3 years ago)
Author:
audreyt
Message:

* pugs -CParse-HsYaml? backend for yaml-node based serialization.
* slightly improved DrIFT.YAML syntax.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/CodeGen/YAML.hs

    r9050 r9054  
    22{-# OPTIONS_GHC -#include "../../UnicodeC.h" #-} 
    33 
    4 module Pugs.CodeGen.YAML (genYAML, genParseYAML) where 
     4module Pugs.CodeGen.YAML (genYAML, genParseYAML, genParseHsYAML) where 
    55import Pugs.Internals 
    66import Pugs.AST 
     
    99import DrIFT.YAML 
    1010import qualified Data.Map as Map 
     11 
     12genParseHsYAML :: Eval Val 
     13genParseHsYAML = do 
     14    glob        <- asks envGlobal 
     15    MkPad pad   <- liftSTM $ readTVar glob 
     16    pad'        <- fmap (MkPad . Map.fromAscList . catMaybes) . mapM checkPrim $ Map.toAscList pad 
     17    -- munge the glob to filter out prim stuff in it 
     18    main    <- asks envBody 
     19    yaml    <- liftIO $ toYamlNode (pad', main) 
     20    return (VStr $ show yaml) 
    1121 
    1222genParseYAML :: Eval Val