-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.txl.js
48 lines (46 loc) · 1.8 KB
/
source.txl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/MikeHoffert/Sublime-Text-TXL-syntax>
// and licensed `apache-2.0`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.txl'],
names: ['txl'],
patterns: [
{
match:
"\\b(?<!')(define|end|function|keys|compounds|tokens|comments|replace|construct|by|replace|rule|deconstruct|not|where|all|not|assert|export|import|redefine|external|match|skipping|include|then)\\b",
name: 'keyword.control'
},
{
captures: {1: {name: 'keyword.control'}},
match:
"(?<!')#\\s*(pragma|endif|else|define|undef|undefine|ifn|elifn|elifdef|elifndef|ifndef|ifdef|if|end)",
name: 'meta.preprocessor'
},
{begin: "(?<!')%[\\({]", end: "(?<!')[\\)}]%", name: 'comment'},
{match: "(?<!')%.*", name: 'comment'},
{
match:
"(?<!')\\[(not|opt|repeat|list|see|push|pop|\\+|-|/|\\*|=|<|>|\\^|\\.|div|rem|:|#|index|_|length|select|head|tail|,|~=|>=|<=|grep|\\$|quote|unquote|parse|unparse|reparse|typeof|istype|read|write|fget|getp|fput|putp|fputp|fputs|fclose|fopen|fgets|message|pragma|quit|system|pipe|attr) .+?\\]",
name: 'entity.name.function'
},
{
match:
"(?<!')\\[(NL|EX(_\\d+)?|IN(_\\d+)?|SP(_\\d+)?|TAB(_\\d+)?|SPON|SPOFF|\\!|round|trunc|toupper|tolower|get|put|gets|print|printattr|debug|breakpoint)\\]",
name: 'constant.language'
},
{match: "(?<!')\\[.+?\\]", name: 'storage.type'},
{
match: '\\b(\\d+)|(\\d+\\.\\d+([\\+-][Ee]\\d+)?)\\b',
name: 'constant.numeric'
},
{match: '".*"', name: 'string.quoted.double'}
],
scopeName: 'source.txl'
}
export default grammar