Skip to content

Commit 356b4c2

Browse files
Merge pull request #248 from StartAutomating/PipeScript-Updates
Pipe script updates
2 parents ea5e4a6 + dbd964a commit 356b4c2

15 files changed

+286
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.1.7:
2+
* Added LATEX / TEX support (Fixes #230)
3+
* Adding LUA support (Fixes #246)
4+
* Fixing Core Transpiler Attribute Behavior (Fixes #247)
5+
---
6+
17
## 0.1.6:
28
* Added 'all' keyword (iterate over everything) (Fixes #244).
39
* Added Natural Language Processing to CommandAST (Fixes #242)

ListOfTranspilers.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ These are all of the transpilers currently included in PipeScript:
3737
|[Inline.JavaScript](Transpilers/Inline/Inline.JavaScript.psx.ps1) |JavaScript Inline PipeScript Transpiler. |
3838
|[Inline.Json](Transpilers/Inline/Inline.Json.psx.ps1) |JSON PipeScript Transpiler. |
3939
|[Inline.Kotlin](Transpilers/Inline/Inline.Kotlin.psx.ps1) |Kotlin Inline PipeScript Transpiler. |
40+
|[Inline.Latex](Transpilers/Inline/Inline.Latex.psx.ps1) |Latex Inline PipeScript Transpiler. |
41+
|[Inline.LUA](Transpilers/Inline/Inline.LUA.psx.ps1) |LUA Inline PipeScript Transpiler. |
4042
|[Inline.Markdown](Transpilers/Inline/Inline.Markdown.psx.ps1) |Markdown File Transpiler. |
4143
|[Inline.ObjectiveC](Transpilers/Inline/Inline.ObjectiveC.psx.ps1) |Objective C PipeScript Transpiler. |
4244
|[Inline.OpenSCAD](Transpilers/Inline/Inline.OpenSCAD.psx.ps1) |OpenSCAD Inline PipeScript Transpiler. |

PipeScript.psd1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@{
2-
ModuleVersion = '0.1.6'
2+
ModuleVersion = '0.1.7'
33
Description = 'An Extensible Transpiler for PowerShell (and anything else)'
44
RootModule = 'PipeScript.psm1'
55
PowerShellVersion = '4.0'
@@ -19,6 +19,12 @@
1919
BuildModule = @('EZOut','Piecemeal','PipeScript','HelpOut', 'PSDevOps')
2020
Tags = 'PipeScript','PowerShell', 'Transpilation', 'Compiler'
2121
ReleaseNotes = @'
22+
## 0.1.7:
23+
* Added LATEX / TEX support (Fixes #230)
24+
* Adding LUA support (Fixes #246)
25+
* Fixing Core Transpiler Attribute Behavior (Fixes #247)
26+
---
27+
2228
## 0.1.6:
2329
* Added 'all' keyword (iterate over everything) (Fixes #244).
2430
* Added Natural Language Processing to CommandAST (Fixes #242)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Often, programming involves implementing small functional changes within a speci
5050

5151
For example, if implementing an interface or subclass, the only things that will change are the class name and method details.
5252

53-
PipeScript can be be embedded within 35 languages.
53+
PipeScript can be be embedded within 37 languages.
5454

5555
Embedding PipeScript within any of these languages allows you to generate any of these languages with parameterized scripts, thus removing some of the tedium of programming.
5656

SupportedLanguages.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ These are all of the transpilers currently included in PipeScript:
2121
|[JavaScript](Transpilers/Inline/Inline.JavaScript.psx.ps1)|JavaScript Inline PipeScript Transpiler.|```\.js$``` |
2222
|[Json](Transpilers/Inline/Inline.Json.psx.ps1) |JSON PipeScript Transpiler. |```\.json$``` |
2323
|[Kotlin](Transpilers/Inline/Inline.Kotlin.psx.ps1) |Kotlin Inline PipeScript Transpiler. |```\.kt$``` |
24+
|[Latex](Transpilers/Inline/Inline.Latex.psx.ps1) |Latex Inline PipeScript Transpiler. |```\.(?>latex\\|tex)$``` |
25+
|[LUA](Transpilers/Inline/Inline.LUA.psx.ps1) |LUA Inline PipeScript Transpiler. |```\.lua$``` |
2426
|[Markdown](Transpilers/Inline/Inline.Markdown.psx.ps1) |Markdown File Transpiler. |```\.(?>md\\|markdown)$``` |
2527
|[ObjectiveC](Transpilers/Inline/Inline.ObjectiveC.psx.ps1)|Objective C PipeScript Transpiler. |```\.(?>m\\|mm)$``` |
2628
|[OpenSCAD](Transpilers/Inline/Inline.OpenSCAD.psx.ps1) |OpenSCAD Inline PipeScript Transpiler. |```\.scad$``` |

Transpilers/Core/Pipescript.psx.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,14 @@ process {
9191
@(
9292
# check each ScriptBlock attribute
9393
foreach ($attrAst in $ScriptBlock.Ast.ParamBlock.Attributes) {
94-
$attrRealType = $attrAst.TypeName.ToString() -as [type]
94+
95+
$attrRealType =
96+
if ($attrAst.TypeName.GetReflectionType) {
97+
$attrAst.TypeName.GetReflectionType()
98+
} elseif ($attrAst.TypeName.ToString) {
99+
$attrAst.TypeName.ToString() -as [type]
100+
}
101+
95102
if (-not $attrRealType) {
96103
$attrAst
97104
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<#
2+
.SYNOPSIS
3+
LUA Inline PipeScript Transpiler.
4+
.DESCRIPTION
5+
Transpiles LUA with Inline PipeScript into LUA.
6+
7+
Multiline comments like ```--{[[``` ```--}]]``` will be treated as blocks of PipeScript.
8+
#>
9+
[ValidatePattern('\.lua$')]
10+
param(
11+
# The command information. This will include the path to the file.
12+
[Parameter(Mandatory,ValueFromPipeline)]
13+
[Management.Automation.CommandInfo]
14+
$CommandInfo,
15+
16+
# A dictionary of parameters.
17+
[Collections.IDictionary]
18+
$Parameter,
19+
20+
# A list of arguments.
21+
[PSObject[]]
22+
$ArgumentList
23+
)
24+
25+
begin {
26+
# We start off by declaring a number of regular expressions:
27+
$startComment = '\-\-\[\[\{' # * Start Comments ```--[[{```
28+
$endComment = '--\}\]\]' # * End Comments ```--}]]```
29+
$Whitespace = '[\s\n\r]{0,}'
30+
$startRegex = "(?<PSStart>${startComment})"
31+
$endRegex = "(?<PSEnd>${endComment}\s{0,})"
32+
33+
# Create a splat containing arguments to the core inline transpiler
34+
$Splat = [Ordered]@{
35+
StartPattern = $startRegex
36+
EndPattern = $endRegex
37+
}
38+
}
39+
40+
process {
41+
# Add parameters related to the file
42+
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
43+
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
44+
if ($Parameter) { $splat.Parameter = $Parameter }
45+
if ($ArgumentList) { $splat.ArgumentList = $ArgumentList }
46+
47+
# Call the core inline transpiler.
48+
.>PipeScript.Inline @Splat
49+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<#
2+
.SYNOPSIS
3+
Latex Inline PipeScript Transpiler.
4+
.DESCRIPTION
5+
Transpiles Latex with Inline PipeScript into Latex.
6+
7+
Multiline comments with %{}% will be treated as blocks of PipeScript.
8+
#>
9+
[ValidatePattern('\.(?>latex|tex)$')]
10+
param(
11+
# The command information. This will include the path to the file.
12+
[Parameter(Mandatory,ValueFromPipeline)]
13+
[Management.Automation.CommandInfo]
14+
$CommandInfo,
15+
16+
# A dictionary of parameters.
17+
[Collections.IDictionary]
18+
$Parameter,
19+
20+
# A list of arguments.
21+
[PSObject[]]
22+
$ArgumentList
23+
)
24+
25+
begin {
26+
# We start off by declaring a number of regular expressions:
27+
$startComment = '\%\{' # * Start Comments ```%{```
28+
$endComment = '\}\%' # * End Comments ```}%```
29+
$Whitespace = '[\s\n\r]{0,}'
30+
$startRegex = "(?<PSStart>${startComment})"
31+
$endRegex = "(?<PSEnd>${endComment}\s{0,})"
32+
33+
# Create a splat containing arguments to the core inline transpiler
34+
$Splat = [Ordered]@{
35+
StartPattern = $startRegex
36+
EndPattern = $endRegex
37+
}
38+
}
39+
40+
process {
41+
# Add parameters related to the file
42+
$Splat.SourceFile = $commandInfo.Source -as [IO.FileInfo]
43+
$Splat.SourceText = [IO.File]::ReadAllText($commandInfo.Source)
44+
if ($Parameter) { $splat.Parameter = $Parameter }
45+
if ($ArgumentList) { $splat.ArgumentList = $ArgumentList }
46+
47+
# Call the core inline transpiler.
48+
.>PipeScript.Inline @Splat
49+
}

Transpilers/Inline/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
This directory contains Inline PipeScript transpilers for several languages.
22

3-
PipeScript can currently be embedded in 35 languages or file types.
3+
PipeScript can currently be embedded in 37 languages or file types.
44

55
### Supported Languages
66

@@ -24,6 +24,8 @@ PipeScript can currently be embedded in 35 languages or file types.
2424
|[JavaScript](Inline.JavaScript.psx.ps1)|JavaScript Inline PipeScript Transpiler.|```\.js$``` |
2525
|[Json](Inline.Json.psx.ps1) |JSON PipeScript Transpiler. |```\.json$``` |
2626
|[Kotlin](Inline.Kotlin.psx.ps1) |Kotlin Inline PipeScript Transpiler. |```\.kt$``` |
27+
|[Latex](Inline.Latex.psx.ps1) |Latex Inline PipeScript Transpiler. |```\.(?>latex\\|tex)$``` |
28+
|[LUA](Inline.LUA.psx.ps1) |LUA Inline PipeScript Transpiler. |```\.lua$``` |
2729
|[Markdown](Inline.Markdown.psx.ps1) |Markdown File Transpiler. |```\.(?>md\\|markdown)$``` |
2830
|[ObjectiveC](Inline.ObjectiveC.psx.ps1)|Objective C PipeScript Transpiler. |```\.(?>m\\|mm)$``` |
2931
|[OpenSCAD](Inline.OpenSCAD.psx.ps1) |OpenSCAD Inline PipeScript Transpiler. |```\.scad$``` |

docs/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.1.7:
2+
* Added LATEX / TEX support (Fixes #230)
3+
* Adding LUA support (Fixes #246)
4+
* Fixing Core Transpiler Attribute Behavior (Fixes #247)
5+
---
6+
17
## 0.1.6:
28
* Added 'all' keyword (iterate over everything) (Fixes #244).
39
* Added Natural Language Processing to CommandAST (Fixes #242)

0 commit comments

Comments
 (0)