Changeset 8585 for src/Pugs/Prim/Yaml.hs

Show
Ignore:
Timestamp:
01/05/06 18:14:10 (3 years ago)
Author:
gaal
Message:

YAML emitting

  • "moose".yaml; 42.yaml; (undef).yaml work
  • (123.12).yaml gives funny results (because it's delegated to pugs' pretty-printer

Tests very welcome!

Files:
1 modified

Legend:

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

    r8566 r8585  
    77import Pugs.Internals 
    88import Pugs.AST 
     9import Pugs.Pretty 
    910import Data.Yaml.Syck 
    1011import qualified Data.Map as Map 
     
    4546toYaml :: Val -> Eval YamlNode 
    4647toYaml VUndef = return YamlNil 
     48--toYaml (VNum num) = return $ YamlStr -- better handled by pretty 
    4749toYaml (VStr str) = return $ YamlStr (encodeUTF8 str) 
    4850toYaml (VList nodes) = do 
    4951    fmap YamlSeq $ mapM toYaml nodes 
     52toYaml x = return $ YamlStr $ encodeUTF8 $ pretty x 
    5053--toYaml (VHash hash) = do 
    5154--    fmap YamlMap $ Map.toList hash