-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.sublime-syntax
210 lines (193 loc) · 4.97 KB
/
model.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
# Alexander Danylchenko
# BMC model syntax file highligh.
# 2017-08-14 - Latest version.
# Will be used also to convert in Atom CSON format
name: model
file_extensions:
- model
scope: source.model
contexts:
main:
- include: traverse
- include: all_keys
- include: errors
- include: keywords_all
- include: lines
- match: \(
push: brackets
- match: \)
scope: invalid.illegal.stray-bracket-end
# repository: OLD FORMAT DO NOT UNCOMMENT!
brackets:
- match: \)
pop: true
- include: main
# NEEDED ATTRIBUTES:
keywords_attrs:
- match: (\")(key|name|type|version|short_name|install_root|listening_ports|product_version)(\")
captures:
1: keyword.control.model
2: variable.parameter.model
3: keyword.control.model
# 1: storage.type.model
keywords_all:
- include: keywords_attrs
# Lines and comments and quotes:
# // THIS LINE`
comment_line:
- match: //.*
scope: comment.line.model
comment_TODO_line:
- match: (//)\s?(TODO\:)
comment: variable.parameter.model
captures:
1: comment.line.model
2: keyword.control.model
push:
- match: (.*)
captures:
1: variable.parameter.model
pop: true
double_qouted_line:
# - match: '\"(?:[^\\"]|\\\\|\\")*\"'
- match: '(\")((?:[^\\"]|\\\\|\\")*)(\")'
comment: variable.parameter.model
captures:
1: keyword.control.model
2: string.quoted.single.model
3: keyword.control.model
# push:
# # - match: \#(?:(\w+)(:|\.))+(\w+)
# - match: '(\#InferredElement\:Inference\:Contributor\:Package\.name)'
# captures:
# 1: keyword.control.model
# pop: true
percent_line:
- match: "%([^%]+)%"
scope: keyword.control.model
captures:
1: variable.parameter.model
qouted_line:
- match: '\''([^'']+?)\'''
captures:
1: string.quoted.single.model
square_brackets_line_int:
- match: '\[(-?\d+)\]'
captures:
1: constant.numeric.model
square_brackets_line_word:
- match: '\[(\w+[^\d+])\]'
captures:
1: variable.parameter.model
lines:
- include: percent_line
- include: comment_TODO_line
- include: comment_line
- include: qouted_line
- include: double_qouted_line
- include: square_brackets_line_word
- include: square_brackets_line_int
- include: all_keys
# ERRORS:
# none
none_attr:
- match: '\b(None)'
captures:
1: invalid.illegal.model
hash_attr:
- match: '(#)\s+"(\S+)":\s+(None)'
captures:
1: invalid.illegal.model
2: keyword.control.tplpre
3: invalid.illegal.model
errors:
- include: none_attr
- include: hash_attr
# Keys
plus:
- match: \+
scope: keyword.operator.assignment.model
var_assign:
- match: \:\=
# scope: keyword.operator.assignment.model
scope: constant.numeric.integer.model
double_q:
- match: '(\"\"){1}'
scope: comment.model
single_q:
- match: '(\''\''){1}'
scope: comment.model
equal:
- match: \=
scope: keyword.operator.assignment.model
less:
- match: \<
scope: keyword.operator.model
less_equal:
- match: \<\=
scope: keyword.operator.model
more:
- match: \>
scope: keyword.operator.model
more_equal:
- match: \>\=
scope: keyword.operator.model
decimal:
- match: \s\d+\s
scope: constant.numeric.integer.model
decimal_ext:
- match: \s\d+
minus_decimal:
- match: \s\-\d+\s
scope: constant.numeric.integer.model
just_do:
- match: (\.)
scope: punctuation.accessor.model
captures:
1: keyword.operator.model
just_doble_dot:
- match: (\:)
scope: punctuation.accessor.model
captures:
1: keyword.operator.model
all_keys:
- include: var_assign
- include: equal
- include: less
- include: more
- include: more_equal
- include: less_equal
- include: plus
- include: decimal
- include: minus_decimal
- include: decimal_ext
- include: just_do
- include: just_doble_dot
# Path to TRAVERCE
traverse:
# - match: (\#(?:(\w+)(:|\.))+(\w+))
- match: \"(\#(?:(\w+)(:|\.))+(\w+))\"\:\s\[
comment: entity.name.function.model
captures:
1: entity.name.function.model
2: variable.parameter.model
# 3: keyword.control.model
4: keyword.control.model
# 5: keyword.control.model
# push:
# - match: '\b(Package)'
# captures:
# 1: string.quoted.single.model
# pop: false
# - match: '\b(SoftwareInstance)'
# captures:
# 1: string.quoted.single.model
# pop: false
# - match: '\b(InferredElement)'
# - match: '\S+(InferredElement)\S+'
# captures:
# 1: string.quoted.single.model
# pop: true