-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
Request for feature: partial parsing #192
Comments
I do like the idea of incremental parsing. Most previous discussion has revolved around implementing a streaming lexer that blocks until the input is completely consumed. Would that satisfy your use case? |
Ideally, I'd like the following things:
If a streaming parser can do that, then sounds good to me. Though, it seems like I would need to utilise goroutines with that to get the desired result, when it should probably be a single-goroutine affair. |
It's also useful for IDE syntax highlighting. |
Description:
A new method that starts the parser as usual, but returns:
State is either "Incomplete" (the structure isn't fully parsed) or "Complete" (the structure is fully parsed).
Resumption is something that will allow you to resume parsing with more tokens if State == Incomplete.
If it hits EOF while in the middle of parsing a structure, it pauses, returning something to allow you to resume the parsing from where it left off with new input instead of erroring.
Usecase:
REPLs.
Something like:
The text was updated successfully, but these errors were encountered: