Add RBBuild Def syntax highlighting

This commit is contained in:
Anton Novojilov 2022-12-17 21:35:06 +03:00
commit 0e6186b959
2 changed files with 73 additions and 0 deletions

View file

@ -39,6 +39,7 @@ curl -OL# -o "bibop-recipe.sublime-syntax" https://kaos.sh/blackhole-theme-subli
curl -OL# -o "knf.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/knf.sublime-syntax curl -OL# -o "knf.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/knf.sublime-syntax
curl -OL# -o "rpm-spec.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/rpm-spec.sublime-syntax curl -OL# -o "rpm-spec.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/rpm-spec.sublime-syntax
curl -OL# -o "ansible.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/ansible.sublime-syntax curl -OL# -o "ansible.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/ansible.sublime-syntax
curl -OL# -o "rbdef.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/rbdef.sublime-syntax
bat cache --build bat cache --build
``` ```

72
rbdef.sublime-syntax Normal file
View file

@ -0,0 +1,72 @@
%YAML 1.2
---
# https://www.sublimetext.com/docs/syntax.html
name: RBBuild Def
scope: source.rbdef
first_line_match: "# -- \\[RBdef\\] --"
contexts:
main:
- include: comments
- include: strings
- include: variables
- include: keywords
comments:
- match: (?=^\s*#)
push:
- match: \#
scope: punctuation.definition.comment
set:
- meta_scope: comment.line
- include: pop-on-line-end
- match: \#
scope: punctuation.definition.comment
push:
- meta_scope: comment.line
- include: pop-on-line-end
strings:
- match: '"'
scope: punctuation.definition.string.begin
push:
- meta_scope: string.quoted.double
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: $
scope: punctuation.definition.string.end
pop: true
- include: variables
- match: "'"
scope: punctuation.definition.string.begin
push:
- meta_scope: string.quoted.single
- match: "'"
scope: punctuation.definition.string.end
pop: true
- match: $
scope: punctuation.definition.string.end
pop: true
variables:
- match: '\{([a-zA-Z0-9_-]+)\}'
captures:
0: variable.other
keywords:
- match: '^[\t ]+([a-zA-Z0-9]+)(:)'
captures:
1: entity.name.function
2: keyword.operator.assignment
- match: '^([a-zA-Z0-9]+)\(([^\)]+)\)(:)'
captures:
1: variable.annotation
2: variable.parameter
3: keyword.operator.assignment
- match: '^\[([\w\d]+)\]$'
scope: keyword
pop-on-line-end:
- match: $
pop: true