Skip to content

Commit 96e41b6

Browse files
committed
Fix highlighting for incomplete regexes like r'('
1 parent 0d4ce85 commit 96e41b6

File tree

8 files changed

+2901
-88
lines changed

8 files changed

+2901
-88
lines changed

grammars/MagicPython.YAML-tmLanguage

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,29 @@ patterns:
1111
- include: '#expression'
1212

1313
repository:
14+
$apply:
15+
- file: 'regexp-common.inc.yaml'
16+
17+
- file: 'regexp.inc.yaml'
18+
vars:
19+
prefix: 'single-one-'
20+
marker: "|(?=\\')"
21+
22+
- file: 'regexp.inc.yaml'
23+
vars:
24+
prefix: 'single-three-'
25+
marker: "|(?=\\'\\'\\')"
26+
27+
- file: 'regexp.inc.yaml'
28+
vars:
29+
prefix: 'double-one-'
30+
marker: '|(?=")'
31+
32+
- file: 'regexp.inc.yaml'
33+
vars:
34+
prefix: 'double-three-'
35+
marker: '|(?=""")'
36+
1437
comments:
1538
name: comment.line.number-sign.python
1639
match: (\#)\s*(BUG|FIXME|TODO|XXX|NB)?.*
@@ -251,7 +274,7 @@ repository:
251274
'1': {name: punctuation.definition.string.end.python}
252275
'2': {name: invalid.illegal.newline.python}
253276
patterns:
254-
- include: 'source.regexp.python'
277+
- include: '#single-one-regexp-expression'
255278

256279
regexp-double-quoted-single-line:
257280
name: string.regexp.quoted.double.python
@@ -266,7 +289,7 @@ repository:
266289
'1': {name: punctuation.definition.string.end.python}
267290
'2': {name: invalid.illegal.newline.python}
268291
patterns:
269-
- include: 'source.regexp.python'
292+
- include: '#double-one-regexp-expression'
270293

271294
regexp-single-quoted-multi-line:
272295
name: string.regexp.quoted.triple.python
@@ -280,7 +303,8 @@ repository:
280303
endCaptures:
281304
'0': {name: punctuation.definition.string.end.python}
282305
patterns:
283-
- include: '#regexp-multiline'
306+
- include: '#single-three-regexp-expression'
307+
- include: '#comments'
284308

285309
regexp-double-quoted-multi-line:
286310
name: string.regexp.quoted.triple.python
@@ -294,11 +318,7 @@ repository:
294318
endCaptures:
295319
'0': {name: punctuation.definition.string.end.python}
296320
patterns:
297-
- include: '#regexp-multiline'
298-
299-
regexp-multiline:
300-
patterns:
301-
- include: 'source.regexp.python'
321+
- include: '#double-three-regexp-expression'
302322
- include: '#comments'
303323

304324
string:

0 commit comments

Comments
 (0)