Re:The Definitive Guide to Syntax Highlighting
by philbo on Sunday September 28, 2014 @06:20AM
(#8379363)
There are actually a few implementations of this for JS, it is an approach that Crockford has championed quite a bit (e.g https://plus.google.com/+DouglasCrockfordEsq/posts/XXkzgJEoE...).
Some implementations that I'm aware of, there may be others:
* http://www.vim.org/scripts/script.php?script_id=4748
* https://github.com/mazurov/sublime-levels
* https://github.com/daniellmb/JavaScript-Scope-Context-Colori...
Re:The Definitive Guide to Syntax Highlighting
by seanmcdirmid on Sunday September 28, 2014 @05:23AM
(#8379303)
Parsing is easy to do incrementally, but you could get there just by matching braces. I think Python-like offside rules are better for highlight purposes, however; e.g. see:
http://research.microsoft.com/en-us/projects/liveprogramming...
This would be useful in langues that make heavy use of callbacks such as javascript or scala.
Not sure how hard it would be to implement though - it might require a full parse or compiler pass.