Skip to content

PipeScript 0.2.1 #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 46 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
7925910
RegexLiteral: Not expanding literals within AttributeAST (Fixes #290)
Nov 15, 2022
7dd56dc
RegexLiteral: Not expanding literals within AttributeAST (Fixes #290)
Nov 15, 2022
c12b6cf
RegexLiteral: Not expanding literals within AttributeAST (Fixes #290)
Nov 15, 2022
29c5c28
RegexLiteral: Not expanding literals within AttributeAST (Fixes #290)
Nov 15, 2022
d84b6e0
Removing old references to inline transpilers (re #285)
Nov 15, 2022
8a15123
Removing old references to inline transpilers (re #285)
Nov 15, 2022
9e82498
Removing old references to inline transpilers (re #285)
Nov 15, 2022
e0107d2
Template Transpilers: Enabling interactive use (Fixes #285)
Nov 15, 2022
1ace6ea
Template Transpilers: Enabling interactive use (Fixes #285)
Nov 15, 2022
e521e56
Template Transpilers: Enabling interactive use (Fixes #285)
Nov 15, 2022
e00aed9
Template Transpilers: Enabling interactive use (Fixes #285)
Nov 15, 2022
a9b2ee6
Template Transpilers: Enabling interactive use (Fixes #285)
Nov 15, 2022
ec8b3b8
Adding example for Go Transpiler (re #285)
Nov 15, 2022
983b9b9
Adding example for Go Transpiler (re #285)
Nov 15, 2022
88db2a6
Adding example for Go Transpiler (re #285)
Nov 15, 2022
9c62506
Adding example for Go Transpiler (re #285)
Nov 15, 2022
9a3c7f9
Updating Core Template Transpiler (re #285)
Nov 15, 2022
c47bd81
Merge branch 'PipeScriptFixesAndFun' of https://github.com/StartAutom…
Nov 15, 2022
9a0fa2c
Updating PipeScript.Piecemeal.ps1 (adding commit messages)
Nov 15, 2022
e937cb9
Get-Transpiler: Updating Piecemeal Version
Nov 15, 2022
0d35ebc
Get-PipeScript: Updating Piecemeal Version
Nov 15, 2022
3d0d393
Updating PipeScript.Piecemeal.ps1 (adding commit messages)
Nov 15, 2022
fd7e921
Updating PipeScript.Piecemeal.ps1 (adding commit messages)
Nov 15, 2022
c06e022
Core Transpiler: Enabling changing nearby context for all pipescript …
Nov 15, 2022
e3665c6
Core Transpiler: Enabling changing nearby context for all pipescript …
Nov 15, 2022
1d93d9b
Core Transpiler: Enabling changing nearby context for all pipescript …
Nov 15, 2022
6bd803e
Updating Dot Syntax (Fixes #298)
Nov 16, 2022
27a2d72
Updating Dot Syntax (Fixes #298)
Nov 16, 2022
f95348a
Updating Dot Syntax (Fixes #298)
Nov 16, 2022
c707748
Adding Define (Fixes #299)
Nov 16, 2022
959c92f
Adding Define (Fixes #299)
Nov 16, 2022
718b735
Adding Define (Fixes #299)
Nov 16, 2022
2ccedbd
Adding Define (Fixes #299)
Nov 16, 2022
2d5cf03
Adding Define (Fixes #299)
Nov 16, 2022
99c25d2
Adding Define (Fixes #299)
Nov 16, 2022
2466770
Adding Define (Fixes #299)
Nov 16, 2022
1e16697
Updating Define (only applying attribute to variables to start) (re #…
Nov 16, 2022
dcae8ad
Updating Module Version [0.2.1] and CHANGELOG
Nov 16, 2022
9174a16
Updating Module Version [0.2.1] and CHANGELOG
Nov 16, 2022
6c427f2
Updating Module Version [0.2.1] and CHANGELOG
Nov 16, 2022
d55a19b
Updating Module Version [0.2.1] and CHANGELOG
Nov 16, 2022
21f98fe
Updating Module Version [0.2.1] and CHANGELOG
Nov 16, 2022
8894668
Updating Module Version [0.2.1] and CHANGELOG
Nov 16, 2022
d745ac1
Updating Module Version [0.2.1] and CHANGELOG
Nov 16, 2022
b5f18b0
Updating Module Version [0.2.1] and CHANGELOG
Nov 16, 2022
249a430
Updating Module Version [0.2.1] and CHANGELOG
Nov 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 0.2.1:

* Adding preliminary 'define' transpiler (Fixes #299)
* Improving interactive templates (now supported for all languages) (Fixes #285)
* Fixing sequence dotting within non-statements (Fixes #298)
* Allow multiple transpiler outputs to update nearby context (Fixes #297)
* No longer expanding Regex Literals in attributes (Fixes #290)

---

## 0.2:

* Massive Improvements in Templating
Expand Down
17 changes: 13 additions & 4 deletions Get-PipeScript.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Piecemeal [ 0.3.5 ] : Easy Extensible Plugins for PowerShell
#region Piecemeal [ 0.3.6 ] : Easy Extensible Plugins for PowerShell
# Install-Module Piecemeal -Scope CurrentUser
# Import-Module Piecemeal -Force
# Install-Piecemeal -ExtensionNoun 'PipeScript' -ExtensionPattern '\.psx\.ps1{0,1}$','\.ps1{0,1}\.(?<ext>[^.]+$)','\.ps1{0,1}$' -ExtensionTypeName 'PipeScript' -OutputPath '.\Get-PipeScript.ps1'
Expand Down Expand Up @@ -602,11 +602,20 @@ function Get-PipeScript
$params = @{}
$mappedParams = [Ordered]@{} # Create a collection of mapped parameters
# Walk thru each parameter of this command
foreach ($myParam in $paramSet.Parameters) {
:nextParameter foreach ($myParam in $paramSet.Parameters) {
# If the parameter is ValueFromPipeline
if ($myParam.ValueFromPipeline) {
$potentialPSTypeNames = @($myParam.Attributes.PSTypeName) -ne ''
if ($potentialPSTypeNames) {
foreach ($potentialTypeName in $potentialPSTypeNames) {
if ($potentialTypeName -and $InputObject.pstypenames -contains $potentialTypeName) {
$mappedParams[$myParam.Name] = $params[$myParam.Name] = $InputObject
continue nextParameter
}
}
}
# and we have an input object
if ($null -ne $inputObject -and
elseif ($null -ne $inputObject -and
(
# of the exact type
$myParam.ParameterType -eq $inputObject.GetType() -or
Expand Down Expand Up @@ -925,5 +934,5 @@ function Get-PipeScript
}
}
}
#endregion Piecemeal [ 0.3.5 ] : Easy Extensible Plugins for PowerShell
#endregion Piecemeal [ 0.3.6 ] : Easy Extensible Plugins for PowerShell

17 changes: 13 additions & 4 deletions Get-Transpiler.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Piecemeal [ 0.3.5 ] : Easy Extensible Plugins for PowerShell
#region Piecemeal [ 0.3.6 ] : Easy Extensible Plugins for PowerShell
# Install-Module Piecemeal -Scope CurrentUser
# Import-Module Piecemeal -Force
# Install-Piecemeal -ExtensionNoun 'Transpiler' -ExtensionPattern '\.psx\.ps1$' -ExtensionTypeName 'PipeScript.Transpiler' -OutputPath '.\Get-Transpiler.ps1'
Expand Down Expand Up @@ -602,11 +602,20 @@ function Get-Transpiler
$params = @{}
$mappedParams = [Ordered]@{} # Create a collection of mapped parameters
# Walk thru each parameter of this command
foreach ($myParam in $paramSet.Parameters) {
:nextParameter foreach ($myParam in $paramSet.Parameters) {
# If the parameter is ValueFromPipeline
if ($myParam.ValueFromPipeline) {
$potentialPSTypeNames = @($myParam.Attributes.PSTypeName) -ne ''
if ($potentialPSTypeNames) {
foreach ($potentialTypeName in $potentialPSTypeNames) {
if ($potentialTypeName -and $InputObject.pstypenames -contains $potentialTypeName) {
$mappedParams[$myParam.Name] = $params[$myParam.Name] = $InputObject
continue nextParameter
}
}
}
# and we have an input object
if ($null -ne $inputObject -and
elseif ($null -ne $inputObject -and
(
# of the exact type
$myParam.ParameterType -eq $inputObject.GetType() -or
Expand Down Expand Up @@ -925,5 +934,5 @@ function Get-Transpiler
}
}
}
#endregion Piecemeal [ 0.3.5 ] : Easy Extensible Plugins for PowerShell
#endregion Piecemeal [ 0.3.6 ] : Easy Extensible Plugins for PowerShell

1 change: 1 addition & 0 deletions ListOfTranspilers.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ These are all of the transpilers currently included in PipeScript:
|[CSharp.Template](Transpilers/Templates/CSharp.Template.psx.ps1) |C# Template Transpiler. |
|[CSS.Template](Transpilers/Templates/CSS.Template.psx.ps1) |CSS Template Transpiler. |
|[Decorate](Transpilers/Decorate.psx.ps1) |decorate transpiler |
|[Define](Transpilers/Define.psx.ps1) |Defines a variable |
|[Dot](Transpilers/Syntax/Dot.psx.ps1) |Dot Notation |
|[EqualityComparison](Transpilers/Syntax/EqualityComparison.psx.ps1) |Allows equality comparison. |
|[EqualityTypeComparison](Transpilers/Syntax/EqualityTypeComparison.psx.ps1) |Allows equality type comparison. |
Expand Down
6 changes: 4 additions & 2 deletions PipeScript.Piecemeal.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#require -Module Piecemeal
Push-Location $PSScriptRoot

Install-Piecemeal -ExtensionNoun 'Transpiler' -ExtensionPattern '\.psx\.ps1$' -ExtensionTypeName 'PipeScript.Transpiler' -OutputPath '.\Get-Transpiler.ps1'
Install-Piecemeal -ExtensionNoun 'PipeScript' -ExtensionPattern '\.psx\.ps1{0,1}$','\.ps1{0,1}\.(?<ext>[^.]+$)','\.ps1{0,1}$' -ExtensionTypeName 'PipeScript' -OutputPath '.\Get-PipeScript.ps1'
Install-Piecemeal -ExtensionNoun 'Transpiler' -ExtensionPattern '\.psx\.ps1$' -ExtensionTypeName 'PipeScript.Transpiler' -OutputPath '.\Get-Transpiler.ps1' |
Add-Member Noteproperty CommitMessage "Get-Transpiler: Updating Piecemeal Version" -Force -PassThru
Install-Piecemeal -ExtensionNoun 'PipeScript' -ExtensionPattern '\.psx\.ps1{0,1}$','\.ps1{0,1}\.(?<ext>[^.]+$)','\.ps1{0,1}$' -ExtensionTypeName 'PipeScript' -OutputPath '.\Get-PipeScript.ps1' |
Add-Member Noteproperty CommitMessage "Get-PipeScript: Updating Piecemeal Version" -Force -PassThru


Pop-Location
20 changes: 7 additions & 13 deletions PipeScript.ps.psd1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@{
ModuleVersion = '0.2'
ModuleVersion = '0.2.1'
Description = 'An Extensible Transpiler for PowerShell (and anything else)'
RootModule = 'PipeScript.psm1'
PowerShellVersion = '4.0'
Expand All @@ -25,19 +25,13 @@
BuildModule = @('EZOut','Piecemeal','PipeScript','HelpOut', 'PSDevOps')
Tags = 'PipeScript','PowerShell', 'Transpilation', 'Compiler'
ReleaseNotes = @'
## 0.2:
## 0.2.1:

* Massive Improvements in Templating
* Templates can be used interactively (Fixes #285)
* Renaming all Inline Transpilers to Template Transpilers
* Natural Parsing Improvements
* ArrayLiterals are expanded (Fixes #291)
* AsSentence now only allows one value into a singleton (Fixes #279)
* Not expanding expandable strings (Fixes #286)
* Transpilers can change nearby context (Fixes #292)
* Allowing dot syntax to extend across multiple statements (Fixes #273)
* Adding requires keyword (Fixes #293)
* PipeScript modifies its own manifest (Fixes #294)
* Adding preliminary 'define' transpiler (Fixes #299)
* Improving interactive templates (now supported for all languages) (Fixes #285)
* Fixing sequence dotting within non-statements (Fixes #298)
* Allow multiple transpiler outputs to update nearby context (Fixes #297)
* No longer expanding Regex Literals in attributes (Fixes #290)

---

Expand Down
20 changes: 7 additions & 13 deletions PipeScript.psd1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@{
ModuleVersion = '0.2'
ModuleVersion = '0.2.1'
Description = 'An Extensible Transpiler for PowerShell (and anything else)'
RootModule = 'PipeScript.psm1'
PowerShellVersion = '4.0'
Expand All @@ -20,19 +20,13 @@
BuildModule = @('EZOut','Piecemeal','PipeScript','HelpOut', 'PSDevOps')
Tags = 'PipeScript','PowerShell', 'Transpilation', 'Compiler'
ReleaseNotes = @'
## 0.2:
## 0.2.1:

* Massive Improvements in Templating
* Templates can be used interactively (Fixes #285)
* Renaming all Inline Transpilers to Template Transpilers
* Natural Parsing Improvements
* ArrayLiterals are expanded (Fixes #291)
* AsSentence now only allows one value into a singleton (Fixes #279)
* Not expanding expandable strings (Fixes #286)
* Transpilers can change nearby context (Fixes #292)
* Allowing dot syntax to extend across multiple statements (Fixes #273)
* Adding requires keyword (Fixes #293)
* PipeScript modifies its own manifest (Fixes #294)
* Adding preliminary 'define' transpiler (Fixes #299)
* Improving interactive templates (now supported for all languages) (Fixes #285)
* Fixing sequence dotting within non-statements (Fixes #298)
* Allow multiple transpiler outputs to update nearby context (Fixes #297)
* No longer expanding Regex Literals in attributes (Fixes #290)

---

Expand Down
2 changes: 1 addition & 1 deletion Transpilers/Core/PipeScript.Template.psx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ process {
}

if (-not (Test-Path $Name)) {
$null = New-Item -ItemType $file -Path $name -Force
$null = New-Item -ItemType File -Path $name -Force
}
$evaluated | Set-Content -Path $name
Get-Item -Path $name
Expand Down
83 changes: 43 additions & 40 deletions Transpilers/Core/Pipescript.psx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -268,60 +268,63 @@ process {
$start = $scriptText.IndexOf($item.Extent.Text, $myOffset)
$end = $start + $item.Extent.Text.Length
$skipUntil = $end # set SkipUntil
$AstReplacements[$item] = $pso # and store the replacement.
$AstReplacements[$item] = $pso # and store the replacement.
}

#region Special Properties

#region Special Properties
# Because PowerShell can attach properties to any object,
# we can use the presence of attached properties to change context around the replacement.
# Because PowerShell can attach properties to any object,
# we can use the presence of attached properties to change context around the replacement.
# This happens regardless of if there is already a replacement for the current item.

# .SkipUntil or .IgnoreUntil can specify a new index or AST end point
foreach ($toSkipAlias in 'SkipUntil', 'IgnoreUntil') {
foreach ($toSkipUntil in $pso.$toSkipAlias) {
if ($toSkipUntil -is [int] -and $toSkipUntil -gt $end) {
$skipUntil = $toSkipUntil
} elseif ($toSkipUntil -is [Management.Automation.Language.Ast]) {
$newSkipStart = $scriptText.IndexOf($toSkipUntil.Extent.Text, $myOffset)
if ($newSkipStart -ne -1) {
$end = $newSkipStart + $toSkipUntil.Extent.Text.Length
if ($end -gt $skipUntil) {
$skipUntil = $end
}
if ($toSkipUntil -ne $item) {
$AstReplacements[$toSkipUntil] = ''
}
# .SkipUntil or .IgnoreUntil can specify a new index or AST end point
foreach ($toSkipAlias in 'SkipUntil', 'IgnoreUntil') {
foreach ($toSkipUntil in $pso.$toSkipAlias) {
if ($toSkipUntil -is [int] -and $toSkipUntil -gt $end) {
$skipUntil = $toSkipUntil
} elseif ($toSkipUntil -is [Management.Automation.Language.Ast]) {
$newSkipStart = $scriptText.IndexOf($toSkipUntil.Extent.Text, $myOffset)
if ($newSkipStart -ne -1) {
$end = $newSkipStart + $toSkipUntil.Extent.Text.Length
if ($end -gt $skipUntil) {
$skipUntil = $end
}
if ($toSkipUntil -ne $item) {
$AstReplacements[$toSkipUntil] = ''
}
}
}
}
}

#.ToRemove,.RemoveAST, or .RemoveElement will remove AST elements or ranges
foreach ($toRemoveAlias in 'ToRemove','RemoveAST','RemoveElement') {
foreach ($toRemove in $pso.$toRemoveAlias) {
if ($toRemove -is [Management.Automation.Language.Ast]) {
$AstReplacements[$toRemove] = ''
} elseif ($toRemove -match '^\d+,\d+$') {
$Replacements[$toRemove] = ''
}
#.ToRemove,.RemoveAST, or .RemoveElement will remove AST elements or ranges
foreach ($toRemoveAlias in 'ToRemove','RemoveAST','RemoveElement') {
foreach ($toRemove in $pso.$toRemoveAlias) {
if ($toRemove -is [Management.Automation.Language.Ast]) {
$AstReplacements[$toRemove] = ''
} elseif ($toRemove -match '^\d+,\d+$') {
$Replacements[$toRemove] = ''
}
}
}

#.ToReplace,.ReplaceAST or .ReplaceElement will replace elements or ranges.
foreach ($toReplaceAlias in 'ToReplace','ReplaceAST','ReplaceElement') {
foreach ($toReplace in $pso.$toReplaceAlias) {
if ($toReplace -isnot [Collections.IDictionary]) {
continue
}
foreach ($tr in $toReplace.GetEnumerator()) {
if ($tr.Key -is [Management.Automaton.Language.Ast]) {
$AstReplacements[$tr.Key] = $tr.Value
} elseif ($tr.Key -match '^\d+,\d+$') {
$textReplacements["$($tr.Key)"] = $tr.Value
}
#.ToReplace,.ReplaceAST or .ReplaceElement will replace elements or ranges.
foreach ($toReplaceAlias in 'ToReplace','ReplaceAST','ReplaceElement') {
foreach ($toReplace in $pso.$toReplaceAlias) {
if ($toReplace -isnot [Collections.IDictionary]) {
continue
}
foreach ($tr in $toReplace.GetEnumerator()) {
if ($tr.Key -is [Management.Automaton.Language.Ast]) {
$AstReplacements[$tr.Key] = $tr.Value
} elseif ($tr.Key -match '^\d+,\d+$') {
$textReplacements["$($tr.Key)"] = $tr.Value
}
}
}
#endregion Special Properties
}
#endregion Special Properties

}
# If the transpiler had output, do not process any more transpilers.
if ($pipeScriptOutput) { break }
Expand Down
Loading