Skip to content

Commit d96126f

Browse files
committed
Fix missing rule "fstring-illegal-multi-brace".
1 parent eb64fe3 commit d96126f

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

grammars/MagicPython.cson

+9
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ patterns: [
2727
}
2828
]
2929
repository:
30+
impossible:
31+
comment: "This is a special rule that should be used where no match is desired. It is not a good idea to match something like '1{0}' because in some cases that can result in infinite loops in token generation. So the rule instead matches and impossible expression to allow a mathc to fail and move to the next token."
32+
match: "$.^"
3033
statement:
3134
patterns: [
3235
{
@@ -856,6 +859,12 @@ repository:
856859
include: "#f-expression"
857860
}
858861
]
862+
"fstring-illegal-multi-brace":
863+
patterns: [
864+
{
865+
include: "#impossible"
866+
}
867+
]
859868
"f-expression":
860869
comment: "All valid Python expressions, except comments and line cont"
861870
patterns: [

grammars/MagicPython.tmLanguage

+17
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@
4141
</array>
4242
<key>repository</key>
4343
<dict>
44+
<key>impossible</key>
45+
<dict>
46+
<key>comment</key>
47+
<string>This is a special rule that should be used where no match is desired. It is not a good idea to match something like '1{0}' because in some cases that can result in infinite loops in token generation. So the rule instead matches and impossible expression to allow a mathc to fail and move to the next token.</string>
48+
<key>match</key>
49+
<string>$.^</string>
50+
</dict>
4451
<key>statement</key>
4552
<dict>
4653
<key>patterns</key>
@@ -1325,6 +1332,16 @@
13251332
</dict>
13261333
</array>
13271334
</dict>
1335+
<key>fstring-illegal-multi-brace</key>
1336+
<dict>
1337+
<key>patterns</key>
1338+
<array>
1339+
<dict>
1340+
<key>include</key>
1341+
<string>#impossible</string>
1342+
</dict>
1343+
</array>
1344+
</dict>
13281345
<key>f-expression</key>
13291346
<dict>
13301347
<key>comment</key>

grammars/src/MagicPython.syntax.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,15 @@ repository:
207207
guard: ""
208208

209209

210+
impossible:
211+
comment: This is a special rule that should be used where no match
212+
is desired. It is not a good idea to match something like
213+
'1{0}' because in some cases that can result in infinite
214+
loops in token generation. So the rule instead matches
215+
and impossible expression to allow a mathc to fail and
216+
move to the next token.
217+
match: '$.^'
218+
210219
statement:
211220
patterns:
212221
- include: '#import'
@@ -716,6 +725,10 @@ repository:
716725
- include: '#fstring-terminator-single'
717726
- include: '#f-expression'
718727

728+
fstring-illegal-multi-brace:
729+
patterns:
730+
- include: '#impossible'
731+
719732
f-expression:
720733
comment: All valid Python expressions, except comments and line cont
721734
patterns:

0 commit comments

Comments
 (0)