-
Notifications
You must be signed in to change notification settings - Fork 0
/
cyclone.sublime-syntax
164 lines (135 loc) · 4.11 KB
/
cyclone.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
%YAML 1.2
---
# Author: Hao Wu
# 09-Feb-2022
# 17-MAR-2022: [const, <->]
# @TO-DO:factor rules for more different color schemes.
name: Cyclone
file_extensions:
- cyclone
scope: cyclone
version: 1.0
variables:
identifier: \b[[:alpha:]_][[:alnum:]_]*\b
section: '\b(graph|machine|node|state|trans|transition|edge|record)\b'
condition: '\b(assert|condition|goal|in)\b'
invariant: '\binvariant\b'
contexts:
main:
- match: '{{section}}'
scope: entity.name.class
push:
- entity-name
- match: '{{invariant}}'
scope: entity.name.class
push:
- invariant-name
- match: '{{identifier}}\.'
scope: variable.function
push:
- member-name
# Strings begin and end with quotes, and use backslashes as an escape
# character
- match: '"'
scope: punctuation.definition.string.begin.example
push: double_quoted_string
# Comments begin with a '//' and finish at the end of the line
- match: '//'
scope: punctuation.definition.comment.example
push: line_comment
- match: ^/\* =(\s*.*?)\s*= \*/$\n?
scope: comment.block
captures:
1: meta.toc-list.banner.block
- match: /\*
scope: punctuation.definition.comment
push:
- meta_scope: comment.block
- match: \*/
scope: punctuation.definition.comment
pop: true
- match: ^\s*(\*)(?!/)
captures:
1: punctuation.definition.comment
- match: \*/(?!\*)
scope: invalid.illegal.stray-comment-end
- match: ^// =(\s*.*?)\s*=\s*$\n?
scope: comment.line.banner
captures:
1: meta.toc-list.banner.line
- match: //
scope: punctuation.definition.comment
push:
- meta_scope: comment.line.double-slash
- match: '(\\)$\n'
captures:
1: punctuation.separator.continuation
- match: \n
pop: true
- match: '{{section}}'
scope: keyword.other
- match: '{{condition}}'
scope: entity.name.type
- match: '\b(start|final|const|always|some|one)\b'
scope: entity.name.tag
- match: '\b(abstract|normal)\b'
scope: keyword.other
- match: '\b(abstract|at|bool|char|enum|final|int|label|record|let|normal|fresh|on|prev|real|start|string|where|with|initial)\b'
scope: keyword.other
- match: '\b(check|for|enumerate|reach|each|stop|via|upto)\b'
scope: keyword.operator
- match: '\b(-)?[0-9.]+\b'
scope: constant.numeric
- match: '\b(true|false)\b'
scope: constant.language
- match: '(->|<->)'
scope: string.type
- match: '(<<|>>|&&|\|\||!|\^\|\=\>)'
scope: keyword.operator.logical
- match: '(<\=|>\=|\=\=|<|>|\!\=)'
scope: keyword.operator.comparison
- match: '\='
scope: keyword.operator.assignment
- match: '\b(^|>>|<<|_)\b'
scope: keyword.operator.bitwise
- match: '(\+\+|--)'
scope: keyword.operator.arithmetic
- match: '(\+|\-|/|\*)'
scope: keyword.operator.arithmetic
- match: '(\+\=|-\=|\*\=|/\=)'
scope: keyword.operator.assignment.augmented
entity-name:
- match: '{{identifier}}'
scope: variable.function
- match: \{
scope: punctuation.section.group.begin
pop: 1
#set: entity-body
member-name:
- match: '{{identifier}}'
scope: variable.parameter
pop: 1
invariant-name:
- match: '{{identifier}}'
scope: variable.language
- match: \{
scope: punctuation.section.group.begin
pop: 1
#entity-body:
# - meta_scope: meta.class
# - clear_scopes: 1
# - match: \}
# scope: punctuation.section.group.end
# pop: 2
double_quoted_string:
- meta_scope: string.quoted.double
- match: '\\.'
scope: constant.character.escape
- match: '"'
scope: punctuation.definition.string.end
pop: true
line_comment:
- meta_scope: comment.line
- match: $
pop: true