-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJSX.sublime-syntax
84 lines (80 loc) · 2.57 KB
/
JSX.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
%YAML 1.2
---
name: JSX
scope: source.jsx
file_extensions:
- jsx
uuid: 0ca76258-89e6-4055-9fe0-5c45dfea987c
contexts:
# These are stolen from the JavaScript.sublime-syntax
comments:
# - include: special-comments-conditional-compilation
- match: /\*\*(?!/)
scope: punctuation.definition.comment.js
push:
- meta_scope: comment.block.documentation.js
- match: \*/
scope: punctuation.definition.comment.js
pop: true
- match: /\*
scope: punctuation.definition.comment.js
push:
- meta_scope: comment.block.js
- match: \*/
scope: punctuation.definition.comment.js
pop: true
- match: //
scope: punctuation.definition.comment.js
push:
- meta_scope: comment.line.double-slash.js
- match: \n
pop: true
string-content:
- match: \\\s*\n
scope: constant.character.escape.newline.js
- match: '\\(x[\da-fA-F][\da-fA-F]|u[\da-fA-F][\da-fA-F][\da-fA-F][\da-fA-F]|.)'
scope: constant.character.escape.js
literal-string-template:
- match: '`'
scope: punctuation.definition.string.template.begin.js
set:
- meta_include_prototype: false
- meta_scope: string.template.js
- match: "`"
scope: punctuation.definition.string.template.end.js
pop: true
- match: '\$\{'
captures:
0: punctuation.definition.template-expression.begin.js
push:
- clear_scopes: 1
- meta_scope: meta.template.expression.js
- meta_content_scope: source.js.embedded.expression
- match: '\}'
scope: punctuation.definition.template-expression.end.js
pop: true
- include: string-content
main:
- match: ''
push: 'scope:source.js'
with_prototype:
- include: literal-string-template
- include: comments
- match: (return)?\s*\(?(?=<([a-zA-Z]+|\/))
captures:
0: keyword.control.flow.js
scope: punctuation.section.embedded.begin.jsx
push:
- meta_scope: meta.embedded.block.jsx
- meta_content_scope: source.jsx.embedded
- match: (?<=>)\)?;?\s*$
scope: punctuation.section.embedded.end.jsx
pop: true
- include: 'scope:text.html.basic'
with_prototype:
- match: \{
push:
- meta_scope: meta.embedded.block.jsx.js
- match: \}
pop: true
- include: 'scope:source.js'