-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathsyntax_test_Class.ps1
124 lines (118 loc) · 5.96 KB
/
syntax_test_Class.ps1
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
# SYNTAX TEST "source.powershell"
using namespace system.management.automation
# <- keyword.control.using.powershell
# ^ keyword.other.powershell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.parameter.powershell
# Define a class
class TypeName
# <- storage.type.powershell
# ^ entity.name.function
{
# Property with validate set
# <- punctuation.definition.comment.powershell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.powershell
[ValidateSet("val1", "Val2")]
# <- meta.attribute.powershell punctuation.section.bracket.begin.powershell
# ^ meta.attribute.powershell support.function.attribute.powershell
# ^ meta.attribute.powershell punctuation.section.group.begin.powershell
# ^^^^^^ meta.attribute.powershell string.quoted.double.powershell
# ^ meta.attribute.powershell keyword.operator.other.powershell
# ^^^^^^ meta.attribute.powershell string.quoted.double.powershell
# ^ meta.attribute.powershell punctuation.section.group.end.powershell
# ^ meta.attribute.powershell punctuation.section.bracket.end.powershell
[string] $P1
# <- punctuation.section.bracket.begin.powershell
# ^ storage.type.powershell
# ^ punctuation.section.bracket.end.powershell
# ^ punctuation.definition.variable.powershell
# ^^ variable.other.readwrite.powershell
# Static property
# <- punctuation.definition.comment.powershell
# ^^^^^^^^^^^^^^^ comment.line.powershell
static [hashtable] $P2
# <- storage.modifier.powershell
# ^ punctuation.section.bracket.begin.powershell
# ^ storage.type.powershell
# ^ punctuation.section.bracket.end.powershell
# ^ punctuation.definition.variable.powershell
# ^^ variable.other.readwrite.powershell
# Hidden property does not show as result of Get-Member
# <- punctuation.definition.comment.powershell
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.powershell
hidden [int] $P3
# <- storage.modifier.powershell
# ^ punctuation.section.bracket.begin.powershell
# ^ storage.type.powershell
# ^ punctuation.section.bracket.end.powershell
# ^ punctuation.definition.variable.powershell
# ^^ variable.other.readwrite.powershell
# Constructor
# <- punctuation.definition.comment.powershell
# ^^^^^^^^^^^ comment.line.powershell
TypeName ([string] $s) {
# ^ punctuation.section.group.begin.powershell
# ^ punctuation.section.bracket.begin.powershell
# ^^^^^^ storage.type.powershell
# ^ punctuation.section.bracket.end.powershell
# ^ punctuation.definition.variable.powershell
# ^ variable.other.readwrite.powershell
# ^ punctuation.section.group.end.powershell
$this.P1 = $s
# <- punctuation.definition.variable.powershell
# ^ support.variable.automatic.powershell
# ^^ variable.other.member.powershell
# ^ keyword.operator.assignment.powershell
# ^ punctuation.definition.variable.powershell
# ^ variable.other.readwrite.powershell
}
# Static method
# <- punctuation.definition.comment.powershell
# ^^^^^^^^^^^^^ comment.line.powershell
static [void] MemberMethod1([hashtable] $h) {
# <- storage.modifier.powershell
# ^ punctuation.section.bracket.begin.powershell
# ^^^^ storage.type.powershell
# ^ punctuation.section.bracket.end.powershell
# ^ punctuation.section.group.begin.powershell
# ^ punctuation.section.bracket.begin.powershell
# ^^^^^^^^^ storage.type.powershell
# ^ punctuation.section.bracket.end.powershell
# ^ punctuation.definition.variable.powershell
# ^ variable.other.readwrite.powershell
# ^ punctuation.section.group.end.powershell
[TypeName]::P2 = $h
# <- punctuation.section.bracket.begin.powershell
# ^ storage.type.powershell
# ^ punctuation.section.bracket.end.powershell
# ^ keyword.operator.assignment.powershell
# ^ punctuation.definition.variable.powershell
# ^ variable.other.readwrite.powershell
}
# Instance method
# <- punctuation.definition.comment.powershell
# ^^^^^^^^^^^^^^^ comment.line.powershell
[int] MemberMethod2([int] $i) {
# <- punctuation.section.bracket.begin.powershell
# ^ storage.type.powershell
# ^ punctuation.section.bracket.end.powershell
# ^ punctuation.section.group.begin.powershell
# ^ punctuation.section.bracket.begin.powershell
# ^^^ storage.type.powershell
# ^ punctuation.section.bracket.end.powershell
# ^ punctuation.definition.variable.powershell
# ^ variable.other.readwrite.powershell
# ^ punctuation.section.group.end.powershell
$this.P3 = $i
# <- punctuation.definition.variable.powershell
# ^ support.variable.automatic.powershell
# ^^ variable.other.member.powershell
# ^ keyword.operator.assignment.powershell
# ^ punctuation.definition.variable.powershell
# ^ variable.other.readwrite.powershell
return $this.P3
# <- keyword.control.powershell
# ^ punctuation.definition.variable.powershell
# ^^^^ support.variable.automatic.powershell
# ^^ variable.other.member.powershell
}
}