Skip to content

Commit

Permalink
feat: Porting Perl Template to Language Function (Fixes #613)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Nov 11, 2023
1 parent d0efcc8 commit 872c5e4
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 90 deletions.
47 changes: 47 additions & 0 deletions Commands/Languages/Perl/Perl-Language.ps.ps1
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})"

}
90 changes: 0 additions & 90 deletions Transpilers/Templates/Perl.Template.psx.ps1

This file was deleted.

0 comments on commit 872c5e4

Please sign in to comment.