Add Ninja syntax highlighting

This commit is contained in:
Ján Priner 2020-10-20 19:32:14 +02:00
parent a3f037773a
commit fc1f37d3df
3 changed files with 56 additions and 0 deletions

3
.gitmodules vendored
View File

@ -197,3 +197,6 @@
[submodule "assets/syntaxes/02_Extra/Apache"]
path = assets/syntaxes/02_Extra/Apache
url = https://github.com/colinta/ApacheConf.tmLanguage
[submodule "assets/syntaxes/02_Extra/Ninja"]
path = assets/syntaxes/02_Extra/Ninja
url = https://github.com/pope/SublimeNinja.git

1
assets/syntaxes/02_Extra/Ninja vendored Submodule

@ -0,0 +1 @@
Subproject commit 25830aaec9316b7fca6600000535214164525d7a

View File

@ -0,0 +1,52 @@
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Ninja
file_extensions:
- ninja
scope: source.ninja
contexts:
main:
- match: (#).*$\n?
comment: Comment line.
scope: comment.line.number-sign.ninja
captures:
1: punctuation.definition.comment.ninja
- match: ^(rule)\b
comment: Rule keyword and keywords for a rule.
captures:
1: keyword.other.ninja
push:
- match: ^(?=\S)
pop: true
- include: main
- match: \b(?:command|deps|depfile|description|generator|pool|restat|rspfile|rspfile_content)\b
scope: keyword.other.ninja
- match: ^(pool)\b
comment: Pool keyword and keywords for a pool.
captures:
1: keyword.other.ninja
push:
- match: ^(?=\S)
pop: true
- include: main
- match: \b(?:depth)\b
scope: keyword.other.ninja
- match: ^(?:build|rule|default|include|subninja)\b
comment: Other Keywords.
scope: keyword.other.ninja
- match: '(?:[=:]|\|{1,2})(?=\s)'
comment: Operators for variable assignment (=), rule definition (:), implicit (|) and order only (||) dependencies.
scope: keyword.operator.ninja
- match: \$$
comment: Line wrap.
scope: keyword.operator.ninja
- match: \$\$
comment: Dollar literal.
scope: keyword.operator.ninja
- match: '\$[[:alnum:]_-]+'
comment: Simple variables, e.g. $var.
scope: variable.other.ninja
- match: '\${[[:alnum:]_.-]+}'
comment: "Variables, e.g. ${some.var.name}."
scope: variable.other.ninja