yi-editor / yi

The Haskell-Scriptable Editor
GNU General Public License v2.0
1.5k stars 200 forks source link

Nestable highlighters #295

Open ethercrow opened 11 years ago

ethercrow commented 11 years ago

Original author: nicolas....@gmail.com (March 16, 2009 14:56:52)

Example of usage:

Original issue: http://code.google.com/p/yi-editor/issues/detail?id=252

ethercrow commented 11 years ago

From gwe...@gmail.com on March 16, 2009 16:03:00

  • Quasiquotations one day we should be able to nicely display using a customizable way things [$sql| SELECT * FROM people |] or [$regex|(a|[bc])|] or [$html| Boo |]...

I don't really follow this example. Are you trying to give an example of a Haskell source file which Yi would highlight as Haskell, but within particular fragments (as specified by the Haskell parser), yi would highlight as a different language?

ethercrow commented 11 years ago

From nicolas....@gmail.com on March 23, 2009 11:55:11 @gwern0 exactly

noughtmare commented 7 years ago

I was just reading "Combinator Parsing: A Short Tutorial" by Doaitse Swierstra and found this:

Usually one is satisfied to have just a single way of scanning the input, but sometimes one may want to use a parser for one language as sub- parser in the parser for another language. An example of this is when one has a Haskell parser and wants to recognise a String value. Of course one could offload the recognition of string values to the tokeniser, but wouldn’t it be nice if we could just call the parser for strings as a sub-parser, which uses single characters as its token type? A second example arises when one extend a language like Java with a sub-language like AspectJ, which again has Java as a sub-language. Normally this creates all kind of problems with the scanning process, but if we are able to switch from scanner type, many problems disappear.

I am now trying to understand the parsers mentioned in that paper and adapting them to make them work with Yi.