Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 268 lines (253 sloc) 8.01 kB
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
1 { scopeName = 'source.StringTemplate';
2 fileTypes = ( 'stg', 'sti', 'st' );
3 foldingStartMarker = '(\[|<<|\$if(.*)\$)\s*$';
4 foldingStopMarker = '(\]|>>|\$endif\$)';
5 patterns = (
6 { include = '#class'; },
7 { include = '#map'; },
07ce161 Lots of fixes.
Nick Dunn authored
8 { include = '#methods'; },
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
9 { name = 'comment.line.double-slash.StringTemplate';
10 match = '//.*\n';
11 },
12 { name = 'comment.block.empty.StringTemplate';
13 match = '/\*\*/';
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
14 captures = { 0 = { name = 'punctuation.definition.comment.StringTemplate'; }; };
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
15 },
16 { name = 'comment.block';
17 begin = '(/\*|\$!)';
18 end = '(\*/|!\$)';
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
19 captures = { 0 = { name = 'punctuation.definition.comment.StringTemplate'; }; };
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
20 },
21 { match = '\s*((//).*$\n?)';
22 captures = {
23 1 = { name = 'comment.line.double-slash.java'; };
24 2 = { name = 'punctuation.definition.comment.java'; };
25 };
26 },
27 { include = '#string'; },
28 { include = '#template'; },
29 );
30 repository = {
07ce161 Lots of fixes.
Nick Dunn authored
31 anonymous_template = {
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
32 name = 'storage.anonymous_template.StringTemplate';
07ce161 Lots of fixes.
Nick Dunn authored
33 begin = '{';
34 end = '}';
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
35 beginCaptures = { 0 = { name = 'punctuation.section.anonymous_template.begin.StringTemplate'; }; };
36 endCaptures = { 0 = { name = 'punctuation.section.anonymous_template.end.StringTemplate'; }; };
37 patterns = ( { include = '#'; } );
07ce161 Lots of fixes.
Nick Dunn authored
38 };
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
39 class = {
40 name = 'meta.class.StringTemplate';
41 begin = '\b(?=group|interface)\b';
42 end = ';';
43 endCaptures = { 0 = { name = 'punctuation.section.class.end.StringTemplate'; }; };
44 patterns = (
45 { include = '#class_name'; },
46 { include = '#parent_class'; },
47 { include = '#interfaces'; },
48 );
49 };
50 class_name = {
51 match = '(group|interface)\s+(\w+)';
52 captures = {
53 1 = { name = 'storage.type.class.StringTemplate'; };
54 2 = { name = 'entity.name.type.class.StringTemplate'; };
55 };
56 };
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
57 conditional = {
58 patterns = (
59 { include = '#if'; },
60 { include = '#else'; },
61 );
62 };
63 else = {
64 name = 'keyword.control.conditional.StringTemplate';
65 match = '(else|endif)';
66 disabled = 0;
67 };
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
68 group = {
69 match = '\s*(\w+)\s*(:\s*(\w+))?';
70 captures = {
71 1 = { name = 'entity.name.type.class.StringTemplate'; };
72 2 = { name = 'punctuation.separator'; };
73 3 = { name = 'entity.other.inherited-class.StringTemplate'; };
74 };
75 };
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
76 if = {
77 name = 'meta.conditional.StringTemplate';
78 begin = '(if|elseif)(\()';
79 end = '(\)*)';
80 beginCaptures = {
81 1 = { name = 'keyword.control.conditional.StringTemplate'; };
82 2 = { name = 'punctuation.section.conditional.begin.StringTemplate'; };
83 };
84 endCaptures = { 0 = { name = 'punctuation.section.conditional.end.StringTemplate'; }; };
85 };
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
86 interfaces = {
87 match = '(implements)\s+(\w+)\s*(,\s*(\w+))*';
88 captures = {
89 1 = { name = 'keyword.control.StringTemplate'; };
90 2 = { name = 'entity.other.type.interface.StringTemplate'; };
91 4 = { name = 'entity.other.type.interface.StringTemplate'; };
92 };
93 };
07ce161 Lots of fixes.
Nick Dunn authored
94 keywords = {
95 patterns = (
96 { name = 'keyword.reserved.StringTemplate';
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
97 match = '(default|first|group|if|implements|interface|last|length|optional|rest|strip|super|trunc|else|endif|elseif)';
07ce161 Lots of fixes.
Nick Dunn authored
98 },
99 );
100 };
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
101 map = {
102 name = 'meta.structure.dictionary.StringTemplate';
103 begin = '(\w+)\s*(::=)\s*(\[)';
104 end = '\]';
07ce161 Lots of fixes.
Nick Dunn authored
105 beginCaptures = {
106 1 = { name = 'support.function.StringTemplate'; };
107 2 = { name = 'punctuation.definition.array.begin.StringTemplate'; };
108 3 = { name = 'punctuation.definition.array.begin.StringTemplate'; };
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
109 };
110 endCaptures = { 0 = { name = 'punctuation.definition.array.end.StringTemplate'; }; };
111 patterns = (
112 { name = 'keyword.control.StringTemplate';
113 match = '\b(default|key)\b';
114 },
115 { include = '#string'; },
07ce161 Lots of fixes.
Nick Dunn authored
116 { name = 'invalid.map.unquoted.StringTemplate';
117 match = '\b[^"].*[^"]\b';
118 disabled = 1;
119 },
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
120 );
121 };
122
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
123
124 assignment = {
125 name = 'meta.variable.assignment';
126 begin = '(\w+)';
127 end = '';
128
129 };
130
131
132 lhs = {
133 comment='The left side of an assignment statement';
134 name = 'variable.parameter.StringTemplate';
135
136 };
137 rhs = {
138 comment='Anything that can be used in as the right hand side of an assignment statement';
139
140 patterns = (
141 { include = '#string'; },
142 { include = '#anonymous_template'; },
143 );
144
145 };
146
147
148 methods = {
149 name = 'meta.method.StringTemplate';
150 begin = '(?=\w.*\s+)(?=[^=]+\()';
151 end = '(\>\>)';
152 patterns = (
153 { name = 'meta.method.identifier.StringTemplate';
154 begin = '(\w+)\s*\(';
155 end = '\)';
156 beginCaptures = { 1 = { name = 'entity.name.function.StringTemplate'; }; };
157 patterns = ( { include = '#parameters'; } );
158 },
159 { name = 'meta.method.body.StringTemplate';
c237a83 Some more comments.
Nick Dunn authored
160 comment = 'We need to use positive lookahead with the end token so that it is not consumed; if it''s consumed then the meta.method.StringTemplate piece will not find a matching >> to close it.';
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
161 begin = '(::=\<\<)';
162 end = '(?=\>\>)';
163 beginCaptures = { 0 = { name = 'punctuation.section.function.begin.StringTemplate'; }; };
164 endCaptures = { 0 = { name = 'punctuation.section.function.end.StringTemplate'; }; };
165 patterns = (
c237a83 Some more comments.
Nick Dunn authored
166 { name = 'comment.block.StringTemplate';
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
167 begin = '(\$!)';
168 end = '(!\$)';
169 captures = { 0 = { name = 'punctuation.definition.comment.StringTemplate'; }; };
170 },
171 { include = '#stringtemplate'; },
172 );
173 },
174 );
175 };
176 named_args = {
177 begin = '\b(\w+)\s*(=)(?!=)';
178 end = '\s*(?=(,)|(\)))';
179 beginCaptures = {
180 1 = { name = 'variable.parameter.function.StringTemplate'; };
181 2 = { name = 'keyword.operator.assignment.StringTemplate'; };
182 3 = { name = 'variable.parameter'; };
183 };
184 endCaptures = { 1 = { name = 'punctuation.separator.parameters.StringTemplate'; }; };
185 patterns = (
186 { include = '#anonymous_template'; },
187 { include = '$self'; },
188 );
189 };
190 parameters = {
191 contentName = 'meta.function.parameters.StringTemplate';
192 patterns = (
193 { include = '#named_args'; },
194 { name = 'variable.parameter.StringTemplate';
195 match = '\w+';
196 },
197 );
198 };
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
199 parent_class = {
200 match = '(:)\s*(\w+)';
201 captures = {
202 1 = { name = 'punctuation.separator'; };
203 2 = { name = 'entity.other.inherited-class.StringTemplate'; };
204 };
205 };
206 string = {
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
207 name = 'string.quoted.double.StringTemplate';
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
208 begin = '(")';
209 end = '(")';
210 patterns = (
211 { name = 'constant.character.escape.untitled';
212 match = '\\.';
213 },
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
214 { include = '#template'; },
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
215 );
216 };
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
217 stringtemplate = {
218 patterns = (
219 { include = '#template'; },
220 { include = '#string'; },
221 );
07ce161 Lots of fixes.
Nick Dunn authored
222 };
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
223 template = {
224 name = 'storage.other.StringTemplate';
225 begin = '[$]';
226 end = '[$]';
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
227 beginCaptures = { 0 = { name = 'support.punctuation.section.template.begin.StringTemplate'; }; };
228 endCaptures = { 0 = { name = 'support.punctuation.section.template.end.StringTemplate'; }; };
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
229 patterns = (
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
230 {
231 name = 'punctuation.terminator.StringTemplate';
232 match = '(;)';
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
233 },
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
234
235 { include = '#keywords'; },
236 { include = '#conditional'; },
237 { include = '#variable_access'; },
238 { include = '#template_call'; },
239 { include = '#anonymous_template'; },
240
241
242 { include = '#named_args'; },
243
244
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
245 { name = 'entity.name.tag.StringTemplate';
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
246 match = '(;)\s*(\w+)\s*=\s*["{](.*)["}]';
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
247 captures = {
248 1 = { name = 'punctuation.terminator.StringTemplate'; };
249 2 = { name = 'variable.parameter.StringTemplate'; };
250 3 = { name = 'string.quoted.double.StringTemplate'; };
251 };
252 },
253 { name = 'constant.character.escape.untitled';
254 match = '{.*}';
255 },
256 );
257 };
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
258 template_call = {
259 name = 'meta.method.identifier.StringTemplate';
260 match = '\w+';
07ce161 Lots of fixes.
Nick Dunn authored
261 };
3f0e8e5 Lots of fixes/improvements to the StringTemplate grammar file.
Nick Dunn authored
262 variable_access = {
263 name = 'variable.other.StringTemplate';
264 match = '(\w+)(([.])\(?(\w+)\)?)*';
265 captures = { 3 = { name = 'punctuation.separator.StringTemplate'; }; };
07ce161 Lots of fixes.
Nick Dunn authored
266 };
0ff936c Ongoing evolution of the grammar file. Sample group file.
Nick Dunn authored
267 };
268 }
Something went wrong with that request. Please try again.