-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
James Brundage
authored and
James Brundage
committed
Sep 22, 2024
1 parent
19c650c
commit 68a7748
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Matches a JavaScript Class | ||
class # Class Keyword | ||
\s+ # Whitespace | ||
(?<ClassName>\S){1,} # Class Name | ||
\s{0,} # Optional whitespace | ||
(?<ClassModifier>[^\{]{0,})\s{0,} # Optional whitespace | ||
(?<ClassBody>(?<BalancedCurlyBracket> | ||
\{ # An open { | ||
(?> # Followed by... | ||
[^\{\}]+| # any number of non-bracket character OR | ||
\{(?<Depth>)| # an open curly bracket (in which case increment depth) OR | ||
\}(?<-Depth>) # a closed curly bracket (in which case decrement depth) | ||
)*?(?(Depth)(?!)) # until depth is 0. | ||
\} # followed by a } | ||
) | ||
) # The class body | ||
|