Skip to content

Commit fe00a3a

Browse files
committed
Added asset preprocessor directives to all syntaxes
1 parent d98975f commit fe00a3a

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

AngelScript.sublime-syntax

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,8 @@ contexts:
541541
1: keyword.control.import
542542
push:
543543
- meta_scope: meta.preprocessor
544+
- match: '//.*'
545+
scope: comment.line
544546
- match: '(?i)(if|else|endif)\b'
545547
scope: support.function
546548
set: preprocessor-expression

SValue.sublime-syntax

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,44 @@ variables:
1111
valid_functions: '(loader|d|dict|a|array)'
1212
valid_types: '(h|hstring|s|string|i|int|long|f|float|b|bool|vec[234]|ivec[234]|bytes|null)'
1313
contexts:
14+
preprocessor-expression:
15+
- match: '\b[A-Z0-9_]+\b'
16+
scope: entity.name.constant
17+
- match: '(\|\||&&)'
18+
scope: keyword.operator.logical
19+
- match: '"'
20+
scope: punctuation.definition.string.begin
21+
push:
22+
- meta_scope: string.quoted.double
23+
- match: '"'
24+
scope: punctuation.definition.string.end
25+
pop: true
26+
- match: '$'
27+
pop: true
28+
29+
has-preprocessor:
30+
- match: '^\s*(%)'
31+
captures:
32+
1: keyword.control.import
33+
push:
34+
- meta_scope: meta.preprocessor
35+
- match: '//.*'
36+
scope: comment.line
37+
- match: '(?i)(if|else|endif)\b'
38+
scope: support.function
39+
set: preprocessor-expression
40+
- match: '(PROFILE_START|PROFILE_STOP)\b'
41+
scope: support.function
42+
set:
43+
- meta_scope: string.unquoted
44+
- match: '$'
45+
pop: true
46+
- match: '[A-Za-z_][A-Za-z0-9_]+'
47+
scope: keyword.control.import
48+
set: preprocessor-expression
49+
- match: '$'
50+
pop: true
51+
1452
comment:
1553
- match: '<!--'
1654
scope: punctuation.definition.comment.begin
@@ -39,6 +77,7 @@ contexts:
3977

4078
main:
4179
- include: comment
80+
- include: has-preprocessor
4281
- match: '(<)/?$'
4382
captures:
4483
1: invalid.illegal.missing-entity

Unit.sublime-syntax

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,44 @@ variables:
88
valid_functions: '()'
99
valid_types: '(unit|scenes|scene|collision|point|frame|sizes|colors|group)'
1010
contexts:
11+
preprocessor-expression:
12+
- match: '\b[A-Z0-9_]+\b'
13+
scope: entity.name.constant
14+
- match: '(\|\||&&)'
15+
scope: keyword.operator.logical
16+
- match: '"'
17+
scope: punctuation.definition.string.begin
18+
push:
19+
- meta_scope: string.quoted.double
20+
- match: '"'
21+
scope: punctuation.definition.string.end
22+
pop: true
23+
- match: '$'
24+
pop: true
25+
26+
has-preprocessor:
27+
- match: '^\s*(%)'
28+
captures:
29+
1: keyword.control.import
30+
push:
31+
- meta_scope: meta.preprocessor
32+
- match: '//.*'
33+
scope: comment.line
34+
- match: '(?i)(if|else|endif)\b'
35+
scope: support.function
36+
set: preprocessor-expression
37+
- match: '(PROFILE_START|PROFILE_STOP)\b'
38+
scope: support.function
39+
set:
40+
- meta_scope: string.unquoted
41+
- match: '$'
42+
pop: true
43+
- match: '[A-Za-z_][A-Za-z0-9_]+'
44+
scope: keyword.control.import
45+
set: preprocessor-expression
46+
- match: '$'
47+
pop: true
48+
1149
comment:
1250
- match: '<!--'
1351
scope: punctuation.definition.comment.begin
@@ -48,6 +86,7 @@ contexts:
4886

4987
main:
5088
- include: comment
89+
- include: has-preprocessor
5190
- match: '(<)/?$'
5291
captures:
5392
1: invalid.illegal.missing-entity

0 commit comments

Comments
 (0)