Bespin is built to have multiple syntax highlighting engines so people can experiment. We already have two syntax engines:
- simple: This is the default engine that was built from scratch to be very fast for our implementation. Although fast, it is very simple and basic (doesn't grok variables and such)
- codemirror: Roberto Saccon ported the codemirror engine over. It is smarter and can give you error checking and AST based work. It uses the Malte Ubl work to do things in a Web Worker
More details below:
The simple system lives in frontend/js/bespin/syntax/simple (e.g. here).
Each language lives within there as languagename.js.
At the end make sure that you register your system with the various types that you may want to use:
The core code in the simple system is a trivial state machine that processes a line on its own merits, and just holds a flag to note whether the system is in a multi-line comment, and that is that!
The codemirror system lives in the codemirror directory and has its own thing going on.
Great stuff, and much more detail and color.
If you implement a new file, please consider submitting it to us so we can put it in!