Created
January 23, 2021 19:40
-
-
Save 0xF6/1861b394baab731ab80cff1e87ba7450 to your computer and use it in GitHub Desktop.
rex for method declaration
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
(?x) | |
(?<return-type> | |
(?<type-name> | |
(?: | |
(?:ref\s+(?:readonly\s+)?)? | |
(?: | |
(?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\s*\:\:\s*)? | |
(?<name-and-type-args> | |
\g<identifier>\s* | |
(?<type-args>\s*<(?:[^<>]|\g<type-args>)+>\s*)? | |
) | |
(?:\s*\.\s*\g<name-and-type-args>)* | | |
(?<tuple>\s*\((?:[^\(\)]|\g<tuple>)+\)) | |
) | |
(?:\s*\?\s*)? | |
(?:\s*\[(?:\s*,\s*)*\]\s*)* | |
) | |
)\s+ | |
) | |
(?<interface-name>\g<type-name>\s*\.\s*)? | |
(\g<identifier>)\s* | |
(<([^<>]+)>)?\s* | |
(?=\() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment