Skip to content

Commit 2a19494

Browse files
committed
Support comments in multiline regexps
1 parent 96e41b6 commit 2a19494

File tree

6 files changed

+325
-0
lines changed

6 files changed

+325
-0
lines changed

grammars/MagicPython.YAML-tmLanguage

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,25 @@ repository:
1818
vars:
1919
prefix: 'single-one-'
2020
marker: "|(?=\\')"
21+
nested: ''
2122

2223
- file: 'regexp.inc.yaml'
2324
vars:
2425
prefix: 'single-three-'
2526
marker: "|(?=\\'\\'\\')"
27+
nested: "- include: '#comments'"
2628

2729
- file: 'regexp.inc.yaml'
2830
vars:
2931
prefix: 'double-one-'
3032
marker: '|(?=")'
33+
nested: ''
3134

3235
- file: 'regexp.inc.yaml'
3336
vars:
3437
prefix: 'double-three-'
3538
marker: '|(?=""")'
39+
nested: "- include: '#comments'"
3640

3741
comments:
3842
name: comment.line.number-sign.python

grammars/MagicPython.cson

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,6 +2066,9 @@ repository:
20662066
name: "constant.character.set.regexp"
20672067
match: "[^\\n]"
20682068
}
2069+
{
2070+
include: "#comments"
2071+
}
20692072
]
20702073
"single-three-regexp-named-group":
20712074
name: "meta.named.regexp"
@@ -2087,6 +2090,9 @@ repository:
20872090
{
20882091
include: "#single-three-regexp-expression"
20892092
}
2093+
{
2094+
include: "#comments"
2095+
}
20902096
]
20912097
"single-three-regexp-comments":
20922098
name: "comment.regexp"
@@ -2113,6 +2119,9 @@ repository:
21132119
{
21142120
include: "#single-three-regexp-expression"
21152121
}
2122+
{
2123+
include: "#comments"
2124+
}
21162125
]
21172126
"single-three-regexp-lookahead-negative":
21182127
begin: "(\\()\\?!"
@@ -2129,6 +2138,9 @@ repository:
21292138
{
21302139
include: "#single-three-regexp-expression"
21312140
}
2141+
{
2142+
include: "#comments"
2143+
}
21322144
]
21332145
"single-three-regexp-lookbehind":
21342146
begin: "(\\()\\?<="
@@ -2145,6 +2157,9 @@ repository:
21452157
{
21462158
include: "#single-three-regexp-expression"
21472159
}
2160+
{
2161+
include: "#comments"
2162+
}
21482163
]
21492164
"single-three-regexp-lookbehind-negative":
21502165
begin: "(\\()\\?<!"
@@ -2161,6 +2176,9 @@ repository:
21612176
{
21622177
include: "#single-three-regexp-expression"
21632178
}
2179+
{
2180+
include: "#comments"
2181+
}
21642182
]
21652183
"single-three-regexp-conditional":
21662184
begin: "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)"
@@ -2177,6 +2195,9 @@ repository:
21772195
{
21782196
include: "#single-three-regexp-expression"
21792197
}
2198+
{
2199+
include: "#comments"
2200+
}
21802201
]
21812202
"single-three-regexp-parentheses-non-capturing":
21822203
begin: "\\(\\?:"
@@ -2191,6 +2212,9 @@ repository:
21912212
{
21922213
include: "#single-three-regexp-expression"
21932214
}
2215+
{
2216+
include: "#comments"
2217+
}
21942218
]
21952219
"single-three-regexp-parentheses":
21962220
begin: "\\("
@@ -2205,6 +2229,9 @@ repository:
22052229
{
22062230
include: "#single-three-regexp-expression"
22072231
}
2232+
{
2233+
include: "#comments"
2234+
}
22082235
]
22092236
"double-one-regexp-expression":
22102237
patterns: [
@@ -2474,6 +2501,9 @@ repository:
24742501
name: "constant.character.set.regexp"
24752502
match: "[^\\n]"
24762503
}
2504+
{
2505+
include: "#comments"
2506+
}
24772507
]
24782508
"double-three-regexp-named-group":
24792509
name: "meta.named.regexp"
@@ -2495,6 +2525,9 @@ repository:
24952525
{
24962526
include: "#double-three-regexp-expression"
24972527
}
2528+
{
2529+
include: "#comments"
2530+
}
24982531
]
24992532
"double-three-regexp-comments":
25002533
name: "comment.regexp"
@@ -2521,6 +2554,9 @@ repository:
25212554
{
25222555
include: "#double-three-regexp-expression"
25232556
}
2557+
{
2558+
include: "#comments"
2559+
}
25242560
]
25252561
"double-three-regexp-lookahead-negative":
25262562
begin: "(\\()\\?!"
@@ -2537,6 +2573,9 @@ repository:
25372573
{
25382574
include: "#double-three-regexp-expression"
25392575
}
2576+
{
2577+
include: "#comments"
2578+
}
25402579
]
25412580
"double-three-regexp-lookbehind":
25422581
begin: "(\\()\\?<="
@@ -2553,6 +2592,9 @@ repository:
25532592
{
25542593
include: "#double-three-regexp-expression"
25552594
}
2595+
{
2596+
include: "#comments"
2597+
}
25562598
]
25572599
"double-three-regexp-lookbehind-negative":
25582600
begin: "(\\()\\?<!"
@@ -2569,6 +2611,9 @@ repository:
25692611
{
25702612
include: "#double-three-regexp-expression"
25712613
}
2614+
{
2615+
include: "#comments"
2616+
}
25722617
]
25732618
"double-three-regexp-conditional":
25742619
begin: "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)"
@@ -2585,6 +2630,9 @@ repository:
25852630
{
25862631
include: "#double-three-regexp-expression"
25872632
}
2633+
{
2634+
include: "#comments"
2635+
}
25882636
]
25892637
"double-three-regexp-parentheses-non-capturing":
25902638
begin: "\\(\\?:"
@@ -2599,6 +2647,9 @@ repository:
25992647
{
26002648
include: "#double-three-regexp-expression"
26012649
}
2650+
{
2651+
include: "#comments"
2652+
}
26022653
]
26032654
"double-three-regexp-parentheses":
26042655
begin: "\\("
@@ -2613,4 +2664,7 @@ repository:
26132664
{
26142665
include: "#double-three-regexp-expression"
26152666
}
2667+
{
2668+
include: "#comments"
2669+
}
26162670
]

0 commit comments

Comments
 (0)