Re: C/C++ interface to YAML files

Zenaan Harkness <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
On Wed, Dec 19, 2007 at 08:01:04PM -0500, Chris Ross wrote:
> 
> On Dec 19, 2007, at 19:47, Zenaan Harkness wrote:
> > You may find a full YAML loader, which has proper support for YAML  
> > spec, is
> > significantly more flexibility (complexity) than you need. Here's part
> > of the Reference:
> >
> > %YAML 1.1   # Reference card
> > ---
> > Collection indicators:
> >     '? ' : Key indicator.
> >     ': ' : Value indicator.
> >     '- ' : Nested series entry indicator.
> >     ', ' : Separate in-line branch entries.
> >     '[]' : Surround in-line series branch.
> >     '{}' : Surround in-line keyed branch.
> >
> > (www.yaml.org from memory)
> >
> > Your arrays are right there...
> 
>    Right.  I knew YAML supported all of that.  Are you suggesting I  
> might
> be better off not having a "real" YAML parser, but instead just
> implementing a subset of the spec myself?  Eh.  I hate to do that sort
> of thing, but you may well be right...  I will need more than just  
> arrays,

No, I recommend using the fullest parser you have access to, or can
write. If you're inclined to write one, check out www.antlr.org - even
has a GUI/IDE for productions generation/ editing.

> I think, but.  Something like:
> 
> item1:
>    ? key : value
>    ? key2 : [ foo, bar, baz ]
> item2:
>    ? key
>    : value4
>    ? key2
>    : [ laa, dee, daa ]
> item3: { key: value7, key2: [ bob, dog ] }
> 
>    And, I don't even expect to have a need for that form of value for
> key2, but that was the "I thought I'd likely want someday" type of thing
> I was thinking...
> 
>    Using a full YAML parser, all of the options described above, which
> are all valid YAML, "just work".
> 
>    This make sense?

Of course.

Now all you needs an adequate YAML parser for your language of choice...

zen


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.