Skip to content

Commit e0ece7f

Browse files
committed
Add <<< >>> for q/qq/Q and multi-line comments
1 parent 8f6300a commit e0ece7f

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed

dev/q-qq-Q-template.p6

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ my @open-close-delimiters =
66
('triple_paren', Q<\\(\\(\\(>, Q<\\)\\)\\)>, 3, False),
77
('triple_bracket', Q<\\[\\[\\[>, Q<\\]\\]\\]>, 3, False),
88
('triple_brace', Q<\\{\\{\\{>, Q<\\}\\}\\}>, 3, False),
9+
('triple_angle', '<<<', '>>>', 3, False),
910
('double_angle', '<<', '>>', 2, False),
1011
('double_paren', Q<\\(\\(>, Q<\\)\\)>, 2, False),
1112
('double_bracket', Q<\\[\\[>, Q<\\]\\]>, 2, False),

grammars/perl6fe.cson

+13
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,19 @@
107107
}
108108
]
109109
}
110+
# multiline comment triple_angle
111+
{
112+
'begin': '\\s*#`<<<',
113+
'end': '>>>',
114+
'name': 'comment.multiline.hash-tick.triple_angle.perl6fe'
115+
'patterns': [
116+
{
117+
'begin': '<<<'
118+
'end': '>>>'
119+
'name': 'comment.internal.triple_angle.perl6fe'
120+
}
121+
]
122+
}
110123
# multiline comment double_angle
111124
{
112125
'begin': '\\s*#`<<',

grammars/perl6fe.quoting.cson

+85
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,86 @@
244244
{ 'include': '#q_triple_brace_string_content' }
245245
]
246246
}
247+
# Q_triple_angle
248+
{
249+
'begin': '(?x) (?<=^|[\\s\\(\\){},;])
250+
(Q(?:x|w|ww|v|s|a|h|f|c|b|p)?)
251+
((?:
252+
\\s*:(?:
253+
x|exec|w|words|ww|quotewords|v|val|q|single|double|
254+
s|scalar|a|array|h|hash|f|function|c|closure|b|blackslash|
255+
regexp|substr|trans|codes|p|path
256+
)
257+
)*)
258+
\\s*(<<<)'
259+
'beginCaptures':
260+
'1': 'name': 'string.quoted.q.operator.perl6fe'
261+
'2': 'name': 'support.function.quote.adverb.perl6fe'
262+
'3': 'name': 'punctuation.definition.string.perl6fe'
263+
'end': '>>>'
264+
'endCaptures':
265+
'0': 'name': 'punctuation.definition.string.perl6fe'
266+
'contentName': 'string.quoted.q.triple_angle.quote.perl6fe'
267+
'patterns': [ { 'include': '#q_triple_angle_string_content' } ]
268+
}
269+
# q_triple_angle
270+
{
271+
'begin': '(?x) (?<=^|[\\s\\(\\){},;])
272+
(q(?:x|w|ww|v|s|a|h|f|c|b|p)?)
273+
((?:
274+
\\s*:(?:
275+
x|exec|w|words|ww|quotewords|v|val|q|single|double|
276+
s|scalar|a|array|h|hash|f|function|c|closure|b|blackslash|
277+
regexp|substr|trans|codes|p|path
278+
)
279+
)*)
280+
\\s*(<<<)'
281+
'beginCaptures':
282+
'1': 'name': 'string.quoted.q.operator.perl6fe'
283+
'2': 'name': 'support.function.quote.adverb.perl6fe'
284+
'3': 'name': 'punctuation.definition.string.perl6fe'
285+
'end': '\\\\\\\\>>>|(?<!\\\\)>>>'
286+
'endCaptures':
287+
'0': 'name': 'punctuation.definition.string.perl6fe'
288+
'contentName': 'string.quoted.q.triple_angle.quote.perl6fe'
289+
'patterns': [
290+
{
291+
'match': '\\\\<<<|\\\\>>>'
292+
'name': 'constant.character.escape.perl6fe'
293+
}
294+
{ 'include': '#q_triple_angle_string_content' }
295+
]
296+
}
297+
# qq_triple_angle
298+
{
299+
'begin': '(?x) (?<=^|[\\s\\(\\){},;])
300+
(qq(?:x|w|ww|v|s|a|h|f|c|b|p)?)
301+
((?:
302+
\\s*:(?:
303+
x|exec|w|words|ww|quotewords|v|val|q|single|double|
304+
s|scalar|a|array|h|hash|f|function|c|closure|b|blackslash|
305+
regexp|substr|trans|codes|p|path
306+
)
307+
)*)
308+
\\s*(<<<)'
309+
'beginCaptures':
310+
'1': 'name': 'string.quoted.qq.operator.perl6fe'
311+
'2': 'name': 'support.function.quote.adverb.perl6fe'
312+
'3': 'name': 'punctuation.definition.string.perl6fe'
313+
'end': '\\\\\\\\>>>|(?<!\\\\)>>>'
314+
'endCaptures':
315+
'0': 'name': 'punctuation.definition.string.perl6fe'
316+
'contentName': 'string.quoted.qq.triple_angle.quote.perl6fe'
317+
'patterns': [
318+
{
319+
'match': '\\\\<<<|\\\\>>>'
320+
'name': 'constant.character.escape.perl6fe'
321+
}
322+
{ 'include': '#qq_character_escape' }
323+
{ 'include': 'source.perl6fe#interpolation' }
324+
{ 'include': '#q_triple_angle_string_content' }
325+
]
326+
}
247327
# Q_double_angle
248328
{
249329
'begin': '(?x) (?<=^|[\\s\\(\\){},;])
@@ -1580,6 +1660,11 @@
15801660
'begin': '\\{\\{\\{'
15811661
'end': '\\\\\\\\\\}\\}\\}|(?<!\\\\)\\}\\}\\}'
15821662
'patterns': [ { 'include': '#q_triple_brace_string_content' } ]
1663+
# q_triple_angle
1664+
'q_triple_angle_string_content':
1665+
'begin': '<<<'
1666+
'end': '\\\\\\\\>>>|(?<!\\\\)>>>'
1667+
'patterns': [ { 'include': '#q_triple_angle_string_content' } ]
15831668
# q_double_angle
15841669
'q_double_angle_string_content':
15851670
'begin': '<<'

styles/styles.less

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
atom-text-editor.editor .syntax--markup--syntax,
12
atom-text-editor.editor .syntax--entity.syntax--name.syntax--section,
23
atom-text-editor.editor .syntax--comment,
34
atom-text-editor.editor .syntax--string.syntax--quoted,

0 commit comments

Comments
 (0)