-
-
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 #125 from StartAutomating/IrregularUpdates
Irregular updates
- Loading branch information
Showing
34 changed files
with
1,384 additions
and
308 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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' | ||
$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path | ||
|
||
New-RegEx -Description "Matches an ANSI 24-bit color" -Modifier IgnoreCase -Not | | ||
New-RegEx -CharacterClass Escape -Comment 'An Escape' | | ||
New-RegEx -LiteralCharacter '[' -Comment 'Followed by a bracket' | | ||
New-RegEx -Pattern '38;2;' | | ||
New-RegEx -Name Color -Pattern ( | ||
New-Regex -Name Red -Pattern '(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})' -Comment 'Red is the first 0-255 value' | | ||
New-RegEx -Pattern ';' | | ||
New-Regex -Name Red -Pattern '(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})' -Comment 'Green is the second 0-255 value' | | ||
New-RegEx -Pattern ';' | | ||
New-Regex -Name Blue -Pattern '(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})' -Comment 'Blue is the third 0-255 value' | | ||
New-RegEx -Pattern 'm' | ||
) | | ||
Set-Content -Path (Join-Path $myRoot $myName) |
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,7 @@ | ||
# Matches an ANSI 24-bit color | ||
(?-i)\e # An Escape | ||
\[ # Followed by a bracket | ||
38;2;(?<Color>(?<Red>(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # Red is the first 0-255 value | ||
;(?<Red>(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # Green is the second 0-255 value | ||
;(?<Blue>(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # Blue is the third 0-255 value | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' | ||
$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path | ||
|
||
New-RegEx -Description "Matches an ANSI 3 or 4-bit color" | | ||
New-RegEx -CharacterClass Escape -Comment 'An Escape' | | ||
New-RegEx -LiteralCharacter '[' -Comment 'Followed by a bracket' | | ||
New-RegEx -Pattern ( | ||
New-RegEx -Pattern 1 -Optional -Name IsBright | | ||
New-RegEx -LiteralCharacter ';' -Optional | | ||
New-RegEx -Pattern '3[0-7]' -Name ForegroundColor -Optional | | ||
New-RegEx -If ForegroundColor -Then 'm' -Else ( | ||
New-RegEx -Pattern '4[0-7]' -Name BackgroundColor | | ||
New-RegEx -Pattern 'm' -Modifier IgnoreCase -Not | ||
) | ||
) -Name Color | | ||
Set-Content -Path (Join-Path $myRoot $myName) |
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 an ANSI 3 or 4-bit color | ||
\e # An Escape | ||
\[ # Followed by a bracket | ||
(?<Color>(?<IsBright>1)?\;?(?<ForegroundColor>3[0-7])?(?(ForegroundColor)(m)|((?<BackgroundColor>4[0-7])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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' | ||
$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path | ||
|
||
New-RegEx -Description "Matches an ANSI 8-bit color" -Modifier IgnoreCase -Not | | ||
New-RegEx -CharacterClass Escape -Comment 'An Escape' | | ||
New-RegEx -LiteralCharacter '[' -Comment 'Followed by a bracket' | | ||
New-RegEx -Pattern '38;5;' | | ||
New-RegEx -Name Color -Pattern ( | ||
New-RegEx -Atomic -Or @( | ||
New-Regex -Name StandardColor -Pattern '[0-7]' -Comment '0 -7 are standard colors' | | ||
New-RegEx -Pattern m | ||
New-Regex -Name BrightColor -Pattern '(?>[8-9]|1[0-5])' -Comment '8-15 are bright colors' | | ||
New-RegEx -Pattern m | ||
New-Regex -Name CubeColor -Pattern '(?>[0-2][0-3][0-1]|[0-1]\d\d|\d{1,2})' -Comment '16-231 are cubed colors' | | ||
New-RegEx -Pattern m | ||
New-Regex -Name GrayscaleColor -Pattern '(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})' -Comment '232-255 are grayscales' | | ||
New-RegEx -Pattern m | ||
) | ||
) | | ||
Set-Content -Path (Join-Path $myRoot $myName) |
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,12 @@ | ||
# Matches an ANSI 8 bit color | ||
(?-i)\e # An Escape | ||
\[ # Followed by a bracket | ||
38;5;(?<Color>(?> | ||
(?<StandardColor>[0-7]) # 0 -7 are standard colors | ||
m | | ||
(?<BrightColor>(?>[8-9]|1[0-5])) # 8-15 are bright colors | ||
m | | ||
(?<CubeColor>(?>[0-2][0-3][0-1]|[0-1]\d\d|\d{1,2})) # 16-231 are cubed colors | ||
m | | ||
(?<GrayscaleColor>(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # 232-255 are grayscales | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' | ||
$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path | ||
|
||
New-RegEx -Description "Matches an ANSI escape code" -Modifier IgnoreCase -Not | | ||
New-RegEx -CharacterClass Escape -Comment 'An Escape' | | ||
New-RegEx -LiteralCharacter '[' -Comment 'Followed by a bracket' | | ||
New-RegEx -Name ParameterBytes ( | ||
New-Regex -CharacterClass Digit -LiteralCharacter ':;<=>?' -Min 0 | ||
) -Comment "Followed by zero or more parameter bytes" | | ||
New-RegEx -Name IntermediateBytes ( | ||
New-Regex -LiteralCharacter (0x21..0x2F -as [char[]]) -Min 0 -CharacterClass Whitespace | ||
) -Comment "Followed by zero or more intermediate bytes" | | ||
New-RegEx -Name FinalByte ( | ||
New-RegEx -LiteralCharacter (0x40..0x7E -as [char[]]) | ||
) -Comment "Followed by a final byte" | | ||
Set-Content -Path (Join-Path $myRoot $myName) |
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,7 @@ | ||
# Matches an ANSI escape code | ||
(?-i)\e # An Escape | ||
\[ # Followed by a bracket | ||
(?<ParameterBytes>[\d\:\;\<\=\>\?]{0,}) # Followed by zero or more parameter bytes | ||
(?<IntermediateBytes>[\s\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/]{0,}) # Followed by zero or more intermediate bytes | ||
(?<FinalByte>[\@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]\^_\`abcdefghijklmnopqrstuvwxyz\{\|\}\~]) # Followed by a final byte | ||
|
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,11 @@ | ||
$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' | ||
$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path | ||
|
||
New-RegEx -Description "Matches an ANSI color" | | ||
New-RegEx -Atomic -Or @( | ||
New-RegEx -Pattern '?<ANSI_24BitColor>' | ||
New-RegEx -Pattern '?<ANSI_8BitColor>' | ||
New-RegEx -Pattern '?<ANSI_4BitColor>' | ||
New-RegEx -Pattern '?<ANSI_DefaultColor>' | ||
) | | ||
Set-Content -Path (Join-Path $myRoot $myName) -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,41 @@ | ||
# Matches an ANSI color | ||
(?> | ||
(?<ANSI_24BitColor> | ||
(?-i)\e # An Escape | ||
\[ # Followed by a bracket | ||
38;2;(?<Color>(?<Red>(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # Red is the first 0-255 value | ||
;(?<Red>(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # Green is the second 0-255 value | ||
;(?<Blue>(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # Blue is the third 0-255 value | ||
m) | ||
) | ||
| | ||
(?<ANSI_8BitColor> | ||
(?-i)\e # An Escape | ||
\[ # Followed by a bracket | ||
38;5;(?<Color>(?> | ||
(?<StandardColor>[0-7]) # 0 -7 are standard colors | ||
m | | ||
(?<BrightColor>(?>[8-9]|1[0-5])) # 8-15 are bright colors | ||
m | | ||
(?<CubeColor>(?>[0-2][0-3][0-1]|[0-1]\d\d|\d{1,2})) # 16-231 are cubed colors | ||
m | | ||
(?<GrayscaleColor>(?>[0-2][0-5][0-5]|[0-1]\d\d|\d{1,2})) # 232-255 are grayscales | ||
m)) | ||
) | ||
| | ||
(?<ANSI_4BitColor> | ||
\e # An Escape | ||
\[ # Followed by a bracket | ||
(?<Color>(?<IsBright>1)?\;?(?<ForegroundColor>3[0-7])?(?(ForegroundColor)(m)|((?<BackgroundColor>4[0-7])m))) | ||
) | ||
| | ||
(?<ANSI_DefaultColor> | ||
(?-i)\e # An Escape | ||
\[ # Followed by a bracket | ||
(?<Color>(?> | ||
(?<DefaultForeground>39) # 39 Represents the default foreground color | ||
m | | ||
(?<DefaultForeground>49) # 49 Represents the default background 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
$myName = ($MyInvocation.MyCommand.ScriptBlock.File | Split-Path -Leaf) -replace '\.source', '' -replace '\.ps1', '.txt' | ||
$myRoot = $MyInvocation.MyCommand.ScriptBlock.File | Split-Path | ||
|
||
New-RegEx -Description "Matches an ANSI default color" -Modifier IgnoreCase -Not | | ||
New-RegEx -CharacterClass Escape -Comment 'An Escape' | | ||
New-RegEx -LiteralCharacter '[' -Comment 'Followed by a bracket' | | ||
New-RegEx -Name Color -Pattern ( | ||
New-RegEx -Atomic -Or @( | ||
New-Regex -Name DefaultForeground -Pattern '39' -Comment '39 Represents the default foreground color' | | ||
New-RegEx -Pattern 'm' | ||
New-Regex -Name DefaultForeground -Pattern '49' -Comment '49 Represents the default background color' | | ||
New-RegEx -Pattern 'm' | ||
) | ||
) | | ||
Set-Content -Path (Join-Path $myRoot $myName) |
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,8 @@ | ||
# Matches an ANSI 24-bit color | ||
(?-i)\e # An Escape | ||
\[ # Followed by a bracket | ||
(?<Color>(?> | ||
(?<DefaultForeground>39) # 39 Represents the default foreground color | ||
m | | ||
(?<DefaultForeground>49) # 49 Represents the default background 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
This directory contains regular expressions for [ANSI escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code). | ||
|
||
Note: Using these regular expressions in the terminal may result in awkward output. (the .Match will contain an escape sequence, which will make the next output attempt to use this escape sequence) | ||
|
||
|
||
|Name |Description |IsGenerator| | ||
|----------------------------------------------|--------------------------------|-----------| | ||
|[?<ANSI_24BitColor>](24BitColor.regex.txt) |Matches an ANSI 24-bit color |False | | ||
|[?<ANSI_4BitColor>](4BitColor.regex.txt) |Matches an ANSI 3 or 4-bit color|False | | ||
|[?<ANSI_8BitColor>](8BitColor.regex.txt) |Matches an ANSI 8 bit color |False | | ||
|[?<ANSI_Code>](Code.regex.txt) |Matches an ANSI escape code |False | | ||
|[?<ANSI_Color>](Color.regex.txt) |Matches an ANSI color |False | | ||
|[?<ANSI_DefaultColor>](DefaultColor.regex.txt)|Matches an ANSI 24-bit color |False | | ||
|
||
|
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,16 @@ | ||
This directory contains regular expressions for [ANSI escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code). | ||
|
||
Note: Using these regular expressions in the terminal may result in awkward output. (the .Match will contain an escape sequence, which will make the next output attempt to use this escape sequence) | ||
|
||
~~~PipeScript{ | ||
Import-Module ../../Irregular.psd1 -Global | ||
$directoryName = $pwd | Split-Path -Leaf | ||
[PSCustomObject]@{ | ||
Table = Get-Regex -Name "${directoryName}_*" | | ||
Sort-Object Name | | ||
Select @{ | ||
Name='Name' | ||
Expression={"[?<$($_.Name)>]($($_.Path | Split-Path -Leaf))"} | ||
}, Description, IsGenerator | ||
}} | ||
~~~ |
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,9 @@ | ||
This directory contains regular expressions for [Mustache templates](http://mustache.github.io/). | ||
|
||
|
||
|
||
|Name |Description|IsGenerator| | ||
|--------------------------------|-----------|-----------| | ||
|[?<Mustache_Tag>](Tag.regex.ps1)|True | | ||
|
||
|
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,15 @@ | ||
This directory contains regular expressions for [Mustache templates](http://mustache.github.io/). | ||
|
||
|
||
~~~PipeScript{ | ||
Import-Module ../../Irregular.psd1 -Global | ||
$directoryName = $pwd | Split-Path -Leaf | ||
[PSCustomObject]@{ | ||
Table = Get-Regex -Name "${directoryName}_*" | | ||
Sort-Object Name | | ||
Select @{ | ||
Name='Name' | ||
Expression={"[?<$($_.Name)>]($($_.Path | Split-Path -Leaf))"} | ||
}, Description, IsGenerator | ||
}} | ||
~~~ |
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,54 @@ | ||
param( | ||
[string] | ||
$Tag, | ||
|
||
[ValidateSet('Comment','Escaped','SectionStart','SectionEnd', 'Partial', 'Unescaped')] | ||
[string[]] | ||
$TagType | ||
) | ||
|
||
if (-not $tag) { | ||
$tag = @" | ||
(?:.|\s){0,}?(?=\z| # Now we match everything until | ||
(?(IsEscaped)(\}{3})|(\}{2})) # 3 Brackets (if escaped) 2 (if not) | ||
) | ||
"@ | ||
} | ||
|
||
$mustBeType = $true | ||
|
||
$tagTypeRegex = [Ordered]@{ | ||
"Escaped" = "\{", "# One more curly bracket marks it as escaped." | ||
"SectionStart" = "\#", "# Starting with a number sign makes it a section start." | ||
"SectionEnd" = "\/", "# Starting with a slash makes it a section end." | ||
"Comment" = "\!", "# Starting with an exclamation point makes it a comment." | ||
"Partial" = "\>", "# Starting with greater than makes it a partial" | ||
"Unescaped" = "\&", "# Unescaped variables start with ampersands." | ||
} | ||
|
||
if (-not $TagType) { | ||
$TagType = $TagTypeRegex.Keys | ||
$mustBeType = $false | ||
} | ||
$ValidTagTypes = | ||
@(foreach ($tt in $tagTypeRegex.GetEnumerator()) { | ||
@( | ||
$tt.Value[1] | ||
"(?><Is$($tt.Key)>$($tt.Value[0]))" | ||
) -join [Environment]::NewLine | ||
}) -join ([Environment]::NewLine + '|' + [Environment]::NewLine) | ||
|
||
$ValidTagTypes = "(?> | ||
$ValidTagTypes | ||
)$(if (-not $mustBeType) { '?' })" | ||
" | ||
\{{2} # Two curly brackets start a tag | ||
$ValidTagTypes | ||
\s{0,} | ||
(?<Variable> | ||
$tag | ||
) | ||
# Once more, to be sure we're not at the end of the document. | ||
(?(IsEscaped)(\}{3})|(\}{2})) # 3 Brackets (if escaped) 2 (if not) | ||
" |
Oops, something went wrong.