-
Notifications
You must be signed in to change notification settings - Fork 4
/
Starling.sublime-syntax
122 lines (104 loc) · 2.69 KB
/
Starling.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
%YAML 1.2
---
name: Starling
file_extensions: [cvf]
scope: source.starling
variables:
environments: 'thread|shared'
basic_types: 'int|bool'
control_keywords: 'do|else|for|if|while'
identifier: '[_a-zA-Z]([_0-9a-zA-Z])*'
contexts:
prototype:
- include: comments
block_comment:
- meta_scope: comment.block.starling
- match: /\*
scope: punctuation.definition.comment.starling
push: block_comment
- match: \*/
pop: true
comments:
- match: //
scope: punctuation.definition.comment.starling
push:
- meta_scope: comment.line.double-slash.starling
- match: \n
pop: true
- match: /\*
scope: punctuation.definition.comment.starling
push: block_comment
typename:
- match: \b({{basic_types}})\b
scope: storage.type.starling
pop: true
- match: \b({{identifier}})\b
scope: entity.name.type.starling
pop: true
keywords:
- match: \b({{control_keywords}})\b
scope: keyword.control.starling
# temporary
- match: \b(view|pragma)\b
scope: keyword.control.starling
literals:
- match: \b([0-9]*(\.[0-9]+)?)\b
scope: constant.numeric
- match: \b(true|false)\b
scope: constant.language.boolean.starling
constraint_view:
- meta_content_scope: string.view.starling
- match: ->
scope: punctuation.other.constraint_entail.starling
pop: true
constraints:
- match: \b(constraint)\b
scope: keyword.other.starling
push: constraint_view
method_name:
- meta_content_scope: entity.name.function.starling
- match: \(
pop: true
methods:
- match: \b(method)\b
scope: keyword.other.method.starling
push: method_name
views:
- match: \{\|
scope: [meta.braces, punctuation.section.braces.begin]
push:
- meta_scope: string.view.starling
- match: \|\}
scope: [meta.braces, punctuation.section.braces.end]
pop: true
#
# Variable declarations
#
vardecl_after_typename:
- match: \b({{identifier}})\b
scope: variable.other.vardecl.starling
- match: \,
scope: punctuation.separator.vardecl.starling
- match: ;
scope: punctuation.terminator.vardecl.starling
pop: true
vardecls:
- match: \b({{environments}})\b
scope: storage.modifier.starling
set: [vardecl_after_typename, typename]
#
# Typedefs
#
typedefs:
- match: \b(typedef)\b
scope: keyword.control.starling
set: [typename, typename]
main:
- include: types
- include: keywords
- include: literals
- include: constraints
- include: methods
- include: views
- include: vardecls
- include: typedefs