-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathBBCode.sublime-syntax
More file actions
288 lines (270 loc) · 7.43 KB
/
BBCode.sublime-syntax
File metadata and controls
288 lines (270 loc) · 7.43 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
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name : BBCode
file_extensions : [bbcode, bb]
scope : text.bbcode
version : 2
contexts:
# Naming Conventions
# http://manual.macromates.com/en/language_grammars#naming_conventions.html
main:
- include: embedded
- include: anchors
- include: general-tags
embedded:
- include: embedded-pawn
- include: embedded-ruby
- include: embedded-html
- include: embedded-rhtml
- include: embedded-js
- include: embedded-css
- include: embedded-php
- include: embedded-python
- include: embedded-perl
- include: embedded-sql
- include: embedded-java
- include: embedded-c
- include: embedded-yaml
anchors:
- match: '\[anchor\]'
scope: meta.tag.any.bbcode
push:
- meta_content_scope: entity.anchor.definition.bbcode
- match: '\[/anchor\]'
scope: meta.tag.any.bbcode
pop: true
general-tags:
- include: emphasis
- include: other-tags
emphasis:
- include: bold
- include: italic
- include: underline
- include: strikethrough
other-tags:
- include: url
- include: value-tag
bold:
- meta_include_prototype: false
- match: '\[[B|b]\]'
scope: meta.tag.any.bbcode
push : bold-body
bold-body:
- meta_scope: markup.bold
- match : '\[/[B|b]\]'
scope : meta.tag.any.bbcode
pop : 1
- include: emphasis
italic:
- meta_include_prototype: false
- match: '\[[I|i]\]'
scope: meta.tag.any.bbcode
push : italic-body
italic-body:
- meta_scope: markup.italic
- match : '\[/[I|i]\]'
scope : meta.tag.any.bbcode
pop : 1
- include: emphasis
underline:
- meta_include_prototype: false
- match: '\[[U|u]\]'
scope: meta.tag.any.bbcode
push : underline-body
underline-body:
- meta_scope: markup.underline
- match : '\[/[U|u]\]'
scope : meta.tag.any.bbcode
pop : 1
- include: emphasis
strikethrough:
- meta_include_prototype: false
- match: '\[[S|s]\]'
scope: meta.tag.any.bbcode
push : strikethrough-body
strikethrough-body:
- meta_scope: markup.strikethrough
- match : '\[/[S|s]\]'
scope : meta.tag.any.bbcode
pop : 1
- include: emphasis
url:
- meta_include_prototype: false
- match: '\[url=?(.*?)\]'
captures:
1: meta.tag.any.bbcode
2: meta.tag.value.bbcode
push : url-body
url-body:
- meta_scope: markup.underline
- match : '\[/url\]'
scope : meta.tag.any.bbcode
pop : 1
value-tag:
- meta_include_prototype: false
- match: '\[.*?=(.*?)\]'
captures :
0: meta.tag.any.bbcode
1: meta.tag.value.bbcode
push : value-tag-body
value-tag-body:
- match : '\[/?[^\]=]*\]'
scope: meta.tag.any.bbcode
pop : 1
embedded-pawn:
- meta_include_prototype: false
- match: '(?i)\[(pawn|html|code|php)\]'
captures:
0: meta.tag.code.pawn.bbcode
embed: scope:source.AmxxPawn source.sma
embed_scope:
source.pawn.embedded.bbcode
source.pawn
escape: '(?i)\[/(pawn|html|code|php)\]'
escape_captures:
0: meta.tag.code.pawn.bbcode
embedded-ruby:
- meta_include_prototype: false
- match: '\[code=ruby\]'
captures:
0: meta.tag.code.ruby.bbcode
embed: scope:source.ruby
embed_scope:
source.ruby.embedded.bbcode
source.ruby
escape: '\[/code\]'
escape_captures:
0: meta.tag.code.ruby.bbcode
embedded-html:
- meta_include_prototype: false
- match: '\[code=html\]'
captures:
0: meta.tag.code.html.bbcode
embed: scope:text.html.basic
embed_scope:
text.html.embedded.bbcode
text.html.basic
escape: '\[/code\]'
escape_captures:
0: meta.tag.code.html.bbcode
embedded-rhtml:
- meta_include_prototype: false
- match: '\[code=rhtml\]'
captures:
0: meta.tag.code.rhtml.bbcode
embed: scope:text.html.ruby
embed_scope:
text.rhtml.embedded.bbcode
text.html.ruby
escape: '\[/code\]'
escape_captures:
0: meta.tag.code.rhtml.bbcode
embedded-js:
- meta_include_prototype: false
- match: '\[code=(js|javascript)\]'
captures:
0: meta.tag.code.js.bbcode
embed: scope:source.js
embed_scope:
source.js.embedded.bbcode
source.js
escape: '\[/code\]'
escape_captures:
0: meta.tag.code.js.bbcode
embedded-css:
- meta_include_prototype: false
- match: '\[code=(css|stylesheet)\]'
captures:
0: meta.tag.code.css.bbcode
embed: scope:source.css
embed_scope:
source.css.embedded.bbcode
source.css
escape: '\[/code\]'
escape_captures:
0: meta.tag.code.css.bbcode
embedded-php:
- meta_include_prototype: false
- match: '\[code=php\]'
captures:
0: meta.tag.code.php.bbcode
embed: scope:source.php
embed_scope:
source.php.embedded.bbcode
source.php
escape: '\[/code\]'
escape_captures:
0: meta.tag.code.php.bbcode
embedded-python:
- meta_include_prototype: false
- match: '\[code=python\]'
captures:
0: meta.tag.code.python.bbcode
embed: scope:source.python
embed_scope:
source.python.embedded.bbcode
source.python
escape: '\[/code\]'
escape_captures:
0: meta.tag.code.python.bbcode
embedded-perl:
- meta_include_prototype: false
- match: '\[code=perl\]'
captures:
0: meta.tag.code.perl.bbcode
embed: scope:source.perl
embed_scope:
source.perl.embedded.bbcode
source.perl
escape: '\[/code\]'
escape_captures:
0: meta.tag.code.perl.bbcode
embedded-sql:
- meta_include_prototype: false
- match: '\[code=sql\]'
captures:
0: meta.tag.code.sql.bbcode
embed: scope:source.sql
embed_scope:
source.sql.embedded.bbcode
source.sql
escape: '\[/code\]'
escape_captures:
0: meta.tag.code.sql.bbcode
embedded-java:
- meta_include_prototype: false
- match: '\[code=java\]'
captures:
0: meta.tag.code.java.bbcode
embed: scope:source.java
embed_scope:
source.java.embedded.bbcode
source.java
escape: '\[/code\]'
escape_captures:
0: meta.tag.code.java.bbcode
embedded-c:
- meta_include_prototype: false
- match: '\[code=c\]'
captures:
0: meta.tag.code.c.bbcode
embed: scope:source.c
embed_scope:
source.c.embedded.bbcode
source.c
escape: '\[/code\]'
escape_captures:
0: meta.tag.code.c.bbcode
embedded-yaml:
- meta_include_prototype: false
- match: '\[code=yaml\]'
captures:
0: meta.tag.code.yaml.bbcode
embed: scope:source.yaml
embed_scope:
source.yaml.embedded.bbcode
source.yaml
escape: '\[/code\]'
escape_captures:
0: meta.tag.code.yaml.bbcode