-
-
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 TCL Template to Language Function (Fixes #627)
- Loading branch information
James Brundage
committed
Nov 12, 2023
1 parent
1b8532b
commit 7f78381
Showing
2 changed files
with
57 additions
and
99 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,57 @@ | ||
Language function TCL { | ||
<# | ||
.SYNOPSIS | ||
TCL/TK Template Transpiler. | ||
.DESCRIPTION | ||
Allows PipeScript to generate TCL or TK. | ||
Because TCL Scripts only allow single-line comments, this is done using a pair of comment markers. | ||
# { or # PipeScript{ begins a PipeScript block | ||
# } or # }PipeScript ends a PipeScript block | ||
~~~tcl | ||
# { | ||
Uncommented lines between these two points will be ignored | ||
# # Commented lines will become PipeScript / PowerShell. | ||
# param($message = "hello world") | ||
# "puts `"$message`"" | ||
# } | ||
~~~ | ||
.EXAMPLE | ||
Invoke-PipeScript { | ||
$tclScript = ' | ||
# { | ||
Uncommented lines between these two points will be ignored | ||
# # Commented lines will become PipeScript / PowerShell. | ||
# param($message = "hello world") | ||
# "puts `"$message`"" | ||
# } | ||
' | ||
[OutputFile('.\HelloWorld.ps1.tcl')]$tclScript | ||
} | ||
Invoke-PipeScript .\HelloWorld.ps1.tcl | ||
#> | ||
[ValidatePattern('\.t(?>cl|k)$')] | ||
param() | ||
|
||
# We start off by declaring a number of regular expressions: | ||
$startComment = '(?>\#\s{0,}(?:PipeScript)?\s{0,}\{)' | ||
$endComment = '(?>\#\s{0,}\}\s{0,}(?:PipeScript)?\s{0,})' | ||
$startPattern = "(?<PSStart>${startComment})" | ||
$endPattern = "(?<PSEnd>${endComment})" | ||
|
||
# Create a splat containing arguments to the core inline transpiler | ||
# Using -LinePattern will skip any inline code not starting with # | ||
$LinePattern = "^\s{0,}\#\s{0,}" | ||
} | ||
|
This file was deleted.
Oops, something went wrong.