Changeset 8609

Show
Ignore:
Timestamp:
01/08/06 21:28:10 (3 years ago)
Author:
gaal
Message:

Yaml serialization -
* parsing rules works (but they segfault when applied, probably need

a copy made?)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Prim/Yaml.hs

    r8608 r8609  
    4545                return (key, val) 
    4646            return . VObject =<< createObject (mkType typ) vals 
     47        Just "pugs/Rule" -> do 
     48            vals    <- forM nodes $ \(keyNode, valNode) -> do 
     49                key <- fromVal =<< fromYaml keyNode 
     50                val <- fromYaml valNode 
     51                return (key, val) 
     52            let spec    = Map.fromList (vals :: [(String, Val)]) 
     53            rule    <- fromVal =<< Map.lookup "rule" spec 
     54            global  <- fromVal =<< Map.lookup "global" spec 
     55            stringify <- fromVal =<< Map.lookup "stringify" spec 
     56            adverbs <- Map.lookup "adverbs" spec 
     57            return $ VRule MkRulePGE{rxRule=rule, rxGlobal=global, rxStringify=stringify, rxAdverbs=adverbs} 
    4758        Just x   -> error ("can't deserialize: " ++ x) 
    4859