Re: Spot editing a YAML document
"Nicolas Pouillard" <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
Note: Sorry for double posts Excerpts from Oren Ben-Kiki's message of Wed Apr 09 18:56:02 +0200 2008: > The spec itself is neutral on this, it just defines what is or isn't > valid YAML. In principle, if you dump(load(YAML)), all the presentation > details may be lost (it could come out as JSON! :-). That said, > preserving such details is useful as you point out. This however > requires a different sort of interface... For example, a streaming > transformer API (newValue = callback(oldValue) or some such). I don't > think there are such implementations though. > > Of course you could "cheat". In your example, *if* your YAML is > *guaranteed* to be formatted in a specific way, a simple > Perl/Ruby/Python - even sed - script could do the trick... Perhaps that writing a YAML parser in bidirectional language will works great. Boomrang [1] is such a language and it could be interesting to try something like this. The claimed advantage of this language is to be bidirectional, so when you parse something and then loose some layout information to more abstract data, the language know how to reverse the transformation even if the output is changed. However more you mutate the output less the reverse transformation will be able to restore the missing details. Regards, [1]: http://www.seas.upenn.edu/~harmony/ -- Nicolas Pouillard aka Ertai ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Yaml-core mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/yaml-core
signature.asc
(application/pgp-signature, 194 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAkf9OxEACgkQj+FCNw9dwLkxwQCgkJRFRuvSm69inHkXlP5Kq+N1 XZcAnR7rASQrHlpifWfWEFlrEcLlZNNn =IAQ/ -----END PGP SIGNATURE-----