-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLessScript.sublime-syntax
More file actions
185 lines (183 loc) · 5.08 KB
/
Copy pathLessScript.sublime-syntax
File metadata and controls
185 lines (183 loc) · 5.08 KB
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
%YAML 1.2
---
# See http://www.sublimetext.com/docs/syntax.html
file_extensions:
- ls
scope: source.lang
variables:
number: '(?x)
\b(?:-)?
(?:
[0-9][0-9_]*(?:\.[0-9_]+)?|
0x[0-9a-fA-F_]+(\.[0-9a-fA-F]+)?|
0b[01_]+(\.[01_]+)?
0o[0-7_]+(\.[0-7_]+)?
)(?:[FIU][0-9]*)?\b'
label: '\b\w+\b'
match_lambdaSymbol: '\\|λ'
string_special: '\\(?:x[0-9a-fA-F]{2}|\\u[0-9]{4}|.)'
match_psudoExpression: '{{number}}' #impre
match_keywords: '(?x)¦|│|\b(?:
mod|
if|else|
use|
ref|
for|in|of|
while|do|
try|catch|
match|
return|break|continue|
iter|yeild|
await|async|
assert|assume|
as|is|
defer
)\b'
match_operator: '[+\-*%&|^~]{1,2}|/|>=|=<|[!=]=|[¬!<>?:¿]|@\s*\*|\$\s*\*|@|='
match_functionSignitureLookahead: \s*(?=[^\(\)+\-*/]*?\)\s*(->)?\s*.*?\{)
match_keywordVariable: 'this|This'
contexts:
main:
- match: '[\)\]\}]'
scope: invalid.illegal.stray-bracket-end.lang
- include: mainContext
mainContext:
- meta_scope: source.lang
- include: base_basic
#keywords
- match: '\s*{{match_keywords}}'
scope: keyword.lang
- match: '\b(?x)
\b(?:
Number|
String|
Char|
Float|Fixed|Uint|Int|([UFI]|Fx|Bc?|Ec?)(?:8|16|32|64|128)|Bool|
U|I|F|Fx|N|S|C|E|B|Ec|Bc
Unit|Enum|BoolSet|BoolSetCase|EnumCase|
Undefined|Any|
Tuple|Struct|
Array|
Item|Index|
Key|
Vector|Matrix|Graph|Tree|DAG|
Option|Result|
Value|
Fn|Type|
Lazy|
File(?:\s*\.\s*(?:Src|Text|Raw|Bin|Exe))?
Symbol)\b
'
scope: storage.type.lang
#function declaration
- match: '\s*{{match_lambdaSymbol}}' #lambda
scope: keyword.declaration.function.lang
- match: '(?<={{match_lambdaSymbol}})\s*\w+(?:\s*#\s*\w+\b)*\s*(?=:)'
- match: '(?<=\w|#|[\)\]\}]|\+\+)\s*(/)(?!/)' # '/'
scope: keyword.operator.lang
- match: '(?<!\w|[\)\]\}]|\+\+|/)\s*(/)(?![/*])' # '/class'
scope: keyword.declaration.function.lang
- match: '(?<!\w|[\)\]\}]|\+\+)\s*(^)' # ^enum'
scope: keyword.declaration.function.lang
#function call
- match: '[:|]>|<[:|]'
scope: source.keyword.pipelineOperator.lang
#scopes
#- match: '\[:?' #functions [args]exp
# scope: source.lang
# push:
# - - include: base_basic
# #- match: '>'
# - match: '(?=\S)'
# pop: true
# - parameters
- match: '[\(\[\{]'
scope: punctuation.section.group.begin.lang
push: mainContext
- match: '[\)\]\}]'
scope: punctuation.section.group.end.lang
pop: true
#reference and/or declare parameter
- match: '#(#|\s*{{label}}|[@?%/\\](?:{{label}})?|\.\.(?:{{label}})?)|#' # '#a' '#@b' '##' '#\' '#/'
scope: variable.parameter
#operators
- match: '{{match_operator}}'
scope: keyword.operator.lang
#value
- match: '{{number}}|\b(?:true|false|null|undefined|any|NaN|Infinity)\b'
scope: constant.numeric.lang
- match: 'l"' # 'literal string'
push:
- - include: base_basic_string
- meta_scope: string.quoted.double.lang
- match: '"'
pop: true
- match: '"' #formated string ; includes "{exp}" pattern
push: format_string
captures:
1: string.quoted.double.lang
2: constant.character.escape.lang
3: string.quoted.double.lang
4: string.quoted.double.lang
- match: 'r(#*)"'
scope: string.quoted.double.lang
push: multi_line_string
#function calls
- match: '{{label}}\s*(?=[\(\[]|<\||,)|(?<=\|>)\s*{{label}}'
scope: variable.function
#variables
- match: '{{label}}'
scope: variable.lang
#symbols
- match: '\${3}'
scope: storage.type.lang
- match: '\${2}'
scope: storage.type.lang
- match: '\$'
scope: source.key.lang
parameters:
- include: base_comments
- match: '[\w_]+'
scope: variable.parameter
- match: '(?:[\(\[\{])'
scope: source.lang
push: parameters
- match: (?:[\)\]\}])
pop: true
parameter:
- include: base_comments
- match: '[\[\(]'
set: parameter
- match: (?=\S)
pop: true
base_basic:
- include: base_comments
base_comments:
- match: '//.*\n?'
scope: comment.line.lang
- match: '/\*'
scope: punctuation.definition.comment.lang
push:
-
- meta_scope: comment.line.lang
- match: '\*/'
pop: true
base_basic_string:
- meta_scope: string.quoted.double.lang
- match: '{{string_special}}'
scope: constant.character.escape.lang
format_string:
- meta_scope: string.quoted.double.lang
- match: '{'
scope: punctuation.section.group.start.lang
push:
- - meta_scope: source.lang
- include: mainContext
- match: '{{string_special}}'
scope: constant.character.escape.lang
- match: '"'
pop: true
multi_line_string:
- meta_scope: string.quoted.double.lang
- match: '"\1'
pop: true