-
-
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.
feat: Porting Perl Template to Language Function (Fixes #613)
- Loading branch information
James Brundage
committed
Nov 11, 2023
1 parent
d0efcc8
commit 872c5e4
Showing
2 changed files
with
47 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Language function Perl { | ||
<# | ||
.SYNOPSIS | ||
Perl Template Transpiler. | ||
.DESCRIPTION | ||
Allows PipeScript to generate Perl. | ||
Also Transpiles Plain Old Document | ||
PipeScript can be embedded in a Plain Old Document block that starts with ```=begin PipeScript``` and ends with ```=end PipeScript```. | ||
.EXAMPLE | ||
.> { | ||
$HelloWorldPerl = @' | ||
=begin PipeScript | ||
$msg = "hello", "hi", "hey", "howdy" | Get-Random | ||
"print(" + '"' + $msg + '");' | ||
=end PipeScript | ||
'@ | ||
[Save(".\HelloWorld.ps1.pl")]$HelloWorldPerl | ||
} | ||
.> .\HelloWorld.ps1.pl | ||
#> | ||
[ValidatePattern('\.(?>pl|pod)$')] | ||
param() | ||
|
||
# We start off by declaring a number of regular expressions: | ||
|
||
$startComment = '(?> | ||
(?>^|\[\r\n]{1,2})\s{0,} | ||
=begin | ||
\s{1,} | ||
(?>Pipescript|\{) | ||
[\s\r\n\{]{0,} | ||
)' | ||
$endComment = '(?> | ||
[\r\n]{1,3} | ||
\s{0,} | ||
=end | ||
(?>\}|\s{1,}PipeScript[\s\r\n\}]{0,}) | ||
)' | ||
|
||
$startPattern = "(?<PSStart>${startComment})" | ||
$endPattern = "(?<PSEnd>${endComment})" | ||
|
||
} |
This file was deleted.
Oops, something went wrong.