-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
text.html.slash.js
188 lines (186 loc) · 6.35 KB
/
text.html.slash.js
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
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
dependencies: ['text.html.basic'],
extensions: ['.sl'],
names: ['slash'],
patterns: [
{
begin: '<%+#',
captures: {0: {name: 'punctuation.definition.comment.slash'}},
end: '%>',
name: 'comment.block.slash'
},
{
begin: '<%!!',
captures: {0: {name: 'invalid'}},
end: '%>',
name: 'source.slash.raw-echo.html',
patterns: [{include: '#slash-language'}]
},
{
begin: '<%(?!>!)=?',
captures: {0: {name: 'punctuation.section.embedded.slash'}},
end: '%>',
name: 'source.slash.embedded.html',
patterns: [{include: '#slash-language'}]
},
{include: 'text.html.basic'}
],
repository: {
'escaped-char': {
match: '\\\\(?:x[\\da-fA-F]{2}|.)',
name: 'constant.character.escape.slash'
},
'interpolated-slash': {
begin: '#\\{',
captures: {0: {name: 'punctuation.section.embedded.slash'}},
end: '\\}',
patterns: [{include: '#slash-language'}]
},
nest_curly_r: {
begin: '\\{',
captures: {0: {name: 'punctuation.section.scope.slash'}},
end: '\\}',
patterns: [{include: '#nest_curly_r'}]
},
'slash-language': {
patterns: [
{begin: '#', end: '$', name: 'comment.line.hash.slash'},
{begin: '//', end: '$', name: 'comment.line.c-style.slash'},
{begin: '/\\*', end: '\\*/', name: 'comment.block.slash'},
{
captures: {
1: {name: 'keyword.class.slash'},
2: {name: 'entity.name.type.class.slash'}
},
match: "^\\s*(class)\\s+([A-Z][A-Za-z0-9_']*)",
name: 'meta.class.slash'
},
{
captures: {
1: {name: 'keyword.class.slash'},
2: {name: 'entity.name.type.class.slash'},
3: {name: 'keyword.extends.slash'},
4: {name: 'entity.other.inherited-class.slash'}
},
match:
"^\\s*(class)\\s+([A-Z][A-Za-z0-9_']*)\\s+(extends)\\s+([A-Z][A-Za-z0-9_']*)",
name: 'meta.class.extends.slash'
},
{
captures: {
1: {name: 'keyword.def.slash'},
2: {name: 'variable.language.slash'},
3: {name: 'keyword.punctuation.slash'},
4: {name: 'entity.name.method-name.slash'}
},
match:
'^\\s*(def)\\s+(self)(\\.)([A-Za-z_][A-Za-z0-9_]*|\\[\\]=?|<<|>>|\\+|-|\\*\\*|\\*|/|%|==|!=|<=>|<=|<|>=|>|\\^|&|\\||~)',
name: 'meta.def.sing-self.slash'
},
{
captures: {
1: {name: 'keyword.def.slash'},
2: {name: 'storage.ivar.slash'},
3: {name: 'keyword.punctuation.slash'},
4: {name: 'entity.name.method-name.slash'}
},
match:
"^\\s*(def)\\s+(@@?[A-Za-z0-9_']+)(\\.)([A-Za-z_][A-Za-z0-9_']*|\\[\\]=?|<<|>>|\\+|-|\\*\\*|\\*|/|%|==|!=|<=>|<=|<|>=|>|\\^|&|\\||~)",
name: 'meta.def.sing-icvar.slash'
},
{
captures: {
1: {name: 'keyword.def.slash'},
2: {name: 'support.class.slash'},
3: {name: 'keyword.punctuation.slash'},
4: {name: 'entity.name.method-name.slash'}
},
match:
"^\\s*(def)\\s+([A-Z][a-zA-Z0-9_']*)(\\.)([A-Za-z_][A-Za-z0-9_']*|\\[\\]=?|<<|>>|\\+|-|\\*\\*|\\*|/|%|==|!=|<=>|<=|<|>=|>|\\^|&|\\||~)",
name: 'meta.def.sing-constant.slash'
},
{
captures: {
1: {name: 'keyword.def.slash'},
2: {name: 'entity.name.method-name.slash'}
},
match:
"^\\s*(def)\\s+([A-Za-z_][A-Za-z0-9_']*|\\[\\]=?|<<|>>|\\+|-|\\*\\*|\\*|/|%|==|!=|<=>|<=|<|>=|>|\\^|&|\\||~)",
name: 'meta.def.slash'
},
{
match:
'\\b(class|extends|def|if|elsif|else|unless|for|in|while|until|and|or|not|lambda|try|catch|return|next|last|throw|use)\\b',
name: 'keyword.language.slash'
},
{match: '\\bself\\b', name: 'variable.language.slash'},
{match: '\\b(nil|true|false)\\b', name: 'constant.language.slash'},
{
match: '-?[0-9]+e[+-]?[0-9]+',
name: 'constant.integer-with-exponent.slash'
},
{
match: '-?[0-9]+(\\.[0-9]+)(e[+-]?[0-9]+)?',
name: 'constant.float.slash'
},
{match: '-?[0-9]+', name: 'constant.integer.slash'},
{match: "\\b([A-Z][a-zA-Z0-9_']*)\\b", name: 'support.class.slash'},
{
captures: {1: {name: 'meta.function-call'}},
match: "([a-z_][a-zA-Z0-9_']*)\\s*(?:\\()",
name: 'method-call.implicit-self.slash'
},
{
captures: {1: {name: 'meta.function-call'}},
match: "(?<=[.:])([a-z_][a-zA-Z0-9_']*)",
name: 'method-call.explicit-self.slash'
},
{match: "[a-z_][a-zA-Z_0-9']*", name: 'variable.slash'},
{
captures: {0: {name: 'storage.ivar.slash'}},
match: "@[a-zA-Z_0-9']+",
name: 'variable.ivar.slash'
},
{
captures: {0: {name: 'storage.cvar.slash'}},
match: "@@[a-zA-Z_0-9']+",
name: 'variable.cvar.slash'
},
{
begin: '"',
end: '"',
name: 'string.double-quoted.slash',
patterns: [
{include: '#escaped-char'},
{include: '#interpolated-slash'}
]
},
{match: "'[A-Za-z0-9_]+", name: 'string.single-quoted.slash'},
{
begin: '%r\\{',
beginCaptures: {
0: {name: 'punctuation.definition.string.begin.slash'}
},
end: '\\}[a-z]*',
endCaptures: {0: {name: 'punctuation.definition.string.end.slash'}},
name: 'string.regexp.slash',
patterns: [{include: '#nest_curly_r'}]
},
{
match:
'<<=|>>=|<<|>>|==|!=|=>|=|<=>|<=|<|>=|>|\\+\\+|--|\\+=|-=|\\*\\*=|\\*=|/=|%=|\\+|-|\\*\\*|\\*|/|%|\\^=|&=|&&=|\\|=|\\|\\|=|\\^|~|&|&&|\\||\\|\\||!|\\.\\.\\.|\\.\\.|\\.|::|:|λ|\\\\',
name: 'keyword.punctuation.language.slash'
}
]
}
},
scopeName: 'text.html.slash'
}
export default grammar