Show
Ignore:
Timestamp:
07/18/06 16:15:40 (2 years ago)
Author:
gaal
Message:

* HsSyck?:
- use Pugs naming convention and other misc. cleanups
- this change breaks the API (only by name), so bump version to 0.2.

* Pugs:
- chase API changes and re-DrIFT.

You may need to 'ghc-pkg unregister pugs-HsSyck?' or even
'make clean' after this update.

Files:
1 modified

Legend:

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

    r10179 r11614  
    2222 
    2323fromYaml :: YamlNode -> Eval Val 
    24 fromYaml MkYamlNode{nodeElem=YamlNil}       = return VUndef 
    25 fromYaml MkYamlNode{nodeElem=YamlStr str}   = return $ VStr $ decodeUTF8 $ unpackBuf str 
    26 fromYaml MkYamlNode{nodeElem=YamlSeq nodes} = do 
     24fromYaml MkNode{n_elem=ENil}       = return VUndef 
     25fromYaml MkNode{n_elem=EStr str}   = return $ VStr $ decodeUTF8 $ unpackBuf str 
     26fromYaml MkNode{n_elem=ESeq nodes} = do 
    2727    vals    <- mapM fromYaml nodes 
    2828    av      <- liftSTM $ newTVar $ 
    2929        IntMap.fromAscList ([0..] `zip` map lazyScalar vals) 
    3030    return $ VRef (arrayRef av) 
    31 fromYaml MkYamlNode{nodeElem=YamlMap nodes, nodeTag=tag} = do 
     31fromYaml MkNode{n_elem=EMap nodes, n_tag=tag} = do 
    3232    case tag of 
    3333        Nothing  -> do 
     
    7070 
    7171strNode :: String -> YamlNode 
    72 strNode = mkNode . YamlStr . packBuf 
     72strNode = mkNode . EStr . packBuf 
    7373 
    7474{- 
     
    8080 
    8181toYaml :: (?seen :: IntSet.IntSet) => Val -> Eval YamlNode 
    82 toYaml VUndef       = return $ mkNode YamlNil 
     82toYaml VUndef       = return $ mkNode ENil 
    8383toYaml (VBool x)    = return $ boolToYaml x 
    8484toYaml (VStr str)   = return $ strNode (encodeUTF8 str) 
    8585toYaml v@(VRef r)   = do 
    8686    ptr <- liftIO $ addressOf r 
    87     if IntSet.member ptr ?seen then return nilNode{ nodeAnchor = MkYamlReference ptr } else do 
     87    if IntSet.member ptr ?seen then return nilNode{ n_anchor = AReference ptr } else do 
    8888        let ?seen = IntSet.insert ptr ?seen 
    8989        node <- ifValTypeIsa v "Hash" (hashToYaml r) $ do 
     
    9393                VObject _   -> return nodes 
    9494                _           -> liftIO $ toYamlNode r 
    95         return node{ nodeAnchor = MkYamlAnchor ptr } 
     95        return node{ n_anchor = AAnchor ptr } 
    9696toYaml (VList nodes) = do 
    9797    n <- mapM toYaml nodes 
    98     return $ mkNode (YamlSeq n) 
    99     -- fmap YamlSeq$ mapM toYaml nodes 
     98    return $ mkNode (ESeq n) 
     99    -- fmap ESeq$ mapM toYaml nodes 
    100100toYaml v@(VObject obj) = do 
    101101    -- ... dump the objAttrs 
     
    108108toYaml (VRule MkRulePGE{rxRule=rule, rxGlobal=global, rxStringify=stringify, rxAdverbs=adverbs}) = do 
    109109    adverbs' <- toYaml adverbs 
    110     return . mkTagNode "tag:pugs:Rule" $ YamlMap 
     110    return . mkTagNode "tag:pugs:Rule" $ EMap 
    111111        [ (strNode "rule", strNode rule) 
    112112        , (strNode "global", boolToYaml global) 
     
    124124        va' <- toYaml va 
    125125        return (ka', va') 
    126     return $ mkNode (YamlMap yamlmap) 
     126    return $ mkNode (EMap yamlmap) 
    127127hashToYaml r = error ("unexpected node: " ++ show r) 
    128128