machete 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +9 -0
- data/README.md +78 -9
- data/VERSION +1 -1
- data/lib/machete/matchers.rb +128 -2
- data/lib/machete/parser.rb +382 -119
- data/lib/machete/parser.y +127 -49
- data/spec/machete/matchers_spec.rb +356 -0
- data/spec/machete/parser_spec.rb +202 -111
- metadata +5 -5
data/spec/machete/parser_spec.rb
CHANGED
@@ -22,12 +22,16 @@ module Machete
|
|
22
22
|
@i42 = LiteralMatcher.new(42)
|
23
23
|
@i43 = LiteralMatcher.new(43)
|
24
24
|
@i44 = LiteralMatcher.new(44)
|
25
|
+
@i45 = LiteralMatcher.new(45)
|
25
26
|
|
26
27
|
@foo = NodeMatcher.new(:Foo)
|
27
28
|
@foo_a = NodeMatcher.new(:Foo, :a => @i42)
|
28
29
|
@foo_ab = NodeMatcher.new(:Foo, :a => @i42, :b => @i43)
|
29
30
|
|
31
|
+
@a4243 = ArrayMatcher.new([@i42, @i43])
|
32
|
+
|
30
33
|
@ch4243 = ChoiceMatcher.new([@i42, @i43])
|
34
|
+
@ch4445 = ChoiceMatcher.new([@i44, @i45])
|
31
35
|
@ch424344 = ChoiceMatcher.new([@i42, @i43, @i44])
|
32
36
|
end
|
33
37
|
|
@@ -35,6 +39,10 @@ module Machete
|
|
35
39
|
NodeMatcher.new(:Foo, { attr => @i42 })
|
36
40
|
end
|
37
41
|
|
42
|
+
def array_matcher_with_quantifier(min, max, step)
|
43
|
+
ArrayMatcher.new([Quantifier.new(@ch4243, min, max, step)])
|
44
|
+
end
|
45
|
+
|
38
46
|
# Canonical expression is "42 | 43".
|
39
47
|
it "parses expression" do
|
40
48
|
'42'.should be_parsed_as(@i42)
|
@@ -45,7 +53,9 @@ module Machete
|
|
45
53
|
# Canonical primary is "42".
|
46
54
|
it "parses primary" do
|
47
55
|
'Foo<a = 42>'.should be_parsed_as(@foo_a)
|
48
|
-
'42'.should be_parsed_as(@
|
56
|
+
'Foo<a = 42>'.should be_parsed_as(@foo_a)
|
57
|
+
'[42, 43]'.should be_parsed_as(@a4243)
|
58
|
+
'any'.should be_parsed_as(AnyMatcher.new)
|
49
59
|
end
|
50
60
|
|
51
61
|
# Canonical node is "Foo".
|
@@ -63,136 +73,86 @@ module Machete
|
|
63
73
|
# Canonical attr is "a = 42".
|
64
74
|
it "parses attr" do
|
65
75
|
'Foo<a = 42 | 43>'.should be_parsed_as(NodeMatcher.new(:Foo, :a => @ch4243))
|
76
|
+
'Foo<a ^= "abcd">'.should be_parsed_as(
|
77
|
+
NodeMatcher.new(:Foo, :a => StartsWithMatcher.new("abcd"))
|
78
|
+
)
|
79
|
+
'Foo<a $= "abcd">'.should be_parsed_as(
|
80
|
+
NodeMatcher.new(:Foo, :a => EndsWithMatcher.new("abcd"))
|
81
|
+
)
|
66
82
|
end
|
67
83
|
|
68
84
|
# Canonical method_name is "a".
|
69
85
|
it "parses method_name" do
|
70
86
|
'Foo<a = 42>'.should be_parsed_as(node_matcher_with_attr(:a))
|
87
|
+
'Foo<any = 42>'.should be_parsed_as(node_matcher_with_attr(:any))
|
88
|
+
'Foo<even = 42>'.should be_parsed_as(node_matcher_with_attr(:even))
|
89
|
+
'Foo<odd = 42>'.should be_parsed_as(node_matcher_with_attr(:odd))
|
90
|
+
'Foo<* = 42>'.should be_parsed_as(node_matcher_with_attr(:*))
|
91
|
+
'Foo<+ = 42>'.should be_parsed_as(node_matcher_with_attr(:+))
|
71
92
|
'Foo< < = 42>'.should be_parsed_as(node_matcher_with_attr(:<))
|
72
93
|
'Foo<> = 42>'.should be_parsed_as(node_matcher_with_attr(:>))
|
94
|
+
'Foo<^ = 42>'.should be_parsed_as(node_matcher_with_attr(:^))
|
73
95
|
'Foo<| = 42>'.should be_parsed_as(node_matcher_with_attr(:|))
|
74
96
|
end
|
75
97
|
|
76
|
-
# Canonical
|
77
|
-
it "parses
|
78
|
-
'
|
79
|
-
'42'.should be_parsed_as(@i42)
|
80
|
-
'"abcd"'.should be_parsed_as(LiteralMatcher.new("abcd"))
|
98
|
+
# Canonical array is "[42, 43]".
|
99
|
+
it "parses array" do
|
100
|
+
'[42, 43]'.should be_parsed_as(@a4243)
|
81
101
|
end
|
82
102
|
|
83
|
-
# Canonical
|
84
|
-
it "parses
|
85
|
-
|
86
|
-
'
|
87
|
-
|
88
|
-
'Foo<_ = 42>'.should be_parsed_as(node_matcher_with_attr(:_))
|
89
|
-
'Foo<aa = 42>'.should be_parsed_as(node_matcher_with_attr(:aa))
|
90
|
-
'Foo<az = 42>'.should be_parsed_as(node_matcher_with_attr(:az))
|
91
|
-
'Foo<aA = 42>'.should be_parsed_as(node_matcher_with_attr(:aA))
|
92
|
-
'Foo<aZ = 42>'.should be_parsed_as(node_matcher_with_attr(:aZ))
|
93
|
-
'Foo<a0 = 42>'.should be_parsed_as(node_matcher_with_attr(:a0))
|
94
|
-
'Foo<a9 = 42>'.should be_parsed_as(node_matcher_with_attr(:a9))
|
95
|
-
'Foo<a_ = 42>'.should be_parsed_as(node_matcher_with_attr(:a_))
|
96
|
-
'Foo<abcd = 42>'.should be_parsed_as(node_matcher_with_attr(:abcd))
|
97
|
-
'Foo<a? = 42>'.should be_parsed_as(node_matcher_with_attr(:a?))
|
98
|
-
'Foo<a! = 42>'.should be_parsed_as(node_matcher_with_attr(:a!))
|
99
|
-
'Foo<a= = 42>'.should be_parsed_as(node_matcher_with_attr(:a=))
|
103
|
+
# Canonical items_opt is "42, 43".
|
104
|
+
it "parses items" do
|
105
|
+
'[ ]'.should be_parsed_as(ArrayMatcher.new([]))
|
106
|
+
'[42, 43]'.should be_parsed_as(@a4243)
|
107
|
+
end
|
100
108
|
|
101
|
-
|
102
|
-
|
103
|
-
'
|
104
|
-
|
105
|
-
|
106
|
-
'
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
'Foo</ = 42>'.should be_parsed_as(node_matcher_with_attr(:/))
|
111
|
-
'Foo< << = 42>'.should be_parsed_as(node_matcher_with_attr(:<<))
|
112
|
-
'Foo< <= = 42>'.should be_parsed_as(node_matcher_with_attr(:<=))
|
113
|
-
'Foo< <=> = 42>'.should be_parsed_as(node_matcher_with_attr(:<=>))
|
114
|
-
'Foo< == = 42>'.should be_parsed_as(node_matcher_with_attr(:==))
|
115
|
-
'Foo< === = 42>'.should be_parsed_as(node_matcher_with_attr(:===))
|
116
|
-
'Foo< =~ = 42>'.should be_parsed_as(node_matcher_with_attr(:=~))
|
117
|
-
'Foo<>= = 42>'.should be_parsed_as(node_matcher_with_attr(:>=))
|
118
|
-
'Foo<>> = 42>'.should be_parsed_as(node_matcher_with_attr(:>>))
|
119
|
-
'Foo<[] = 42>'.should be_parsed_as(node_matcher_with_attr(:[]))
|
120
|
-
'Foo<[]= = 42>'.should be_parsed_as(node_matcher_with_attr(:[]=))
|
121
|
-
'Foo<^ = 42>'.should be_parsed_as(node_matcher_with_attr(:^))
|
122
|
-
'Foo<` = 42>'.should be_parsed_as(node_matcher_with_attr(:`))
|
123
|
-
'Foo<~ = 42>'.should be_parsed_as(node_matcher_with_attr(:~))
|
109
|
+
# Canonical items is "42, 43".
|
110
|
+
it "parses items" do
|
111
|
+
'[42*]'.should be_parsed_as(
|
112
|
+
ArrayMatcher.new([Quantifier.new(@i42, 0, nil, 1)])
|
113
|
+
)
|
114
|
+
'[42*, 43*]'.should be_parsed_as(ArrayMatcher.new([
|
115
|
+
Quantifier.new(@i42, 0, nil, 1),
|
116
|
+
Quantifier.new(@i43, 0, nil, 1)
|
117
|
+
]))
|
124
118
|
end
|
125
119
|
|
126
|
-
# Canonical
|
127
|
-
it "parses
|
128
|
-
'
|
129
|
-
'
|
130
|
-
|
131
|
-
|
132
|
-
'AA'.should be_parsed_as(NodeMatcher.new(:AA))
|
133
|
-
'AZ'.should be_parsed_as(NodeMatcher.new(:AZ))
|
134
|
-
'A0'.should be_parsed_as(NodeMatcher.new(:A0))
|
135
|
-
'A9'.should be_parsed_as(NodeMatcher.new(:A9))
|
136
|
-
'A_'.should be_parsed_as(NodeMatcher.new(:A_))
|
137
|
-
'Abcd'.should be_parsed_as(NodeMatcher.new(:Abcd))
|
120
|
+
# Canonical item is "42*".
|
121
|
+
it "parses item" do
|
122
|
+
'[42 | 43]'.should be_parsed_as(ArrayMatcher.new([@ch4243]))
|
123
|
+
'[42*]'.should be_parsed_as(
|
124
|
+
ArrayMatcher.new([Quantifier.new(@i42, 0, nil, 1)])
|
125
|
+
)
|
138
126
|
end
|
139
127
|
|
140
|
-
# Canonical
|
141
|
-
it "parses
|
142
|
-
|
143
|
-
'
|
144
|
-
'
|
145
|
-
'
|
146
|
-
|
147
|
-
|
148
|
-
'
|
149
|
-
|
150
|
-
|
151
|
-
'
|
152
|
-
|
128
|
+
# Canonical quantifier is "42*".
|
129
|
+
it "parses quantifier" do
|
130
|
+
'[42 | 43*]'.should be_parsed_as(array_matcher_with_quantifier(0, nil, 1))
|
131
|
+
'[42 | 43+]'.should be_parsed_as(array_matcher_with_quantifier(1, nil, 1))
|
132
|
+
'[42 | 43?]'.should be_parsed_as(array_matcher_with_quantifier(0, 1, 1))
|
133
|
+
'[42 | 43{44}]'.should be_parsed_as(
|
134
|
+
array_matcher_with_quantifier(44, 44, 1)
|
135
|
+
)
|
136
|
+
'[42 | 43{44,}]'.should be_parsed_as(
|
137
|
+
array_matcher_with_quantifier(44, nil, 1)
|
138
|
+
)
|
139
|
+
'[42 | 43{,44}]'.should be_parsed_as(
|
140
|
+
array_matcher_with_quantifier(0, 44, 1))
|
141
|
+
'[42 | 43{44,45}]'.should be_parsed_as(
|
142
|
+
array_matcher_with_quantifier(44, 45, 1)
|
143
|
+
)
|
144
|
+
end
|
153
145
|
|
154
|
-
|
146
|
+
# Canonical literal is "42".
|
147
|
+
it "parses literal" do
|
155
148
|
':a'.should be_parsed_as(LiteralMatcher.new(:a))
|
156
|
-
'
|
157
|
-
'
|
158
|
-
|
159
|
-
':az'.should be_parsed_as(LiteralMatcher.new(:az))
|
160
|
-
':aA'.should be_parsed_as(LiteralMatcher.new(:aA))
|
161
|
-
':aZ'.should be_parsed_as(LiteralMatcher.new(:aZ))
|
162
|
-
':a0'.should be_parsed_as(LiteralMatcher.new(:a0))
|
163
|
-
':a9'.should be_parsed_as(LiteralMatcher.new(:a9))
|
164
|
-
':a_'.should be_parsed_as(LiteralMatcher.new(:a_))
|
165
|
-
':abcd'.should be_parsed_as(LiteralMatcher.new(:abcd))
|
166
|
-
':a?'.should be_parsed_as(LiteralMatcher.new(:a?))
|
167
|
-
':a!'.should be_parsed_as(LiteralMatcher.new(:a!))
|
168
|
-
':a='.should be_parsed_as(LiteralMatcher.new(:a=))
|
149
|
+
'42'.should be_parsed_as(@i42)
|
150
|
+
'"abcd"'.should be_parsed_as(LiteralMatcher.new("abcd"))
|
151
|
+
end
|
169
152
|
|
170
|
-
|
171
|
-
|
172
|
-
'
|
173
|
-
':*'.should be_parsed_as(LiteralMatcher.new(:*))
|
174
|
-
':**'.should be_parsed_as(LiteralMatcher.new(:**))
|
175
|
-
':+'.should be_parsed_as(LiteralMatcher.new(:+))
|
176
|
-
':+@'.should be_parsed_as(LiteralMatcher.new(:+@))
|
177
|
-
':-'.should be_parsed_as(LiteralMatcher.new(:-))
|
178
|
-
':-@'.should be_parsed_as(LiteralMatcher.new(:-@))
|
179
|
-
':/'.should be_parsed_as(LiteralMatcher.new(:/))
|
180
|
-
':<'.should be_parsed_as(LiteralMatcher.new(:<))
|
181
|
-
':<<'.should be_parsed_as(LiteralMatcher.new(:<<))
|
182
|
-
':<='.should be_parsed_as(LiteralMatcher.new(:<=))
|
183
|
-
':<=>'.should be_parsed_as(LiteralMatcher.new(:<=>))
|
184
|
-
':=='.should be_parsed_as(LiteralMatcher.new(:==))
|
185
|
-
':==='.should be_parsed_as(LiteralMatcher.new(:===))
|
186
|
-
':=~'.should be_parsed_as(LiteralMatcher.new(:=~))
|
187
|
-
':>'.should be_parsed_as(LiteralMatcher.new(:>))
|
188
|
-
':>='.should be_parsed_as(LiteralMatcher.new(:>=))
|
189
|
-
':>>'.should be_parsed_as(LiteralMatcher.new(:>>))
|
190
|
-
':[]'.should be_parsed_as(LiteralMatcher.new(:[]))
|
191
|
-
':[]='.should be_parsed_as(LiteralMatcher.new(:[]=))
|
192
|
-
':^'.should be_parsed_as(LiteralMatcher.new(:^))
|
193
|
-
':`'.should be_parsed_as(LiteralMatcher.new(:`))
|
194
|
-
':|'.should be_parsed_as(LiteralMatcher.new(:|))
|
195
|
-
':~'.should be_parsed_as(LiteralMatcher.new(:~))
|
153
|
+
# Canonical any is "any".
|
154
|
+
it "parses any" do
|
155
|
+
'any'.should be_parsed_as(AnyMatcher.new)
|
196
156
|
end
|
197
157
|
|
198
158
|
# Canonical INTEGER is "42".
|
@@ -310,6 +270,137 @@ module Machete
|
|
310
270
|
'"abc"'.should be_parsed_as(LiteralMatcher.new("abc"))
|
311
271
|
end
|
312
272
|
|
273
|
+
# Canonical ANY is "any".
|
274
|
+
it "parses ANY" do
|
275
|
+
'any'.should be_parsed_as(AnyMatcher.new)
|
276
|
+
end
|
277
|
+
|
278
|
+
# Canonical EVEN is "even".
|
279
|
+
it "parses EVEN" do
|
280
|
+
'[42{even}]'.should be_parsed_as(
|
281
|
+
ArrayMatcher.new([Quantifier.new(@i42, 0, nil, 2)])
|
282
|
+
)
|
283
|
+
end
|
284
|
+
|
285
|
+
# Canonical ODD is "odd".
|
286
|
+
it "parses ODD" do
|
287
|
+
'[42{odd}]'.should be_parsed_as(
|
288
|
+
ArrayMatcher.new([Quantifier.new(@i42, 1, nil, 2)])
|
289
|
+
)
|
290
|
+
end
|
291
|
+
|
292
|
+
# Canonical METHOD_NAME is "a".
|
293
|
+
it "parses METHOD_NAME" do
|
294
|
+
# Regular names
|
295
|
+
'Foo<a = 42>'.should be_parsed_as(node_matcher_with_attr(:a))
|
296
|
+
'Foo<z = 42>'.should be_parsed_as(node_matcher_with_attr(:z))
|
297
|
+
'Foo<_ = 42>'.should be_parsed_as(node_matcher_with_attr(:_))
|
298
|
+
'Foo<aa = 42>'.should be_parsed_as(node_matcher_with_attr(:aa))
|
299
|
+
'Foo<az = 42>'.should be_parsed_as(node_matcher_with_attr(:az))
|
300
|
+
'Foo<aA = 42>'.should be_parsed_as(node_matcher_with_attr(:aA))
|
301
|
+
'Foo<aZ = 42>'.should be_parsed_as(node_matcher_with_attr(:aZ))
|
302
|
+
'Foo<a0 = 42>'.should be_parsed_as(node_matcher_with_attr(:a0))
|
303
|
+
'Foo<a9 = 42>'.should be_parsed_as(node_matcher_with_attr(:a9))
|
304
|
+
'Foo<a_ = 42>'.should be_parsed_as(node_matcher_with_attr(:a_))
|
305
|
+
'Foo<abcd = 42>'.should be_parsed_as(node_matcher_with_attr(:abcd))
|
306
|
+
'Foo<a? = 42>'.should be_parsed_as(node_matcher_with_attr(:a?))
|
307
|
+
'Foo<a! = 42>'.should be_parsed_as(node_matcher_with_attr(:a!))
|
308
|
+
'Foo<a= = 42>'.should be_parsed_as(node_matcher_with_attr(:a=))
|
309
|
+
|
310
|
+
# Operators (sorted alphabetically)
|
311
|
+
'Foo<% = 42>'.should be_parsed_as(node_matcher_with_attr(:%))
|
312
|
+
'Foo<& = 42>'.should be_parsed_as(node_matcher_with_attr(:&))
|
313
|
+
'Foo<** = 42>'.should be_parsed_as(node_matcher_with_attr(:**))
|
314
|
+
'Foo<+@ = 42>'.should be_parsed_as(node_matcher_with_attr(:+@))
|
315
|
+
'Foo<- = 42>'.should be_parsed_as(node_matcher_with_attr(:-))
|
316
|
+
'Foo<-@ = 42>'.should be_parsed_as(node_matcher_with_attr(:-@))
|
317
|
+
'Foo</ = 42>'.should be_parsed_as(node_matcher_with_attr(:/))
|
318
|
+
'Foo< << = 42>'.should be_parsed_as(node_matcher_with_attr(:<<))
|
319
|
+
'Foo< <= = 42>'.should be_parsed_as(node_matcher_with_attr(:<=))
|
320
|
+
'Foo< <=> = 42>'.should be_parsed_as(node_matcher_with_attr(:<=>))
|
321
|
+
'Foo< == = 42>'.should be_parsed_as(node_matcher_with_attr(:==))
|
322
|
+
'Foo< === = 42>'.should be_parsed_as(node_matcher_with_attr(:===))
|
323
|
+
'Foo< =~ = 42>'.should be_parsed_as(node_matcher_with_attr(:=~))
|
324
|
+
'Foo<>= = 42>'.should be_parsed_as(node_matcher_with_attr(:>=))
|
325
|
+
'Foo<>> = 42>'.should be_parsed_as(node_matcher_with_attr(:>>))
|
326
|
+
'Foo<[] = 42>'.should be_parsed_as(node_matcher_with_attr(:[]))
|
327
|
+
'Foo<[]= = 42>'.should be_parsed_as(node_matcher_with_attr(:[]=))
|
328
|
+
'Foo<` = 42>'.should be_parsed_as(node_matcher_with_attr(:`))
|
329
|
+
'Foo<~ = 42>'.should be_parsed_as(node_matcher_with_attr(:~))
|
330
|
+
end
|
331
|
+
|
332
|
+
# Canonical CLASS_NAME is "A".
|
333
|
+
it "parses CLASS_NAME" do
|
334
|
+
'A'.should be_parsed_as(NodeMatcher.new(:A))
|
335
|
+
'Z'.should be_parsed_as(NodeMatcher.new(:Z))
|
336
|
+
'Aa'.should be_parsed_as(NodeMatcher.new(:Aa))
|
337
|
+
'Az'.should be_parsed_as(NodeMatcher.new(:Az))
|
338
|
+
'AA'.should be_parsed_as(NodeMatcher.new(:AA))
|
339
|
+
'AZ'.should be_parsed_as(NodeMatcher.new(:AZ))
|
340
|
+
'A0'.should be_parsed_as(NodeMatcher.new(:A0))
|
341
|
+
'A9'.should be_parsed_as(NodeMatcher.new(:A9))
|
342
|
+
'A_'.should be_parsed_as(NodeMatcher.new(:A_))
|
343
|
+
'Abcd'.should be_parsed_as(NodeMatcher.new(:Abcd))
|
344
|
+
end
|
345
|
+
|
346
|
+
# Canonical SYMBOL is ":a".
|
347
|
+
it "parses SYMBOL" do
|
348
|
+
# Class names
|
349
|
+
':A'.should be_parsed_as(LiteralMatcher.new(:A))
|
350
|
+
':Z'.should be_parsed_as(LiteralMatcher.new(:Z))
|
351
|
+
':Aa'.should be_parsed_as(LiteralMatcher.new(:Aa))
|
352
|
+
':Az'.should be_parsed_as(LiteralMatcher.new(:Az))
|
353
|
+
':AA'.should be_parsed_as(LiteralMatcher.new(:AA))
|
354
|
+
':AZ'.should be_parsed_as(LiteralMatcher.new(:AZ))
|
355
|
+
':A0'.should be_parsed_as(LiteralMatcher.new(:A0))
|
356
|
+
':A9'.should be_parsed_as(LiteralMatcher.new(:A9))
|
357
|
+
':A_'.should be_parsed_as(LiteralMatcher.new(:A_))
|
358
|
+
':Abcd'.should be_parsed_as(LiteralMatcher.new(:Abcd))
|
359
|
+
|
360
|
+
# Regular method names
|
361
|
+
':a'.should be_parsed_as(LiteralMatcher.new(:a))
|
362
|
+
':z'.should be_parsed_as(LiteralMatcher.new(:z))
|
363
|
+
':_'.should be_parsed_as(LiteralMatcher.new(:_))
|
364
|
+
':aa'.should be_parsed_as(LiteralMatcher.new(:aa))
|
365
|
+
':az'.should be_parsed_as(LiteralMatcher.new(:az))
|
366
|
+
':aA'.should be_parsed_as(LiteralMatcher.new(:aA))
|
367
|
+
':aZ'.should be_parsed_as(LiteralMatcher.new(:aZ))
|
368
|
+
':a0'.should be_parsed_as(LiteralMatcher.new(:a0))
|
369
|
+
':a9'.should be_parsed_as(LiteralMatcher.new(:a9))
|
370
|
+
':a_'.should be_parsed_as(LiteralMatcher.new(:a_))
|
371
|
+
':abcd'.should be_parsed_as(LiteralMatcher.new(:abcd))
|
372
|
+
':a?'.should be_parsed_as(LiteralMatcher.new(:a?))
|
373
|
+
':a!'.should be_parsed_as(LiteralMatcher.new(:a!))
|
374
|
+
':a='.should be_parsed_as(LiteralMatcher.new(:a=))
|
375
|
+
|
376
|
+
# Operators (sorted alphabetically)
|
377
|
+
':%'.should be_parsed_as(LiteralMatcher.new(:%))
|
378
|
+
':&'.should be_parsed_as(LiteralMatcher.new(:&))
|
379
|
+
':*'.should be_parsed_as(LiteralMatcher.new(:*))
|
380
|
+
':**'.should be_parsed_as(LiteralMatcher.new(:**))
|
381
|
+
':+'.should be_parsed_as(LiteralMatcher.new(:+))
|
382
|
+
':+@'.should be_parsed_as(LiteralMatcher.new(:+@))
|
383
|
+
':-'.should be_parsed_as(LiteralMatcher.new(:-))
|
384
|
+
':-@'.should be_parsed_as(LiteralMatcher.new(:-@))
|
385
|
+
':/'.should be_parsed_as(LiteralMatcher.new(:/))
|
386
|
+
':<'.should be_parsed_as(LiteralMatcher.new(:<))
|
387
|
+
':<<'.should be_parsed_as(LiteralMatcher.new(:<<))
|
388
|
+
':<='.should be_parsed_as(LiteralMatcher.new(:<=))
|
389
|
+
':<=>'.should be_parsed_as(LiteralMatcher.new(:<=>))
|
390
|
+
':=='.should be_parsed_as(LiteralMatcher.new(:==))
|
391
|
+
':==='.should be_parsed_as(LiteralMatcher.new(:===))
|
392
|
+
':=~'.should be_parsed_as(LiteralMatcher.new(:=~))
|
393
|
+
':>'.should be_parsed_as(LiteralMatcher.new(:>))
|
394
|
+
':>='.should be_parsed_as(LiteralMatcher.new(:>=))
|
395
|
+
':>>'.should be_parsed_as(LiteralMatcher.new(:>>))
|
396
|
+
':[]'.should be_parsed_as(LiteralMatcher.new(:[]))
|
397
|
+
':[]='.should be_parsed_as(LiteralMatcher.new(:[]=))
|
398
|
+
':^'.should be_parsed_as(LiteralMatcher.new(:^))
|
399
|
+
':`'.should be_parsed_as(LiteralMatcher.new(:`))
|
400
|
+
':|'.should be_parsed_as(LiteralMatcher.new(:|))
|
401
|
+
':~'.should be_parsed_as(LiteralMatcher.new(:~))
|
402
|
+
end
|
403
|
+
|
313
404
|
it "skips whitespace before tokens" do
|
314
405
|
'42'.should be_parsed_as(@i42)
|
315
406
|
' 42'.should be_parsed_as(@i42)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: machete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Majda
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-09-27 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|