Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event interface / SAX #107

Open
mizvekov opened this issue May 31, 2021 · 4 comments
Open

Event interface / SAX #107

mizvekov opened this issue May 31, 2021 · 4 comments
Assignees
Labels
feature New feature or enhancement request

Comments

@mizvekov
Copy link

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.

@mizvekov mizvekov added the feature New feature or enhancement request label May 31, 2021
@marzer
Copy link
Owner

marzer commented Jun 1, 2021

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

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

@mizvekov
Copy link
Author

mizvekov commented Jun 1, 2021

Not so much of a blocker because:

  • Not even sure of JSON vs TOML as this point.
  • The language / grammar is simple enough that it would not be prohibitive to develop something in-house.

But however:

  • This is a potential replacement to something JSON based that already uses event-based interface.
  • Even other TOML C++ implementations offer event-based parser interface, but they however seem to be abandoned and otherwise not as of high quality as this one.

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
Copy link
Owner

marzer commented Jun 1, 2021

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
Copy link
Author

mizvekov commented Jun 1, 2021

No problem, totally understand :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or enhancement request
Projects
None yet
Development

No branches or pull requests

2 participants