Skip to content

Commit 23f4533

Browse files
StartAutomatingStartAutomating
authored andcommitted
Merge pull request #78 from StartAutomating/MorePipeScripting
More pipe scripting
1 parent 7fba862 commit 23f4533

File tree

1 file changed

+50
-3
lines changed

1 file changed

+50
-3
lines changed

Transpilers/Syntax/README.md

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,59 @@
11
This directory and it's subdirectories contain syntax changes that enable common programming scenarios in PowerShell and PipeScript.
22

33

4-
|DisplayName |Synopsis |
5-
|------------------------------------|-----------------------------------------------------|
6-
|[RegexLiteral](RegexLiteral.psx.ps1)|[Regex Literal Transpiler<br/>](RegexLiteral.psx.ps1)|
4+
|DisplayName |Synopsis |
5+
|------------------------------------|------------------------------------------------|
6+
|[RegexLiteral](RegexLiteral.psx.ps1)|[Regex Literal Transpiler](RegexLiteral.psx.ps1)|
77

88

99

1010

11+
## RegexLiteral Example 1
1112

1213

14+
~~~PowerShell
15+
{
16+
'/[a|b]/'
17+
} | .>PipeScript
18+
~~~
19+
20+
## RegexLiteral Example 2
21+
22+
23+
~~~PowerShell
24+
{
25+
"/[$a|$b]/"
26+
} | .>PipeScript
27+
~~~
28+
29+
## RegexLiteral Example 3
30+
31+
32+
~~~PowerShell
33+
{@'
34+
/
35+
# Heredocs Regex literals will have IgnorePatternWhitespace by default, which allows comments
36+
^ # Match the string start
37+
(?<indent>\s{0,1})
38+
/
39+
'@
40+
} | .>PipeScript
41+
~~~
42+
43+
## RegexLiteral Example 4
44+
45+
46+
~~~PowerShell
47+
{
48+
$Keywords = "looking", "for", "these", "words"
49+
@"
50+
/
51+
# Double quoted heredocs can still contain variables
52+
[\s\p{P}]{0,1} # Whitespace or punctuation
53+
$($Keywords -join '|') # followed by keywords
54+
[\s\p{P}]{0,1} # followed by whitespace or punctuation
55+
/
56+
"@
57+
} | .>PipeScript
58+
~~~
59+

0 commit comments

Comments
 (0)