Skip to content

Commit 906e0fe

Browse files
committed
Add named contexts for string body
1 parent b0c2030 commit 906e0fe

File tree

1 file changed

+35
-27
lines changed

1 file changed

+35
-27
lines changed

Crontab.sublime-syntax

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -212,19 +212,7 @@ contexts:
212212
1: punctuation.definition.variable.crontab
213213
2: meta.completion.at.crontab
214214

215-
###[ MISCELLANEOUS ]###########################################################
216-
217-
comments:
218-
- match: ^\s*(?=#)
219-
push: comment
220-
221-
comment:
222-
- match: '#'
223-
scope: punctuation.definition.comment.crontab
224-
push:
225-
- meta_scope: comment.line.number-sign.crontab
226-
- include: pop-nl
227-
- include: pop-nl
215+
###[ ENVIRONMENT VARIABLES ]###################################################
228216

229217
variables:
230218
- match: ^([a-zA-Z0-9_]+)\s*(=)
@@ -237,23 +225,43 @@ contexts:
237225
- include: pop-nl
238226
- match: '"'
239227
scope: punctuation.definition.string.begin.crontab
240-
set:
241-
- meta_scope: string.quoted.double.crontab
242-
- match: '"'
243-
scope: punctuation.definition.string.end.crontab
244-
pop: true
228+
set: string-body-double
245229
- match: "'"
246230
scope: punctuation.definition.string.begin.crontab
247-
set:
248-
- meta_scope: string.quoted.single.crontab
249-
- match: "'"
250-
scope: punctuation.definition.string.end.crontab
251-
pop: true
231+
set: string-body-single
252232
- match: \S
233+
push: string-body-unquoted
234+
235+
string-body-double:
236+
- meta_scope: meta.string.crontab string.quoted.double.crontab
237+
- match: '"'
238+
scope: punctuation.definition.string.end.crontab
239+
pop: 1
240+
241+
string-body-single:
242+
- meta_scope: meta.string.crontab string.quoted.single.crontab
243+
- match: "'"
244+
scope: punctuation.definition.string.end.crontab
245+
pop: 1
246+
247+
string-body-unquoted:
248+
- meta_scope: meta.string.crontab string.unquoted.crontab
249+
- match: (?=\s*$)
250+
pop: 1
251+
252+
###[ MISCELLANEOUS ]###########################################################
253+
254+
comments:
255+
- match: ^\s*(?=#)
256+
push: comment
257+
258+
comment:
259+
- match: '#'
260+
scope: punctuation.definition.comment.crontab
253261
push:
254-
- meta_scope: string.unquoted.crontab
255-
- match: (?=\s*$)
256-
pop: true
262+
- meta_scope: comment.line.number-sign.crontab
263+
- include: pop-nl
264+
- include: pop-nl
257265

258266
illegal-punctuation:
259267
- match: \*{2,}|[/,?-]{2,}|,(?=[ \t])
@@ -271,7 +279,7 @@ contexts:
271279

272280
pop-nl:
273281
- match: $\n?
274-
pop: true
282+
pop: 1
275283

276284
###############################################################################
277285

0 commit comments

Comments
 (0)