-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathsyntax_test_Workflow.ps1
More file actions
187 lines (169 loc) · 9.37 KB
/
Copy pathsyntax_test_Workflow.ps1
File metadata and controls
187 lines (169 loc) · 9.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# SYNTAX TEST "Packages/PowerShell/PowerShell.sublime-syntax"
"<- Exit the imports context block"
workflow w1 {}
#^^^^^^^^^^^^^^^^^ meta.function.powershell
# ^^^^^^^^ keyword.declaration.function.powershell
# ^^ entity.name.function.powershell
# @@ definition
# ^ punctuation.section.block.begin.powershell
# ^ punctuation.section.block.end.powershell
Workflow work { sequence {} }
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
# ^^^^^^^^ keyword.declaration.function.powershell
# ^^^^ entity.name.function.powershell
# @@@@ definition
# ^ punctuation.section.block.begin.powershell
# ^^^^^^^^^^^ meta.block.powershell
# ^^^^^^^^ keyword.control.flow.powershell
# ^ punctuation.section.block.begin.powershell
# ^ punctuation.section.block.end.powershell
# ^ punctuation.section.block.end.powershell
workflow Test-Workflow {
#^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
# ^^^^^^^^ keyword.declaration.function.powershell
# ^^^^^^^^^^^^^ entity.name.function.powershell
# @@@@@@@@@@@@@ definition
# ^ punctuation.section.block.begin.powershell
parallel {
#^^^^^^^^^^^^^^^^^ meta.function.powershell
# ^^^^^^^^ keyword.control.flow.powershell
# ^ punctuation.section.block.begin.powershell
Get-Process
# @@@@@@@@@@@ reference
Get-Service
#^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
# ^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
# @@@@@@@@@@@ reference
}
}
workflow Test-Workflow {
# @@@@@@@@@@@@@ definition
$a = 3
#^^^^^^^^^^^^^ meta.function.powershell
# ^^ variable.other.readwrite.powershell
# ^ punctuation.definition.variable.powershell
# ^ keyword.operator.assignment.powershell
# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
## Without $Using, the $a workflow variable isn't visible
## in inline script.
inlinescript {"Inline A0 = $a"}
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
# ^^^^^^^^^^^^ keyword.control.context.powershell
# ^ punctuation.section.block.begin.powershell
# ^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell
# ^^^^^^^^^^^^^ string.quoted.double.powershell
# ^ punctuation.definition.string.begin.powershell
# ^^ meta.interpolation.powershell variable.other.readwrite.powershell
# ^ punctuation.definition.variable.powershell
# ^ string.quoted.double.powershell punctuation.definition.string.end.powershell
# ^ punctuation.section.block.end.powershell
## $Using imports the variable and its current value.
inlinescript {"Inline A1 = $Using:a"}
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.powershell
# ^^^^^^^^^^^^ keyword.control.context.powershell
# ^ punctuation.section.block.begin.powershell
# ^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell
# ^^^^^^^^^^^^^ string.quoted.double.powershell
# ^ punctuation.definition.string.begin.powershell
# ^^^^^^^^ meta.interpolation.powershell variable.other.readwrite.powershell
# ^ punctuation.definition.variable.powershell
# ^^^^^ storage.modifier.scope.powershell
# ^ punctuation.accessor.colon.powershell
# ^ string.quoted.double.powershell punctuation.definition.string.end.powershell
# ^ punctuation.section.block.end.powershell
}
Test-Workflow
# @@@@@@@@@@@@@ reference
workflow Test-Workflow {
# @@@@@@@@@@@@@ definition
$a = 3
## Changes to the inlinescript variable value don't
## change the workflow variable.
inlinescript {
$a = $Using:a+1;
"Inline A = $a"
}
"Workflow A = $a"
## To change the variable in workflow scope, return the
## new value.
$a = inlinescript {$b = $Using:a+1; $b}
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
# ^^ variable.other.readwrite.powershell
# ^ punctuation.definition.variable.powershell
# ^ keyword.operator.assignment.powershell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.powershell
# ^^^^^^^^^^^^ keyword.control.context.powershell
# ^ punctuation.section.block.begin.powershell
# ^^ variable.other.readwrite.powershell
# ^ punctuation.definition.variable.powershell
# ^ keyword.operator.assignment.powershell
# ^^^^^^^^ variable.other.readwrite.powershell
# ^ punctuation.definition.variable.powershell
# ^^^^^ storage.modifier.scope.powershell
# ^ punctuation.accessor.colon.powershell
# ^ keyword.operator.unary.powershell
# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
# ^ punctuation.terminator.statement.powershell
# ^^ variable.other.readwrite.powershell
# ^ punctuation.definition.variable.powershell
# ^ punctuation.section.block.end.powershell
"Workflow New A = $a"
}
Test-Workflow
# @@@@@@@@@@@@@ reference
workflow Test-Workflow {
# @@@@@@@@@@@@@ definition
$ie = inlinescript {
$ie = New-Object -ComObject InternetExplorer.Application -Property @{navigate2="www.microsoft.com"}
# @@@@@@@@@@ reference
$ie.Visible = $true
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
# ^^^ variable.other.readwrite.powershell
# ^ punctuation.definition.variable.powershell
# ^ punctuation.accessor.dot.powershell
# ^^^^^^^ variable.other.member.powershell
# ^ keyword.operator.assignment.powershell
# ^^^^^ constant.language.boolean.true.powershell
# ^ punctuation.definition.variable.powershell
}
$ie
}
Test-Workflow
# @@@@@@@@@@@@@ reference
workflow Test-Workflow {
# @@@@@@@@@@@@@ definition
parallel {
Get-Process
# @@@@@@@@@@@ reference
Get-Service
#^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
# ^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
# @@@@@@@@@@@ reference
sequence {
# ^ meta.function.powershell meta.block.powershell meta.block.powershell punctuation.section.block.begin.powershell
$Hotfix = Get-Content 'D:\HotFixes\Required.txt'
# @@@@@@@@@@@ reference
foreach ($h in $Hotfix) {D:\Scripts\Verify-Hotfix.ps1 -Hotfix $h}
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.powershell meta.block.powershell
# ^^^^^^^ keyword.control.loop.for.powershell
# ^^^^^^^^^^^^^^^ meta.group.powershell
# ^ punctuation.section.group.begin.powershell
# ^^ variable.other.readwrite.powershell
# ^ punctuation.definition.variable.powershell
# ^^ keyword.control.loop.in.powershell
# ^^^^^^^ variable.other.readwrite.powershell
# ^ punctuation.definition.variable.powershell
# ^ punctuation.section.group.end.powershell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.powershell
# ^ punctuation.section.braces.begin.powershell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@ reference
# ^^^^^^^ variable.parameter.option.powershell
# ^ punctuation.definition.parameter.powershell
# ^^ variable.other.readwrite.powershell
# ^ punctuation.definition.variable.powershell
# ^ punctuation.section.braces.end.powershell
}
}
}