Skip to content

Commit 21511c4

Browse files
committed
Added support for interfaces
1 parent 616e40f commit 21511c4

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

AngelScript.sublime-syntax

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ contexts:
4343
push:
4444
- include: global
4545
- include: has-namespaces
46+
- include: has-interfaces
4647
- include: has-classes
4748
- include: has-enums
4849
- include: has-definitions
@@ -83,6 +84,25 @@ contexts:
8384
scope: punctuation.section.block.end
8485
pop: true
8586

87+
interface:
88+
- match: 'interface'
89+
scope: storage.type.interface
90+
set:
91+
- meta_scope: meta.interface
92+
- include: global
93+
- match: '{{identifier}}'
94+
scope: entity.name.interface
95+
- match: '{'
96+
scope: punctuation.section.block.begin
97+
push:
98+
- include: global
99+
- include: has-definitions
100+
- match: '(?=})'
101+
pop: true
102+
- match: '}'
103+
scope: punctuation.section.block.end
104+
pop: true
105+
86106
enum:
87107
- match: 'enum'
88108
scope: storage.type.enum
@@ -562,6 +582,10 @@ contexts:
562582
- match: '\b(?=namespace)\b'
563583
push: namespace
564584

585+
has-interfaces:
586+
- match: '\b(?=interface)\b'
587+
push: interface
588+
565589
has-classes:
566590
- include: has-metadatas
567591
- match: '\b(?=class)\b'
@@ -612,6 +636,7 @@ contexts:
612636

613637
main:
614638
- include: has-namespaces
639+
- include: has-interfaces
615640
- include: has-classes
616641
- include: has-enums
617642
- include: has-definitions

syntax_test_stuff.as

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SYNTAX TEST "Packages/User/AngelScript.sublime-syntax"
1+
// SYNTAX TEST "Packages/Crackshell/AngelScript.sublime-syntax"
22

33
#author "Openplanet"
44
// <- meta.preprocessor keyword.control.import
@@ -34,6 +34,18 @@ void func2(const string &in str, SValue& sval) {}
3434
// ^ keyword.other
3535
// ^^^^ variable.parameter
3636

37+
interface IThing
38+
// <- meta.interface storage.type.interface
39+
// ^^^^^^ entity.name.interface
40+
{
41+
// <- punctuation.section.block.begin
42+
void func();
43+
// <- storage.type
44+
// ^^^^ entity.name.function
45+
// ^ punctuation.terminator
46+
}
47+
// <- punctuation.section.block.end
48+
3749
enum MyEnum
3850
// <- storage.type.enum
3951
// ^^^^^^ entity.name.enum

0 commit comments

Comments
 (0)