Daydreams about incremental vs partial parse
WisiToken currently supports "partial-parse"; Emacs passes only part of a file to the parser, in order to speed up the response. Emacs ada-mode uses regular expressions to find the start and end point of the parse region. This works fairly well, but not as well as I'd like, which is the motivation behind implementing incremental parse.
Incremental parse is initially intended to replace partial-parse, but it might be useful to keep both.
"Standard" incremental parse requires a full parse when the file is first opened; that will be my initial approach. Some of my customers report that the most common use case is navigating in files, to understand the code; navigation typically requires a full file parse anyway.
I've daydreamed about relaxing that; using the current partial parse initially, and extending the parsed region on demand. There could be several disjoint parsed regions in a file (that's supported now by the wisi Gnu ELPA package; it does not require direct support in WisiToken).
Ideally there would be a right-to-left parser to extend a parsed region towards the start of the file, as well as the current left-to-right parser. "demand" is pretty fuzzy; the first demand for parsing a region will typically be Emacs requesting face information for syntax highlighting - if the new region is "close to" an existing parsed region, extending that region would be prefered over creating a new partial parse region. Error correction might require extending the parse in either direction. Some navigation requests can be satisfied by growing the parsed region incrementally; "move to next/previous subprogram", "move to start of current declarative region".
Comments
Post a Comment