just/extras/just.sublime-syntax

76 lines
2.3 KiB
Plaintext
Raw Normal View History

2021-06-09 19:20:04 -07:00
%YAML 1.2
---
# http://www.sublimetext.com/docs/syntax.html
name: Just
file_extensions: [.justfile, just, justfile]
2021-06-09 19:20:04 -07:00
scope: source.just
contexts:
main:
- include: interpolate
- include: comments
- include: scripts
- include: strings
- include: assignments
- include: recipeDefinition
- include: recipeContent
- include: functions
2021-06-09 19:20:04 -07:00
- include: keywords
assignments:
- match: '^(export\s+)?([a-zA-Z_][a-zA-Z0-9_-]*)\s*(:=)'
2021-06-09 19:20:04 -07:00
captures:
1: storage.modifier.just
2: variable.other.just
3: keyword.operator.assignment.just
2021-06-09 19:20:04 -07:00
comments:
- match: '#[^!].*'
2021-06-09 19:20:04 -07:00
scope: comment.line.just
interpolate:
- match: '(?<!\{)\{\{(?!\{)'
2021-06-09 19:20:04 -07:00
push:
- meta_scope: string.interpolated.just
- match: '\}\}'
pop: true
functions:
- match: \b(arch|os|os_family|env_var|env_var_or_default|invocation_directory|justfile|justfile_directory|just_executable|lowercase|quote|replace|trim|trim_end|trim_end_match|trim_end_matches|trim_start|trim_start_match|trim_start_matches|uppercase|absolute_path|extension|file_name|file_stem|parent_directory|without_extension|join|clean|path_exists|error|sha256|sha256_file|uuid|capitalize)\b(?=\()
scope: entity.name.function.just
2021-06-09 19:20:04 -07:00
keywords:
- match: \b(if|else|while)\b
2021-06-09 19:20:04 -07:00
scope: keyword.control.just
recipeDefinition:
- match: '^(@)?([a-zA-Z_][a-zA-Z0-9_-]*)\s*([\+\*])?([a-zA-Z0-9_]*)?\s*(=)?\s*([a-zA-Z0-9_-`''"]*):([\sa-zA-Z0-9_-]*).*$'
2021-06-09 19:20:04 -07:00
captures:
1: storage.modifier.just
2021-06-09 19:20:04 -07:00
2: entity.name.function.just
3: keyword.operator.just
4: variable.parameter.just
5: keyword.operator.just
6: string.interpolated.just
7: support.type.property-name.just
recipeContent:
- match: '^\s+([-@]*)'
captures:
1: storage.modifier.just
2021-06-09 19:20:04 -07:00
scripts:
- match: '\s#\!'
2021-06-09 19:20:04 -07:00
comment: The #! lines within a recipe.
push:
- meta_scope: support.type.property-name.just
- match: $
pop: true
strings:
- match: '`'
push:
- meta_scope: string.quoted.triple.just
- match: '`'
pop: true
- match: '"'
push:
- meta_scope: string.quoted.double.just
- match: '"'
pop: true
- match: "'"
push:
- meta_scope: string.quoted.single.just
- match: "'"
pop: true