Skip to content

Commit

Permalink
feat: Porting PHP Template to Language Function (Fixes #614)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Nov 11, 2023
1 parent d6042e6 commit 5e319ff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 66 deletions.
22 changes: 22 additions & 0 deletions Commands/Languages/PHP/PHP-Language.ps.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Language function PHP {
<#
.SYNOPSIS
PHP Template Transpiler.
.DESCRIPTION
Allows PipeScript to generate PHP.
Multiline comments blocks like this ```<!--{}-->``` will be treated as blocks of PipeScript.
JavaScript/CSS/PHP comment blocks like ```/*{}*/``` will also be treated as blocks of PipeScript.
#>
[ValidatePattern('\.php$')]
param()
# We start off by declaring a number of regular expressions:
$startComment = '(?><\!--|/\*)' # * Start Comments ```<!--```
$endComment = '(?>-->|\*/)' # * End Comments ```-->```
$Whitespace = '[\s\n\r]{0,}'
# * StartPattern ```$StartComment + '{' + $Whitespace```
$startPattern = "(?<PSStart>${startComment}\{$Whitespace)"
# * EndPattern ```$whitespace + '}' + $EndComment```
$endPattern = "(?<PSEnd>$Whitespace\}${endComment}\s{0,})"
}
66 changes: 0 additions & 66 deletions Transpilers/Templates/PHP.Template.psx.ps1

This file was deleted.

0 comments on commit 5e319ff

Please sign in to comment.