Boost logo

Boost :

From: Marcin Kalicinski (kalita_at_[hidden])
Date: 2006-04-22 17:50:53


> Hmm the INI parser seems to support skipping of comments, don't see why it
> can't take the same approach as XML? And are you saying that the comments
> would be preserved in an XML config?

The reason why comments are preserved in XML parser is because XML standard
supports comment nodes. They are part of the data.

> I'm running out the door so I'll have to answer your questions later, but
> I'll
> say that I think the adding a new node is pretty easy. It doesn't exist
> so
> there is nothing to preserve. As for comments, they need to fit into the
> property_tree in some way so that they can be written back. I could
> probably
> live without perfect whitespace preservation, but no comments on write is
> a
> dealbreaker for me.

I understand that. Comments seem to be much easier to handle than
whitespace, but still I think there are plenty of corner cases that we would
need to consider, even in such a simple format as INI. For example, how
about multiline comments, should they be concatenated into one node, or
should each separate line get its own node? How about comments like that:

[Section]
key1 = value1 ;comment1
;comment2
key2 = value2

Where would we store information that comment1 uses the same line as key1?
Without it after save it would go to the next line, and be incorrectly
associated (by human) with key2.

One solution might be to create a mapping between comments and non-comment
nodes, so that every comment is associated with a node. During save we will
use this information to appropriately position comments. This mapping would
be in form of another set of nodes stored somewhere in the tree.

Best regards,
Marcin


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk