-
Notifications
You must be signed in to change notification settings - Fork 0
/
sfz.sublime-syntax
75 lines (64 loc) · 1.8 KB
/
sfz.sublime-syntax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
%YAML 1.2
---
# SFZ File Format Syntax Highlighting for Sublime Text
#
# Created by David Hilowitz ([email protected])
# Modified by RedTide ([email protected])
#
name: SFZ
file_extensions:
- sfz
scope: source.sfz
variables:
macros: '^\s*(\#\s*define|\#\s*include)\b'
defined_variables: '\s*(\$\s*[aA-zZ_0-9]+)\b'
headers: '<region>|<group>|<control>|<global>|<curve>|<effect>|<master>'
opcodes: \b([a-z0-9_]+)=([aA-zZ0-9_.-]+)\b
contexts:
main:
# SFZ macro directives
- match: '{{macros}}'
captures:
1: keyword.sfz
# $defined variables
- match: '{{defined_variables}}'
captures:
1: constant.numeric.sfz
# SFZ headers
- match: '{{headers}}'
scope: keyword.control.sfz
# SFZ opcodes
- match: '{{opcodes}}'
captures:
1: constant.numeric.sfz
2: variable.annotation.sfz
# Comments begin with a '//' and finish at the end of the line
- match: '//'
scope: punctuation.definition.comment.sfz
push: line_comment
# Block comment
- match: '/\*'
scope: punctuation.definition.comment.begin.sfz
push: block_comment
# Strings begin and end with quotes, and use backslashes as an escape character
- match: '"'
scope: punctuation.definition.string.begin.sfz
push: double_quoted_string
line_comment:
- meta_scope: comment.line.sfz
- match: '$'
pop: true
block_comment:
- meta_scope: comment.block.sfz
- match: '\\.'
scope: constant.character.escape.sfz
- match: '\*/'
scope: punctuation.definition.comment.end.sfz
pop: true
double_quoted_string:
- meta_scope: string.quoted.double.sfz
- match: '\\.'
scope: constant.character.escape.sfz
- match: '"'
scope: punctuation.definition.string.end.sfz
pop: true