summaryrefslogtreecommitdiff
path: root/test/prism/fixtures/patterns.txt
blob: 7ce3b9e4a8ee3118888e49b8a0cb3accbd6bd3e6 (plain)
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
foo => bar
foo => 1
foo => 1.0
foo => 1i
foo => 1r
foo => :foo
foo => %s[foo]
foo => :"foo"
foo => /foo/
foo => `foo`
foo => %x[foo]
foo => %i[foo]
foo => %I[foo]
foo => %w[foo]
foo => %W[foo]
foo => %q[foo]
foo => %Q[foo]
foo => "foo"
foo => nil
foo => self
foo => true
foo => false
foo => __FILE__
foo => __LINE__
foo => __ENCODING__
foo => -> { bar }

foo => 1 .. 1
foo => 1.0 .. 1.0
foo => 1i .. 1i
foo => 1r .. 1r
foo => :foo .. :foo
foo => %s[foo] .. %s[foo]
foo => :"foo" .. :"foo"
foo => /foo/ .. /foo/
foo => `foo` .. `foo`
foo => %x[foo] .. %x[foo]
foo => %i[foo] .. %i[foo]
foo => %I[foo] .. %I[foo]
foo => %w[foo] .. %w[foo]
foo => %W[foo] .. %W[foo]
foo => %q[foo] .. %q[foo]
foo => %Q[foo] .. %Q[foo]
foo => "foo" .. "foo"
foo => nil .. nil
foo => self .. self
foo => true .. true
foo => false .. false
foo => __FILE__ .. __FILE__
foo => __LINE__ .. __LINE__
foo => __ENCODING__ .. __ENCODING__
foo => -> { bar } .. -> { bar }

bar = 1; foo => ^bar
foo => ^@bar
foo => ^@@bar
foo => ^$bar

foo => ^(1)
foo => ^(nil)
foo => ^("bar" + "baz")

foo => Foo
foo => Foo::Bar::Baz
foo => ::Foo
foo => ::Foo::Bar::Baz

foo => Foo()
foo => Foo(1)
foo => Foo(1, 2, 3)
foo => Foo(bar)
foo => Foo(*bar, baz)
foo => Foo(bar, *baz)
foo => Foo(*bar, baz, *qux)

foo => Foo[]
foo => Foo[1]
foo => Foo[1, 2, 3]
foo => Foo[Foo[]]
foo => Foo[bar]
foo => Foo[*bar, baz]
foo => Foo[bar, *baz]
foo => Foo[*bar, baz, *qux]

foo => *bar
foo => *bar, baz, qux
foo => bar, *baz, qux
foo => bar, baz, *qux
foo => *bar, baz, *qux

foo => bar,

; # end the previous pattern for ParseTest#test_filepath_patterns.txt which parses the whole file at once

foo => []
foo => [[[[[]]]]]

foo => [*bar]
foo => [*bar, baz, qux]
foo => [bar, *baz, qux]
foo => [bar, baz, *qux]
foo => [*bar, baz, *qux]

foo in bar
foo in 1
foo in 1.0
foo in 1i
foo in 1r
foo in :foo
foo in %s[foo]
foo in :"foo"
foo in /foo/
foo in `foo`
foo in %x[foo]
foo in %i[foo]
foo in %I[foo]
foo in %w[foo]
foo in %W[foo]
foo in %q[foo]
foo in %Q[foo]
foo in "foo"
foo in nil
foo in self
foo in true
foo in false
foo in __FILE__
foo in __LINE__
foo in __ENCODING__
foo in -> { bar }

foo in bar,

; # end the previous pattern for ParseTest#test_filepath_patterns.txt which parses the whole file at once

case foo; in bar then end
case foo; in 1 then end
case foo; in 1.0 then end
case foo; in 1i then end
case foo; in 1r then end
case foo; in :foo then end
case foo; in %s[foo] then end
case foo; in :"foo" then end
case foo; in /foo/ then end
case foo; in `foo` then end
case foo; in %x[foo] then end
case foo; in %i[foo] then end
case foo; in %I[foo] then end
case foo; in %w[foo] then end
case foo; in %W[foo] then end
case foo; in %q[foo] then end
case foo; in %Q[foo] then end
case foo; in "foo" then end
case foo; in nil then end
case foo; in self then end
case foo; in true then end
case foo; in false then end
case foo; in __FILE__ then end
case foo; in __LINE__ then end
case foo; in __ENCODING__ then end
case foo; in -> { bar } then end

case foo; in bar if baz then end
case foo; in 1 if baz then end
case foo; in 1.0 if baz then end
case foo; in 1i if baz then end
case foo; in 1r if baz then end
case foo; in :foo if baz then end
case foo; in %s[foo] if baz then end
case foo; in :"foo" if baz then end
case foo; in /foo/ if baz then end
case foo; in `foo` if baz then end
case foo; in %x[foo] if baz then end
case foo; in %i[foo] if baz then end
case foo; in %I[foo] if baz then end
case foo; in %w[foo] if baz then end
case foo; in %W[foo] if baz then end
case foo; in %q[foo] if baz then end
case foo; in %Q[foo] if baz then end
case foo; in "foo" if baz then end
case foo; in nil if baz then end
case foo; in self if baz then end
case foo; in true if baz then end
case foo; in false if baz then end
case foo; in __FILE__ if baz then end
case foo; in __LINE__ if baz then end
case foo; in __ENCODING__ if baz then end
case foo; in -> { bar } if baz then end

if a in []
end

a => [
  b
]

foo in A[
  bar: B[
    value: a
  ]
]

foo in bar => baz
foo => bar => baz

foo, bar, baz = 1, 2
foo do
  [1, 2] => [foo, bar] => baz
end

foo => Object[{x:}]

1.then { 1 in ^_1 }

(
  a,
  b
) = c