-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPest.sublime-syntax
164 lines (154 loc) · 4.33 KB
/
Pest.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
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Pest
file_extensions:
- pest
scope: source.pest.pest
variables:
ident: '\b\w+\b'
trailing_op: '[*?+]'
replaceable_support_idents: '\b(WHITESPACE|COMMENT)\b'
support_idents: '\b(PUSH|POP|ANY|SOI|EOI|NEWLINE|ASCII_ALPHANUMERIC)\b|{{replaceable_support_idents}}'
escaped_char: '\\("|\\|r|n|t|0|''|x\h{2}|u\{\h{2,6}\})'
contexts:
main:
- include: comments
- include: rule_decl
- match: \S
scope: invalid.pest
rule_decl:
- match: '^\s*{{replaceable_support_idents}}'
scope: support.function.override.pest
set: [rule_def, must_be_equals]
- match: '^\s*{{ident}}'
scope: entity.name.function.pest
set: [rule_def, must_be_equals]
- match: \S
scope: invalid.pest
must_be_equals:
- match: '='
scope: keyword.operator.pest
pop: true
- match: \S
scope: invalid.pest
rule_def:
- match: '([@_$]?)\{'
captures:
1: keyword.operator.pest
set:
- match: '\}'
pop: true
- include: rule_def_inner
escaped-char:
- match: '{{escaped_char}}'
scope: constant.character.escape.pest
- match: '\\.'
scope: invalid.pest
rule_def_inner:
- include: comments
- match: '(\^?)(")'
captures:
1: keyword.operator.pest
2: punctuation.definition.string.begin.pest
push:
- meta_scope: string.quoted.double.pest
- include: escaped-char
- match: '"'
scope: punctuation.definition.string.end.pest
set: trailing
- match: ''''
scope: punctuation.definition.string.begin.pest
push:
- meta_scope: string.quoted.single.pest
- include: escaped-char
- match: ''''
scope: punctuation.definition.string.end.pest
set:
- match: '\.\.'
scope: keyword.operator.range.pest
push:
- match: ''''
scope: punctuation.definition.string.begin.pest
set:
- meta_scope: string.quoted.single.pest
- include: escaped-char
- match: ''''
scope: punctuation.definition.string.end.pest
set: trailing
- match: \S
scope: invalid.pest
pop: true
- include: trailing
- match: '{{support_idents}}'
scope: meta.function-call support.function.pest
push: trailing
- match: '{{ident}}'
scope: meta.function-call variable.function.pest
push: trailing
- match: '[~|~]'
scope: keyword.operator.pest
- match: '[!&]'
scope: keyword.operator.pest
- match: \(
scope: punctuation.section.parens.begin.pest
push:
- match: \)
scope: punctuation.section.parens.end.pest
set: trailing
- include: rule_def_inner
- match: \S
scope: invalid.pest
rule_name:
- match: '{{ident}}'
comments:
- match: (//).*$\n?
scope: comment.line.double-dash.pest
captures:
1: punctuation.definition.comment.pest
- include: block_comment
block_comment:
- match: '/\*'
scope: punctuation.definition.comment.pest
push:
- meta_scope: comment.block.pest
- include: block_comment
- match: '\*/'
scope: punctuation.definition.comment.pest
pop: true
trailing:
- match: '{{trailing_op}}'
scope: keyword.operator.pest
set:
- match: '{{trailing_op}}'
scope: invalid.pest
- match: ''
pop: true
- match: '{'
push: trailing_braces
- match: ''
pop: true
trailing_braces:
- match: '}'
scope: invalid.pest
pop: true
- match: \d+
scope: constant.numeric.integer.pest
set:
- match: '}'
pop: true
- match: ','
set:
- match: \d+
scope: constant.numeric.integer.pest
set:
- match: '}'
pop: true
- match: \S
scope: invalid.pest
- match: \S
scope: invalid.pest
- match: \S
scope: invalid.pest
- match: \S
scope: invalid.pest