marzer / tomlplusplus

Header-only TOML config file parser and serializer for C++17.
https://marzer.github.io/tomlplusplus/
MIT License
1.57k stars 150 forks source link

Event interface / SAX #107

Open mizvekov opened 3 years ago

mizvekov commented 3 years ago

Is your feature request related to a problem? Please describe. I'd like to consume the input file on the go, without having to create an intermediate DOM representation.

Describe the solution you'd like A SAX-like parser interface.

Additional context This would make it easier to use in some memory constrained situations.

marzer commented 3 years ago

This would make it easier to use in some memory constrained situations.

Is this actually a blocker for you, or only hypothetical?

mizvekov commented 3 years ago

Not so much of a blocker because:

But however:

If supporting this feature would have undesired costs, I understand, but then please take this as a request to expound the reasoning behind it in the documentation :) And thanks for the effort in publishing this library, it's really well done and appreciated!

marzer commented 3 years ago

Well truthfully my first reaction was "wow that would be so much work", but after thinking about it some more it probably wouldn't be all that hard after all. My implementation cheats somewhat by not doing the 'proper' lex+parse two-step, and instead only scans through the document once (needing only to keep a very small rewind buffer), so I could actually build an event-based interface fairly easily by simply invoking some user event instead of creating the nodes while walking the tree.

All that is moot, however, since I won't have time to do this for ages. The project's backlog is gradually getting away from me...

mizvekov commented 3 years ago

No problem, totally understand :)