-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.sublime-syntax
174 lines (140 loc) · 5.42 KB
/
astro.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
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Astro
file_extensions:
- astro
- ast
scope: source.astro
contexts:
main:
- match: ^\s*-\s+[^>].*$ # non_astro
scope: comment.line.number-sign.astro
name: non_astro
- match: \b0x(_?[A-Fa-f0-9])*((\.(_?[A-Fa-f0-9])+)?(p[+-]?)?[A-Fa-f0-9_]+)? # hexadecimal_numbers
scope: constant.numeric.astro
name: hexadecimal_numbers
- match: \b0o(_?[0-8])*((\.(_?[0-8])+)?(p[+-]?)?[0-8_]+)? # octal_numbers
scope: constant.numeric.astro
name: octal_numbers
- match: \b0b(_?[01])*((\.(_?[01])+)?(p[+-]?)?[01_]+)? # binary_numbers
scope: constant.numeric.astro
name: binary_numbers
- match: \b[0-9](_?[0-9])*((\.(_?[0-9])+)?(e[+-]?)?(_?[0-9])+)? # decimal_numbers
scope: constant.numeric.astro
name: decimal_numbers
- match: \@(?:[A-Za-z_][_A-Za-z0-9]*)|@\([^)]+\) # macros
scope: support.function.macro.astro
name: macros
- match: (#-) # multiline_comments
push: multiline_comments
- match: (#).*$ # single_line_comments
scope: comment.line.number-sign.astro
name: single_line_comments
- match: (?<=^|:|=)\s*(::|>:|<:) # type_annotation
push: type_annotation
- match: (?<!\.)(\.[A-Za-z_][_A-Za-z0-9]*!?(\.(?![.A-Za-z_0-9]))?)|(?<=,)\s*:[A-Za-z_][_A-Za-z0-9]*!? # dot_notation
scope: constant.numeric.astro
name: dot_notation
- match: \b(true|false|nil|NaN)\b # constant_keywords
scope: constant.language.astro
name: constant_keywords
- match: \b(?:try!|(for|end|if|\?|else|elif|async|await|return|delegate|yield|from|while|do|loop|try|ensure|raise|continue|break|fallthrough|pass|except)\b) # control_keywords
scope: keyword.control.astro
name: control_keywords
- match: \b(?:type|fun|let|var|import|export)\b # declaration_keywords
scope: storage.modifier.astro
name: declaration_keywords
- match: \b(and|or|not|in|is|mod|where|iso|ref|const|as|typeof)\b # keyword_operators
scope: keyword.control.astro"
name: keyword_operators
- match: ([A-Za-z_][_A-Za-z0-9]*)!?\.?(?=(\{.+\}\s*)?\() # function_calls
scope: entity.name.function.astro
name: function_calls
- match: (?<=,)\s*:(?=\() # function_extended_notation
scope: entity.name.function.astro
name: function_extended_notation
- match: ([A-Za-z_][_A-Za-z0-9]*( (?!and |or |not |in |is |mod |where |iso |ref |const |as |typeof )[A-Za-z_][_A-Za-z0-9]*)+\s*(?=[+-/*]?\=)) # multiple_declaration
scope: astro
name: multiple_declaration
- match: (?<!let |var |import )(\b[a-zA-Z_][A-Za-z_0-9]*!?)\s+(?=[A-Za-z_0-9]+|\"|'|`|(\|\|)|@|\$|\{|\[|\()(?!\b(and|or|not|in|is|mod|where|iso|ref|const|as|typeof)\b) # command_notation
scope: entity.name.function.astro
name: command_notation
- match: (?<=[_a-zA-Z0-9})\]])' # unquoted
scope: support.function.macro.astro
name: unquoted
- match: \"\"\" # multiline_single_quoted_string
scope: punctuation.definition.string.begin.astro
push: multiline_double_quoted_string
- match: \'\'\' # multiline_single_quoted_string
scope: punctuation.definition.string.begin.astro
push: multiline_single_quoted_string
- match: \" # double_quoted_string
scope: punctuation.definition.string.begin.astro
push: double_quoted_string
- match: \' # single_quoted_string
scope: punctuation.definition.string.begin.astro
push: single_quoted_string
- match: \`.\` # chars
scope: string.quoted.astro
name: chars
- match: \|\| # regex
scope: punctuation.definition.regexp.begin.astro
push: regex
- match: \.?(=|\||\&|\>|\<|!|\+|-|\*|\/|\^|%|\?|≥|≤|≠|≈|×|±|÷)+ # operators
scope: keyword.operator.astro
name: operators
double_quoted_string:
- meta_scope: string.quoted.double.astro
- match: \\(t|n|r|b|q|\"|'|\$|\\)
scope: constant.character.escape.astro
- match: \$[A-Za-z_][A-Za-z0-9_]*
scope: constant.character.escape.astro
- match: \$(|.+|)?\{
push: string_interpolate
- match: \"
scope: punctuation.definition.string.end.astro
pop: true
single_quoted_string:
- meta_scope: string.quoted.single.astro
- match: \\(t|n|r|b|q|\"|'|\$|\\)
scope: constant.character.escape.astro
- match: \$[A-Za-z_][A-Za-z0-9_]*
scope: constant.character.escape.astro
- match: \$(|.+|)?\{
push: string_interpolate
- match: \'
scope: punctuation.definition.string.end.astro
pop: true
multiline_double_quoted_string:
- meta_scope: string.quoted.double.astro
- match: \"\"\"
scope: punctuation.definition.string.end.astro
pop: true
multiline_single_quoted_string:
- meta_scope: string.quoted.single.astro
- match: \'\'\'
scope: punctuation.definition.string.end.astro
pop: true
regex:
- meta_scope: string.regexp.astro
- match: \\.
scope: constant.character.escape.astro
- match: \|\|
scope: punctuation.definition.regexp.begin.astro
pop: true
string_interpolate:
- meta_scope: constant.character.escape.astro
- match: \}
pop: true
- include: main
multiline_comments:
- meta_scope: comment.line.block.astro
- match: (#-)
push: multiline_comments
- match: -#
pop: true
type_annotation:
- meta_scope: comment.line.block.astro
- match: (?=;|$)
pop: true