-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
source.tcl.js
153 lines (151 loc) · 4.99 KB
/
source.tcl.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is licensed permissive.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.adp', '.glf', '.sdc', '.tcl', '.tcl.in', '.tm', '.xdc'],
names: ['glyph', 'sdc', 'tcl', 'xdc'],
patterns: [
{
begin: '(?<=^|;)\\s*((#))',
beginCaptures: {
1: {name: 'comment.line.number-sign.tcl'},
2: {name: 'punctuation.definition.comment.tcl'}
},
contentName: 'comment.line.number-sign.tcl',
end: '\\n',
patterns: [{match: '(\\\\\\\\|\\\\\\n)'}]
},
{
captures: {1: {name: 'keyword.control.tcl'}},
match:
'(?<=^|[\\[{;])\\s*(if|while|for|catch|return|break|continue|switch|exit|foreach)\\b'
},
{
captures: {1: {name: 'keyword.control.tcl'}},
match: '(?<=^|})\\s*(then|elseif|else)\\b'
},
{
captures: {
1: {name: 'keyword.other.tcl'},
2: {name: 'entity.name.function.tcl'}
},
match: '^\\s*(proc)\\s+([^\\s]+)'
},
{
captures: {1: {name: 'keyword.other.tcl'}},
match:
'(?<=^|[\\[{;])\\s*(after|append|array|auto_execok|auto_import|auto_load|auto_mkindex|auto_mkindex_old|auto_qualify|auto_reset|bgerror|binary|cd|clock|close|concat|dde|encoding|eof|error|eval|exec|expr|fblocked|fconfigure|fcopy|file|fileevent|filename|flush|format|gets|glob|global|history|http|incr|info|interp|join|lappend|library|lindex|linsert|list|llength|load|lrange|lreplace|lsearch|lset|lsort|memory|msgcat|namespace|open|package|parray|pid|pkg::create|pkg_mkIndex|proc|puts|pwd|re_syntax|read|registry|rename|resource|scan|seek|set|socket|SafeBase|source|split|string|subst|Tcl|tcl_endOfWord|tcl_findLibrary|tcl_startOfNextWord|tcl_startOfPreviousWord|tcl_wordBreakAfter|tcl_wordBreakBefore|tcltest|tclvars|tell|time|trace|unknown|unset|update|uplevel|upvar|variable|vwait)\\b'
},
{
begin: '(?<=^|[\\[{;])\\s*(regexp|regsub)\\b\\s*',
beginCaptures: {1: {name: 'keyword.other.tcl'}},
end: '[\\n;]|(?=\\])',
patterns: [
{match: '\\\\(?:.|\\n)', name: 'constant.character.escape.tcl'},
{match: '-\\w+\\s*'},
{
applyEndPatternLast: true,
begin: '--\\s*',
patterns: [{include: '#regexp'}]
},
{include: '#regexp'}
]
},
{include: '#escape'},
{include: '#variable'},
{
begin: '"',
beginCaptures: {0: {name: 'punctuation.definition.string.begin.tcl'}},
end: '"',
endCaptures: {0: {name: 'punctuation.definition.string.end.tcl'}},
name: 'string.quoted.double.tcl',
patterns: [
{include: '#escape'},
{include: '#variable'},
{include: '#embedded'}
]
}
],
repository: {
'bare-string': {
begin: '(?:^|(?<=\\s))"',
end: '"([^\\s\\]]*)',
endCaptures: {1: {name: 'invalid.illegal.tcl'}},
patterns: [{include: '#escape'}, {include: '#variable'}]
},
braces: {
begin: '(?:^|(?<=\\s))\\{',
end: '\\}([^\\s\\]]*)',
endCaptures: {1: {name: 'invalid.illegal.tcl'}},
patterns: [
{match: '\\\\[{}\\n]', name: 'constant.character.escape.tcl'},
{include: '#inner-braces'}
]
},
embedded: {
begin: '\\[',
beginCaptures: {0: {name: 'punctuation.section.embedded.begin.tcl'}},
end: '\\]',
endCaptures: {0: {name: 'punctuation.section.embedded.end.tcl'}},
name: 'source.tcl.embedded',
patterns: [{include: 'source.tcl'}]
},
escape: {
match: '\\\\(\\d{1,3}|x[a-fA-F0-9]+|u[a-fA-F0-9]{1,4}|.|\\n)',
name: 'constant.character.escape.tcl'
},
'inner-braces': {
begin: '\\{',
end: '\\}',
patterns: [
{match: '\\\\[{}\\n]', name: 'constant.character.escape.tcl'},
{include: '#inner-braces'}
]
},
regexp: {
begin: '(?=\\S)(?![\\n;\\]])',
end: '(?=[\\n;\\]])',
patterns: [
{
begin: '(?=[^ \\t\\n;])',
end: '(?=[ \\t\\n;])',
name: 'string.regexp.tcl',
patterns: [
{include: '#braces'},
{include: '#bare-string'},
{include: '#escape'},
{include: '#variable'}
]
},
{
begin: '[ \\t]',
end: '(?=[\\n;\\]])',
patterns: [
{include: '#variable'},
{include: '#embedded'},
{include: '#escape'},
{include: '#braces'},
{include: '#string'}
]
}
]
},
string: {
applyEndPatternLast: true,
begin: '(?:^|(?<=\\s))(?=")',
name: 'string.quoted.double.tcl',
patterns: [{include: '#bare-string'}]
},
variable: {
captures: {1: {name: 'punctuation.definition.variable.tcl'}},
match: '(\\$)((?:[a-zA-Z0-9_]|::)+(\\([^\\)]+\\))?|\\{[^\\}]*\\})',
name: 'variable.other.tcl'
}
},
scopeName: 'source.tcl'
}
export default grammar