Skip to content

Commit

Permalink
Merge pull request sublimehq#8 from deathaxe/pr/regex/simplify-duplic…
Browse files Browse the repository at this point in the history
…ate-group-start-logic

[Regular Expressions] Add other_modifiers variable
  • Loading branch information
keith-hall authored Sep 30, 2021
2 parents ea373c9 + a7b8afb commit b923f43
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Regular Expressions/RegExp (Basic).sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ variables:
char_class: '\\(?:[wWsSdDhHvVXR]|[pP](?:\{[a-zA-Z_]+\}|(L&|[A-Z][a-z]?)))'
activate_x_mode: (?:\?[ims]*x[ixms]*(?:-[ims]+)?)
deactivate_x_mode: (?:\?[ims]*-[ims]*x[imxs]*)
other_modifiers: \?(?:[ixms]*-)?[ixms]+

contexts:
main:
Expand Down Expand Up @@ -110,11 +111,11 @@ contexts:
pop: 3
set: [group-body, maybe-unexpected-quantifiers]
# Other modifiers
- match: '\?(?:[ixms]*-)?[ixms]+:'
- match: '{{other_modifiers}}:'
scope: storage.modifier.mode.regexp
pop: 1
# Other modifiers (must come after other modifier matches)
- match: (\?(?:[ixms]*-)?[ixms]+)(\))
- match: ({{other_modifiers}})(\))
captures:
1: storage.modifier.mode.regexp
2: keyword.control.group.regexp
Expand Down

0 comments on commit b923f43

Please sign in to comment.