question: is incremental parsing possible?
See original GitHub issueI have the use case where I need to parse a text line by line. At the first line, the parser can start at its start
position. At the end of the line, the parser should store its state (e.g. in which context is is) in a hashable object. When parsing any line that is not the first line, the state of the end of the previous line is restored and the current line is parsed.
(This is how QSyntaxHighlighter (from Qt) is organized. When the user types in a certain line, that line is re-highlighted. And when its state at the end is different than it was beforehand, the next line is also re-highlighted, and so on.)
Would this be possible using the lark parser? From my own experimentation and docs reading I can only parse a full text (or file) in one go.
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (13 by maintainers)
Top GitHub Comments
The existing interactive parser can be used to create a small wrapper that does this.
Im not sure if I am more impressed by the response time or the actual solution … This is amazing! I definitely feel like this could be part of the tutorials. Right now I do not have time to write it myself and submit a PR, but if there is interest I can give it a go at a later time point.