From 0e6186b95909b9b78ca605f785922639f0786bef Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Sat, 17 Dec 2022 21:35:06 +0300 Subject: [PATCH] Add RBBuild Def syntax highlighting --- README.md | 1 + rbdef.sublime-syntax | 72 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 rbdef.sublime-syntax diff --git a/README.md b/README.md index c3ae692..28b0121 100644 --- a/README.md +++ b/README.md @@ -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 "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 "rbdef.sublime-syntax" https://kaos.sh/blackhole-theme-sublime/rbdef.sublime-syntax bat cache --build ``` diff --git a/rbdef.sublime-syntax b/rbdef.sublime-syntax new file mode 100644 index 0000000..15cf254 --- /dev/null +++ b/rbdef.sublime-syntax @@ -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