Skip to content

Commit

Permalink
Fix / Workaround for: Error in regex: target of repeat operator is in…
Browse files Browse the repository at this point in the history
…valid in regex

Fixes: MagicStack#242

SublimeText 4 (as of build 4121) evaluates this valid regex: `\n?` to this invalid one: `$?`
hence causing the following error:

```
error: Error loading syntax file "Packages/<Path_To>.tmLanguage": Error in regex: target of repeat operator is invalid in regex
```

This commit is a workaround to fix this problem.
  • Loading branch information
ni-max committed Nov 22, 2021
1 parent 2802ded commit e8314c6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions grammars/MagicPython.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ E.g. "arr[idx](args)"
<array>
<dict>
<key>match</key>
<string>(\\)\s*(\S.*$\n?)</string>
<string>(\\)\s*(\S.*$\&x6e;?)</string>
<key>captures</key>
<dict>
<key>1</key>
Expand All @@ -872,7 +872,7 @@ E.g. "arr[idx](args)"
</dict>
<dict>
<key>begin</key>
<string>(\\)\s*$\n?</string>
<string>(\\)\s*$\&x6e;?</string>
<key>end</key>
<string>(?x)
(?=^\s*$)
Expand Down Expand Up @@ -1384,7 +1384,7 @@ E.g. "arr[idx](args)"
<key>comment</key>
<string>it is illegal to have a multiline brace inside a single-line string</string>
<key>begin</key>
<string>(\{)(?=[^\n}]*$\n?)</string>
<string>(\{)(?=[^\n}]*$\&x6e;?)</string>
<key>end</key>
<string>(\})|(?=\n)</string>
<key>beginCaptures</key>
Expand Down Expand Up @@ -8181,7 +8181,7 @@ indirectly through syntactic constructs
The guard for newlines has to be separate from the
lookahead because of special $ matching rule.)
($\n?)
($\&x6e;?)
|
(?=[\\\}\{]|(['"])|((?&lt;!\\)\n))
)
Expand All @@ -8204,7 +8204,7 @@ indirectly through syntactic constructs
The guard for newlines has to be separate from the
lookahead because of special $ matching rule.)
($\n?)
($\&x6e;?)
|
(?=[\\\}\{]|(['"])|((?&lt;!\\)\n))
)
Expand Down Expand Up @@ -8553,7 +8553,7 @@ indirectly through syntactic constructs
The guard for newlines has to be separate from the
lookahead because of special $ matching rule.)
($\n?)
($\&x6e;?)
|
(?=[\\\}\{]|'''|""")
)
Expand All @@ -8576,7 +8576,7 @@ indirectly through syntactic constructs
The guard for newlines has to be separate from the
lookahead because of special $ matching rule.)
($\n?)
($\&x6e;?)
|
(?=[\\\}\{]|'''|""")
)
Expand Down

0 comments on commit e8314c6

Please sign in to comment.