Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Syntax Highlighting for Lama2

We use Iro for generating syntax grammars for multiple text editors in one go.

Source Grammar

See Lama2.iro for the source syntax grammar.

Generated Grammars

VSCode

Source file: textmate.plist

Iro generates a Textmate syntax file in the Plist format. We must convert the Plist file into JSON using wtools. If the converted output is wrapped up in a list [], then remove that part. After removing unnecessary junk, we will have a nice syntax JSON of the form {}. See the VSCode plugin, particularly package.json and syntaxes/lama2.tmGrammar.json

UPDATE: After adding request chaining, the generated plist doesn't work as is (with the above minor mods). It took a difficult 5h debugging session to find many issues with how textmate syntax handles line-ends. The present grammar json file in VSCode is heavily modified from the original.

Learnings:

  1. "Chaining begin/end" so that "end" tokens are properly consumed ref1
  2. Exploiting oniguruma regex implementation (particularly lookbehind). Iro doesn't support lookbehind. But VSCode-oniguruma does thankfully. ref2

Other

Using Iro

For interative usage, head over to iro web.

Post the source file lama2.iro into the editor.

Load up a sample lama2 doc, and hit the play button.

Iro learning resources

Following are some other useful resources related to Iro: