Skip to content

Commit def1585

Browse files
committed
[#17] Adopt ST YAML regex format with no quotes unless required.
1 parent 60757bc commit def1585

1 file changed

Lines changed: 38 additions & 38 deletions

File tree

Syntax/Just.sublime-syntax

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ contexts:
8484
###[ IMPORTS ]#################################################################
8585

8686
includes:
87-
- match: '^(!include) (.*)$'
87+
- match: ^(!include) (.*)$
8888
scope: meta.statement.import.just
8989
captures:
9090
1: keyword.control.import.just
@@ -93,7 +93,7 @@ contexts:
9393
###[ ALIASES ]#################################################################
9494

9595
aliases:
96-
- match: '^(alias)\s+({{valid_name}})\s*(:=)\s+({{valid_name}})(?=.*$)'
96+
- match: ^(alias)\s+({{valid_name}})\s*(:=)\s+({{valid_name}})(?=.*$)
9797
captures:
9898
1: support.function.export.just
9999
2: variable.other.just
@@ -157,16 +157,16 @@ contexts:
157157
###[ IF STATEMENT ]############################################################
158158

159159
if-statements:
160-
- match: 'if\b'
160+
- match: if\b
161161
scope: keyword.control.conditional.if.just
162162
push: if-statement-condition-body
163-
- match: 'else\b'
163+
- match: else\b
164164
scope: keyword.control.conditional.else.just
165165
push: else-statement-block
166166

167167
if-statement-condition-body:
168168
- meta_scope: meta.statement.conditional.if.just
169-
- match: '{'
169+
- match: \{
170170
scope: punctuation.section.block.begin.just
171171
push: if-else-block-body
172172
- match: '!=|==|=~'
@@ -176,14 +176,14 @@ contexts:
176176

177177
else-statement-block:
178178
- meta_scope: meta.statement.conditional.else.just
179-
- match: '{'
179+
- match: \{
180180
scope: punctuation.section.block.begin.just
181181
push: if-else-block-body
182182
- include: else-pop
183183

184184
if-else-block-body:
185185
- meta_scope: meta.block.just
186-
- match: '}'
186+
- match: \}
187187
scope: punctuation.section.block.end.just
188188
pop: 2
189189
- include: just-expressions
@@ -193,7 +193,7 @@ contexts:
193193

194194
operators:
195195
- include: punctuation-separators
196-
- match: '(\+|\/)'
196+
- match: (\+|\/)
197197
scope: keyword.operator.arithmetic.just
198198

199199
punctuation-separators:
@@ -282,7 +282,7 @@ contexts:
282282

283283
operands-variables:
284284
# First check for an invalid function
285-
- match: '\b({{valid_name}})\b\s*(\()'
285+
- match: \b({{valid_name}})\b\s*(\()
286286
captures:
287287
1: source.just
288288
2: invalid.illegal.just
@@ -293,7 +293,7 @@ contexts:
293293
###[ VARIABLE ASSIGNMENT ]#####################################################
294294

295295
assignment:
296-
- match: '(export)?\s*({{valid_name}})\s*(?=:=)'
296+
- match: (export)?\s*({{valid_name}})\s*(?=:=)
297297
captures:
298298
1: keyword.declaration.variable.just
299299
2: variable.other.just
@@ -314,23 +314,23 @@ contexts:
314314
# Recipe definition lines, including attributes, arguments and dependencies
315315

316316
recipe-attribute:
317-
- match: '^\[\s*({{recipe_attributes}})\s*\]\s*$' # Only one attribute allowed per line
317+
- match: ^\[\s*({{recipe_attributes}})\s*\]\s*$ # Only one attribute allowed per line
318318
scope: meta.annotation.just variable.annotation.just
319319

320320
recipe-definition:
321-
- match: '(?=^@?{{valid_name}}(?![^:]*:=))' # Matches '^recipeName' but not '^varName :='
321+
- match: (?=^@?{{valid_name}}(?![^:]*:=)) # Matches '^recipeName' but not '^varName :='
322322
push:
323323
- recipe-body
324324
- recipe-name
325325
- recipe-modifier
326326

327327
recipe-modifier:
328-
- match: '^@'
328+
- match: ^@
329329
scope: meta.function.just storage.modifier.quiet.just
330330
- include: else-pop
331331

332332
recipe-name:
333-
- match: '\b{{valid_name}}'
333+
- match: \b{{valid_name}}
334334
scope: meta.function.just entity.name.function.just
335335
pop: 1 # Only match the first instance
336336
push:
@@ -347,7 +347,7 @@ contexts:
347347

348348
recipe-parameter:
349349
- meta_content_scope: meta.function.parameters.just
350-
- match: '(?=[\+\*$a-zA-Z_])'
350+
- match: (?=[\+\*$a-zA-Z_])
351351
push:
352352
- recipe-parameter-assignment
353353
- recipe-parameter-name
@@ -362,30 +362,30 @@ contexts:
362362
- include: else-pop
363363

364364
recipe-export-operator:
365-
- match: '\$(?=\s*{{valid_name}})'
365+
- match: \$(?=\s*{{valid_name}})
366366
scope: keyword.operator.exported.just
367367
- match: '[\+\*\$]'
368368
scope: invalid.illegal.just
369369
- include: else-pop
370370

371371
recipe-parameter-assignment:
372-
- match: '='
372+
- match: =
373373
scope: keyword.operator.assignment.just
374374
push:
375375
- include: just-expressions
376-
- match: '(\s+|(?=:))'
376+
- match: (\s+|(?=:))
377377
pop: 1
378378
- include: else-pop
379379

380380
recipe-parameter-name:
381-
- match: '\b{{valid_name}}\b'
381+
- match: \b{{valid_name}}\b
382382
scope: variable.parameter.just
383383
- include: else-pop
384384

385385
recipe-dependencies:
386386
- match: (?=\()
387387
push: recipe-dependency-with-args
388-
- match: '\b{{valid_name}}\b'
388+
- match: \b{{valid_name}}\b
389389
scope: variable.function.just
390390
- match: '&&'
391391
scope: keyword.operator.logical.just
@@ -399,7 +399,7 @@ contexts:
399399

400400
recipe-dependency-with-args-body:
401401
- meta_scope: meta.group.just
402-
- match: '\b{{valid_name}}'
402+
- match: \b{{valid_name}}
403403
scope: variable.function.just
404404
push:
405405
- include: just-expressions
@@ -437,10 +437,10 @@ contexts:
437437
recipe-generic-content:
438438
- include: recipe-content-interpolations
439439
- include: recipe-content-strings
440-
- match: '(\\)$\n?'
440+
- match: (\\)$\n?
441441
captures:
442442
1: punctuation.separator.continuation.line.just
443-
- match: '$\n'
443+
- match: $\n
444444
comment: |
445445
No trailing '?', so this will NOT match lines matched by the previous rule.
446446
There is no pop there, so this context will remain on the stack WITHOUT the
@@ -449,7 +449,7 @@ contexts:
449449
pop: 1
450450

451451
recipe-content-modifiers:
452-
- match: '^\s+((@)|(-)(@)|(-)|(@)(-))(?!-)'
452+
- match: ^\s+((@)|(-)(@)|(-)|(@)(-))(?!-)
453453
captures:
454454
2: storage.modifier.quiet.just
455455
3: storage.modifier.ignore-error.just
@@ -460,15 +460,15 @@ contexts:
460460
- include: else-pop
461461

462462
recipe-content-interpolations:
463-
- match: '\{\{\{\{'
463+
- match: \{\{\{\{
464464
comment: Escaped double brace. Do nothing
465-
- match: '\{\{(?!\{)'
465+
- match: \{\{(?!\{)
466466
scope: punctuation.section.interpolation.begin.just
467467
push: recipe-content-interpolation-body
468468

469469
recipe-content-interpolation-body:
470470
- meta_scope: meta.interpolation.just
471-
- match: '\}\}'
471+
- match: \}\}
472472
scope: punctuation.section.interpolation.end.just
473473
pop: 1
474474
- include: just-expressions
@@ -499,9 +499,9 @@ contexts:
499499
- include: recipe-content-string-interpolations
500500

501501
recipe-content-string-interpolations:
502-
- match: '\{\{\{\{'
502+
- match: \{\{\{\{
503503
comment: Escaped double brace. Do nothing
504-
- match: '\{\{(?!\{)'
504+
- match: \{\{(?!\{)
505505
scope: punctuation.section.interpolation.begin.just
506506
push: recipe-content-string-interpolation-body
507507

@@ -515,7 +515,7 @@ contexts:
515515
# Ex: "set shell := ['zsh', '-cu']", "set dotenv-load", "set export := false"
516516

517517
settings:
518-
- match: '^set(?=\s+)'
518+
- match: ^set(?=\s+)
519519
scope: storage.modifier.definition.just
520520
push:
521521
- settings-invalid
@@ -524,29 +524,29 @@ contexts:
524524
- settings-string
525525

526526
settings-invalid:
527-
- match: '\b({{valid_name}})\b\s*:='
527+
- match: \b({{valid_name}})\b\s*:=
528528
captures:
529529
1: invalid.illegal.just
530530
- include: else-pop
531531

532532
settings-boolean:
533-
- match: '\b{{boolean_settings}}\b'
533+
- match: \b{{boolean_settings}}\b
534534
scope: entity.name.definition.just
535535
push:
536536
- constant-boolean
537537
- assignment-operator
538538
- include: else-pop
539539

540540
settings-string:
541-
- match: '\b{{string_settings}}\b'
541+
- match: \b{{string_settings}}\b
542542
scope: entity.name.definition.just
543543
push:
544544
- assignment-operator
545545
- include: strings
546546
- include: else-pop
547547

548548
settings-shell:
549-
- match: '\b{{shell_settings}}\b'
549+
- match: \b{{shell_settings}}\b
550550
scope: entity.name.definition.just
551551
push:
552552
- string-array
@@ -561,19 +561,19 @@ contexts:
561561
- include: else-pop
562562

563563
string-array:
564-
- match: '\['
564+
- match: \[
565565
scope: punctuation.section.brackets.start.just
566566
- match: ','
567567
scope: punctuation.separator.parameters.just
568-
- match: '\]'
568+
- match: \]
569569
scope: punctuation.section.brackets.end.just
570570
pop: 1
571571
- include: strings
572572

573573
# ###[ General Types ]##########################################################
574574

575575
variable-name:
576-
- match: '\b{{valid_name}}\b'
576+
- match: \b{{valid_name}}\b
577577
scope: variable.other.just
578578
- include: else-pop
579579

@@ -595,5 +595,5 @@ contexts:
595595
pop: 1
596596

597597
eol-pop:
598-
- match: '$\n?'
598+
- match: $\n?
599599
pop: 1

0 commit comments

Comments
 (0)