Changeset 8604

Show
Ignore:
Timestamp:
01/07/06 11:59:25 (3 years ago)
Author:
gaal
Message:

* .yaml emits objects.

TODO:
- make it parse them, too
- serialize rules, native types, etc.

Location:
src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • src/Data/Yaml/Syck.hsc

    r8603 r8604  
    9494emitNode :: (?e :: SyckEmitter) -> YamlNode -> IO () 
    9595emitNode YamlNil = do 
    96     withCString "string" $ \string_literal ->        
     96    withCString "string" $ \stringLiteral ->        
    9797        withCString "~" $ \cs ->        
    98             syck_emit_scalar ?e string_literal scalarNone 0 0 0 cs 1 
     98            syck_emit_scalar ?e stringLiteral scalarNone 0 0 0 cs 1 
    9999 
    100100emitNode (YamlStr str) = do 
    101     withCString "string" $ \string_literal ->        
     101    withCString "string" $ \stringLiteral ->        
    102102        withCString str $ \cs ->        
    103             syck_emit_scalar ?e string_literal scalarNone 0 0 0 cs (toEnum $ length str) 
     103            syck_emit_scalar ?e stringLiteral scalarNone 0 0 0 cs (toEnum $ length str) 
    104104 
    105105emitNode (YamlSeq seq) = do 
    106     withCString "array" $ \array_literal -> 
    107         syck_emit_seq ?e array_literal seqNone 
     106    withCString "array" $ \arrayLiteral -> 
     107        syck_emit_seq ?e arrayLiteral seqNone 
    108108    -- TODO: fix pesky warning about "integer from pointer without a cast" here 
    109109    mapM_ (syck_emit_item ?e) =<< (mapM freezeNode seq) 
     
    111111 
    112112emitNode (YamlMap tag m) = do 
    113     -- trace ("hash<" ++ maybe "" id tag ++">: " ++ (show m)) $ return () 
    114     withCString (maybe "hash" id tag) $ \hash_literal -> do 
    115         syck_emit_map ?e hash_literal mapNone 
    116         when (isJust tag) (do {syck_emit_tag ?e hash_literal nullPtr ; return ()}) 
     113    --trace ("hash<" ++ maybe "" id tag ++">: " ++ (show m)) $ return () 
     114    withCString (maybe "hash" id tag) $ \hashLiteral -> do 
     115        syck_emit_map ?e hashLiteral mapNone 
    117116    flip mapM_ m (\(k,v) -> do 
    118117        syck_emit_item ?e =<< freezeNode k 
  • src/Pugs/Prim/Yaml.hs

    r8603 r8604  
    6767    hash    <- fromVal v :: Eval VHash 
    6868    attrs   <- toYaml $ VRef (hashRef hash) 
    69     return $ addTag (Just $ "!pugs:object/" ++ showType (objType obj)) attrs 
     69    return $ addTag (Just $ "tag:pugs:object:" ++ showType (objType obj)) attrs 
    7070    where 
    7171    addTag _   (YamlMap (Just x) _) = error ("can't add tag: already tagged with" ++ x)