-
-
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.
Merge pull request #169 from StartAutomating/Irregular-Improvement
Irregular improvement
- Loading branch information
Showing
59 changed files
with
232 additions
and
117 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,8 +1,16 @@ | ||
# Matches an ANSI 3 or 4-bit color | ||
\e # An Escape | ||
\[ # Followed by a bracket | ||
\e # An Escape | ||
\[ # Followed by a bracket | ||
(?<Color>(?> | ||
(?<IsBright>1)?\;{0,1}(?<IsForegroundColor>3) | | ||
(?<IsBright>(?<IsForegroundColor>9)) | | ||
(?<IsBright>1)?\;{0,1}(?<IsBackgroundColor>4) | | ||
(?<IsBright>(?<IsBackgroundColor>10)))(?<ColorNumber>[0-7])m) | ||
(?<IsBright>1)?\;{0,1} # A 1 and a semicolon indicate a bright color | ||
(?<IsForegroundColor>3) # A number that starts with 3 indicates foreground color | ||
| | ||
(?<IsBright>(?<IsForegroundColor>9)) # OR it could be a less common bright foreground color, which starts with 9 | ||
| | ||
(?<IsBright>1)?\;{0,1} # A 1 and a semicolon indicate a bright color | ||
(?<IsBackgroundColor>4) # A number that starts with 3 indicates foreground color | ||
| | ||
(?<IsBright>(?<IsBackgroundColor>10)) # OR it could be a less common bright foreground color, which starts with 9 | ||
)(?<ColorNumber>[0-7]) # The color number will be between 0 and 7 | ||
(?:\;{0,1}(?<IsBright>1)?)? # Brightness can also come after a color | ||
m) |
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
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,43 @@ | ||
$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' | ||
$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path | ||
New-RegEx -Description 'Matches a CSharp class' | | ||
New-RegEx -Name AccessModifier @( | ||
New-Regex -Modifier IgnoreCase -Not | ||
New-RegEx -Atomic -Or @( | ||
New-RegEx -Pattern "protected\s{1,}internal" | ||
New-RegEx -Pattern "protected" | ||
New-RegEx -Pattern "private\s{1,}protected" | ||
New-RegEx -Pattern "internal" | ||
New-RegEx -Pattern "private" | ||
New-RegEx -Pattern "public" | ||
) -Optional | ||
) -Comment "An Optional Access Modifier" | | ||
New-RegEx -CharacterClass Whitespace -Min 1 | | ||
New-RegEx -NoCapture @( | ||
New-RegEx -Modifier IgnoreCase -Not | | ||
New-RegEx -Pattern class | | ||
New-RegEx -CharacterClass Whitespace -Min 1 | ||
) -Comment "Followed by 'class'" | | ||
New-RegEx -Name ClassName @( | ||
New-Regex -LiteralCharacter _ -CharacterClass Letter | | ||
New-RegEx -CharacterClass PunctuationConnector, Letter, Digit, MarkNonSpacing -Min 0 | ||
) -Comment "Followed by an identifier"| | ||
New-RegEx -Optional -Pattern @( | ||
New-RegEx -CharacterClass Whitespace -Min 1 | | ||
New-RegEx -LiteralCharacter ':' -Name IsInheriting | | ||
New-RegEx -CharacterClass Whitespace -Min 1 | ||
) -NoCapture -Comment "Followed by an optional colon" | | ||
New-RegEx -If IsInheriting -Then @( | ||
New-RegEx -NoCapture @( | ||
New-RegEx -CharacterClass Whitespace -Min 0 | ||
New-RegEx -Name Inherits @( | ||
New-Regex -LiteralCharacter _ -CharacterClass Letter | | ||
New-RegEx -CharacterClass PunctuationConnector, Letter, Digit, MarkNonSpacing -Min 0 | ||
) | | ||
New-RegEx -CharacterClass Whitespace -Min 0 | | ||
New-RegEx -LiteralCharacter ',' -Min 0 | ||
) -Min 1 | ||
) -Else '' -Description "If a colon was present, followed by a number of identifiers" | | ||
New-RegEx -CharacterClass Whitespace -Min 0 -Comment "Followed by whitespace and balanced curly brackets" | | ||
New-RegEx -Pattern ?<BalancedCurlyBracket> -Name ClassBody | | ||
Set-Content -Path (Join-Path $myRoot $myName) -Encoding UTF8 -PassThru |
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,23 @@ | ||
# Matches a CSharp class | ||
(?<AccessModifier>(?:(?-i) (?> | ||
protected\s{1,}internal | | ||
protected | | ||
private\s{1,}protected | | ||
internal | | ||
private | | ||
public)?)) # An Optional Access Modifier | ||
\s{1,}(?:(?-i)class\s{1,}) # Followed by 'class' | ||
(?<ClassName>[\p{L}_][\p{Pc}\p{L}\d\p{Mn}]{0,}) # Followed by an identifier | ||
(?:\s{1,}(?<IsInheriting>\:)\s{1,})? # Followed by an optional colon | ||
# If a colon was present, followed by a number of identifiers | ||
(?(IsInheriting)((?:(?:\s{0,} (?<Inherits>[\p{L}_][\p{Pc}\p{L}\d\p{Mn}]{0,})\s{0,}\,{0,})){1,}))\s{0,} # Followed by whitespace and balanced curly brackets | ||
(?<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 } | ||
) | ||
) |
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,6 @@ | ||
$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' | ||
$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path | ||
New-RegEx -Description 'Matches a CSharp identifier' | | ||
New-Regex -Comment "Must start with a letter or underscore" -LiteralCharacter _ -CharacterClass Letter | | ||
New-RegEx -CharacterClass PunctuationConnector, Letter, Digit, MarkNonSpacing -Description "Followed by any number of letters, digitis, nonspacing marks, and connector punctation" -Min 0| | ||
Set-Content -Path (Join-Path $myRoot $myName) -Encoding UTF8 -PassThru |
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,4 @@ | ||
# Matches a CSharp identifier | ||
[\p{L}_] # Must start with a letter or underscore | ||
# Followed by any number of letters, digitis, nonspacing marks, and connector punctation | ||
[\p{Pc}\p{L}\d\p{Mn}]{0,} |
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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
This directory contains regular expressions to help parse C#. | ||
This directory contains regular expressions to help parse C# code. | ||
|
||
|
||
|Name |Description |Source | | ||
|------------------------------------------|------------------------------|------------------------------------| | ||
|[?<CSharp_Namespace>](Namespace.regex.txt)|Matches a CSharp namespace |[source](Namespace.regex.source.ps1)| | ||
|[?<CSharp_Using>](Using.regex.txt) |Matches a CSharp using keyword| | ||
|Name |Description |Source | | ||
|--------------------------------------------|------------------------------|-------------------------------------| | ||
|[?<CSharp_Class>](Class.regex.txt) |Matches a CSharp class |[source](Class.regex.source.ps1) | | ||
|[?<CSharp_Identifier>](Identifier.regex.txt)|Matches a CSharp identifier |[source](Identifier.regex.source.ps1)| | ||
|[?<CSharp_Namespace>](Namespace.regex.txt) |Matches a CSharp namespace |[source](Namespace.regex.source.ps1) | | ||
|[?<CSharp_Using>](Using.regex.txt) |Matches a CSharp using keyword| | ||
|
||
|
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
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Repeated Digits | ||
# Repeated Digits | ||
\d+ |
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
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 |
---|---|---|
@@ -1,18 +1,8 @@ | ||
# Matches Header information from the output of git diff | ||
(?m)^diff # diff line start | ||
\s--git\s # whitespace, then --git, then whitespace | ||
(?<From>\S+) # From | ||
\s # Whitespace | ||
(?<To>\S+) # To | ||
(?<ExtendedHeader>(?:.|\s){0,}?(?=\z|^index)) # Until 'index' | ||
^index\s # Index Line Start | ||
(?<FromHash>\w+) # FromHash | ||
\.{2,2} # DotDot | ||
(?<ToHash>\w+) # ToHash | ||
\s(?<Mode>\w+) # FileMode | ||
(?:.|\s){0,}?(?=\z|^---) # UntilDashLine | ||
\-{3,3}\s # DashLineAndWhitespace | ||
(?<FromUnified>\S+) # FromUnified | ||
\s+\+{3,3}\s # PlusLineAndWhitespace | ||
(?<ToUnified>\S+) # ToUnified | ||
\s | ||
(?m)^diff # diff line start | ||
\s--git\s # whitespace, then --git, then whitespace | ||
(?<From>\S+) # From | ||
\s # Whitespace | ||
(?<To>\S+) # To | ||
(?<ExtendedHeader>(?:.|\s){0,}?(?=\z|^index\s{1})) # Until 'index' | ||
|
Oops, something went wrong.