TSL Syntax Highlighter
This extension allows users to add basic syntax highlighting to their TSL (.tsl, .tslmt) files!
Features
This extension utilizes a TextMate Grammar to tokenize and highlight a TSL specification files.
The grammar is as follows:
start := comment | keyword | operator | constant | identifier | string
comment := commentLine | commentBlock
commentLine := "^\/\/.*$"
commentBlock := "/*" commentBlock "*/"
keyword := control | operator | other
control := "\b(A|F|G|H|O|R|S|T|U|W|X|Y|otherwise|_)\b"
operator := "\b(AND|CAP|CUP|DIV|ELEM|EQ|EQUIV|GE|GEQ|IMPLIES|IN|LE|LEQ|MAX|MIN|MINUS|MOD|MUL|NEQ|NOT|OR|PLUS|PROD|SETMINUS|SIZE|SUM)\b"
other := "\b(import|as|initially|always|assume|guarantee|after)\b"
op := "[!&|\-<=\/\+\*%\(:~,\.\[][!&|<\->=\/\\\[\+\*%\(\):~,\]]*"
constant := bool | digit
bool := "\b(true|false)\b"
digit := "[1-9][0-9]*"
identifier := "[A-Za-z_@][A-Za-z_@'.]*"
string := '"' stringBlock '"'
commentBlock := (NOT */)*
stringBlock := (NOT ")*
Usage
To enable the highlighter, select the Language Mode toggle in the lower right corner of the window and search for TSL .
| |