Skip to content

Commit

Permalink
feat: Porting Scala Template to Language Function (Fixes #624)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Nov 12, 2023
1 parent 28f2a9f commit b7ab5c5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 75 deletions.
31 changes: 31 additions & 0 deletions Commands/Languages/Scala/Scala-Language.ps.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Language function Scala {
<#
.SYNOPSIS
Scala Template Transpiler.
.DESCRIPTION
Allows PipeScript to generate Scala.
Multiline comments with /*{}*/ will be treated as blocks of PipeScript.
Multiline comments can be preceeded or followed by 'empty' syntax, which will be ignored.
The Scala Template Transpiler will consider the following syntax to be empty:
* ```null```
* ```""```
* ```''```
#>
[ValidatePattern('\.(?>scala|sc)$')]
param()

# We start off by declaring a number of regular expressions:
$startComment = '/\*' # * Start Comments ```\*```
$endComment = '\*/' # * End Comments ```/*```
$Whitespace = '[\s\n\r]{0,}'
# * IgnoredContext ```String.empty```, ```null```, blank strings and characters
$IgnoredContext = "(?<ignore>(?>$("null", '""', "''" -join '|'))\s{0,}){0,1}"
# * StartPattern ```$IgnoredContext + $StartComment + '{' + $Whitespace```
$startPattern = "(?<PSStart>${IgnoredContext}${startComment}\{$Whitespace)"
# * EndPattern ```$whitespace + '}' + $EndComment + $ignoredContext```
$endPattern = "(?<PSEnd>$Whitespace\}${endComment}\s{0,}${IgnoredContext})"
}
75 changes: 0 additions & 75 deletions Transpilers/Templates/Scala.Template.psx.ps1

This file was deleted.

0 comments on commit b7ab5c5

Please sign in to comment.