Skip to content

Commit

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

99 changes: 0 additions & 99 deletions Transpilers/Templates/TCL.Template.psx.ps1

This file was deleted.

0 comments on commit 7f78381

Please sign in to comment.