sexp_processor 4.11.0 → 4.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -3
- data/History.rdoc +88 -0
- data/Manifest.txt +1 -0
- data/Rakefile +2 -0
- data/lib/pt_testcase.rb +22 -19
- data/lib/sexp.rb +32 -1061
- data/lib/sexp_matcher.rb +1100 -0
- data/lib/sexp_processor.rb +2 -2
- data/lib/strict_sexp.rb +26 -4
- data/test/test_sexp.rb +213 -134
- data/test/test_sexp_processor.rb +2 -2
- data.tar.gz.sig +1 -2
- metadata +32 -22
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07ef3f53aa7901804e1d92cba1d04eb0ad8631c26a021653e4855b15da3566fc
|
4
|
+
data.tar.gz: e35d6224928d2f29504fa1734dcb62c6f5c984511dffac7a0538c5b163b7f6a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 876af156dcbe63d56c35796dc12ae32a2447640f1fc45b47286b6197dafb733512913028c127d45517fd6e0915d7182c767ed162823406ced6402336f852280b
|
7
|
+
data.tar.gz: a22bec5d094bfbd59ef3b92cb2091d0279be18a2302bb88bade6c8c382d40071b404c897b137cbf7b592222b7f75407058e08282e423ce60bbcfa834e1ef58fc
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
|
2
|
-
{��q�w7��t,.�A\S{�՛}�!es#v��}�,8�m�a��>�A�2̖T���Y#�������M
|
3
|
-
�=�v#p�dl�K�4��]膖H%�Q��+a��(���cr�ѵ�:Nϔ�~v4��|�^��y��ꌭ�:HKe�@��Oev!\cT�c:t��ܺ�pY'��WV,���.�E(9Vʐ)��MG�u��4�b���u��+���\���5(�u�%�`��:�}���A�Eӻy��L�8�����
|
1
|
+
��V�귕6n�Wn��T�1���[N���~�������2��e����bw`F$����ԇmf��G��Z�Q� PY1"��a�x�{�%rux�\Hǭ�gn��Wi`��9���p|�靆�g*��n_@��7Nq�dݳѳ���\k�2|��,LA .�3|W_�����D����8��l9�N�W����L&��xM;p���2�~�g����n��s���,���հ�"� �έ�/���~F���-{�
|
data/History.rdoc
CHANGED
@@ -1,3 +1,91 @@
|
|
1
|
+
=== 4.16.0 / 2021-10-27
|
2
|
+
|
3
|
+
* 4 minor enhancements:
|
4
|
+
|
5
|
+
* Added Sexp#value (pushed up from ruby_parser).
|
6
|
+
* Aliased Sexp#concat to #_concat and use that so it can be overridden.
|
7
|
+
* Cache the #hash result.
|
8
|
+
* StrictSexp mode (4) now covers concat.
|
9
|
+
|
10
|
+
* 3 bug fixes:
|
11
|
+
|
12
|
+
* Fix some doco on each_sexp to clarify that it is not recursive.
|
13
|
+
* Fixed a bug calling enum_for when using each_of_type w/ no block.
|
14
|
+
* Minor fixes to pt_testcase.rb for custom timeouts and better error handling.
|
15
|
+
|
16
|
+
=== 4.15.3 / 2021-05-15
|
17
|
+
|
18
|
+
* 1 minor enhancement:
|
19
|
+
|
20
|
+
* Added 3.0 to pt_testcase.rb
|
21
|
+
|
22
|
+
=== 4.15.2 / 2021-01-10
|
23
|
+
|
24
|
+
* 1 bug fix:
|
25
|
+
|
26
|
+
* Bumped ruby version to include < 4 (trunk).
|
27
|
+
|
28
|
+
=== 4.15.1 / 2020-08-31
|
29
|
+
|
30
|
+
* 1 bug fix:
|
31
|
+
|
32
|
+
* Bumped ruby version to include 3.0 (trunk).
|
33
|
+
|
34
|
+
=== 4.15.0 / 2020-06-09
|
35
|
+
|
36
|
+
* 1 minor enhancement:
|
37
|
+
|
38
|
+
* Added `child` and `include` to Sexp::Matcher.parse language.
|
39
|
+
|
40
|
+
=== 4.14.1 / 2020-02-09
|
41
|
+
|
42
|
+
* 2 bug fixes:
|
43
|
+
|
44
|
+
* Declared support for ruby 2.2+ to gemspec.
|
45
|
+
* Fixed alias for `not?` to `-` for ruby <= 2.4. (nard-tech).
|
46
|
+
|
47
|
+
=== 4.14.0 / 2020-02-06
|
48
|
+
|
49
|
+
* 4 minor enhancements:
|
50
|
+
|
51
|
+
* Added '-' as an alias for the 'not?' pattern matching command.
|
52
|
+
* Added Klass matcher to match on types.
|
53
|
+
* Added `k` shortcut for Klass & hooked into Sexp::Matcher.parse.
|
54
|
+
* Added any matcher to pattern parser.
|
55
|
+
|
56
|
+
=== 4.13.0 / 2019-09-24
|
57
|
+
|
58
|
+
* 4 minor enhancements:
|
59
|
+
|
60
|
+
* Added Sexp.q (query) and deprecated Sexp.s to distinguish better and match inspect output.
|
61
|
+
* Extended Sexp::Matcher::Parser to allow `not?` patterns.
|
62
|
+
* Extended Sexp::Matcher::Parser to cover more method names.
|
63
|
+
* Split out all pattern-oriented code to sexp_matcher.rb.
|
64
|
+
|
65
|
+
* 1 bug fix:
|
66
|
+
|
67
|
+
* Fixed bug w/ ruby's Array#eql? and #hash not looking at ivars.
|
68
|
+
|
69
|
+
=== 4.12.1 / 2019-06-03
|
70
|
+
|
71
|
+
* 1 minor enhancement:
|
72
|
+
|
73
|
+
* Sexp#line now raises if setting w/ non-integer (eg nil).
|
74
|
+
|
75
|
+
* 3 bug fixes:
|
76
|
+
|
77
|
+
* Fixed pt_testcase.rb for block args w/ trailing commas.
|
78
|
+
* Fixed pt_testcase.rb for stabby proc sexps.
|
79
|
+
* Simple fixes for STRICT_SEXP=1.
|
80
|
+
|
81
|
+
=== 4.12.0 / 2019-03-12
|
82
|
+
|
83
|
+
* 3 bug fixes:
|
84
|
+
|
85
|
+
* Fixed sexp_body to return empty sexp instead of nil when using STRICT_SEXP.
|
86
|
+
* STRICT_SEXP=4+ fails w/ current use of concat. Removed concat from strictness for now.
|
87
|
+
* Use concat internally instead of splat. Some people have 20000 node sexps! (presidentbeef)
|
88
|
+
|
1
89
|
=== 4.11.0 / 2018-04-05
|
2
90
|
|
3
91
|
* 1 minor enhancement:
|
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
data/lib/pt_testcase.rb
CHANGED
@@ -77,7 +77,7 @@ class ParseTreeTestCase < Minitest::Test
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def self.add_19tests name, hash
|
80
|
-
add_tests "#{name}
|
80
|
+
add_tests "#{name}__19_20_21_22_23_24_25_26_27_30", hash # HACK?
|
81
81
|
end
|
82
82
|
|
83
83
|
def self.add_19edgecases ruby, sexp, cases
|
@@ -102,7 +102,7 @@ class ParseTreeTestCase < Minitest::Test
|
|
102
102
|
testcases[verbose][klass] = testcases[nonverbose][klass]
|
103
103
|
end
|
104
104
|
|
105
|
-
VER_RE = "(1[89]|2[
|
105
|
+
VER_RE = "(1[89]|2[01234567]|3[0])"
|
106
106
|
|
107
107
|
def self.generate_test klass, node, data, input_name, output_name
|
108
108
|
klass.send :define_method, "test_#{node}" do
|
@@ -150,7 +150,8 @@ class ParseTreeTestCase < Minitest::Test
|
|
150
150
|
|
151
151
|
before_process_hook klass, node, data, input_name, output_name
|
152
152
|
refute_nil data[input_name], "testcase does not exist?"
|
153
|
-
|
153
|
+
timeout = (ENV["RP_TIMEOUT"] || 10).to_i
|
154
|
+
@result = processor.process input, "(string)", timeout
|
154
155
|
assert_equal(expected, @result,
|
155
156
|
"failed on input: #{data[input_name].inspect}")
|
156
157
|
after_process_hook klass, node, data, input_name, output_name
|
@@ -158,7 +159,11 @@ class ParseTreeTestCase < Minitest::Test
|
|
158
159
|
extra_input.each do |extra|
|
159
160
|
processor.process(extra)
|
160
161
|
end
|
161
|
-
extra = processor.extra_methods
|
162
|
+
extra = if processor.respond_to?(:extra_methods) then
|
163
|
+
processor.extra_methods
|
164
|
+
else
|
165
|
+
[]
|
166
|
+
end
|
162
167
|
assert_equal extra_expected, extra
|
163
168
|
end
|
164
169
|
end
|
@@ -363,26 +368,26 @@ class ParseTreeTestCase < Minitest::Test
|
|
363
368
|
###
|
364
369
|
# 1.9 specific tests
|
365
370
|
|
366
|
-
add_19edgecases("
|
371
|
+
add_19edgecases("-> () { (x + 1) }",
|
367
372
|
s(:iter,
|
368
|
-
s(:
|
373
|
+
s(:lambda),
|
369
374
|
s(:args),
|
370
375
|
s(:call, s(:call, nil, :x), :+, s(:lit, 1))),
|
371
376
|
"stabby_args" => "->() { (x + 1) }",
|
372
377
|
"stabby_args_doend" => "->() do (x + 1) end")
|
373
378
|
|
374
|
-
add_19edgecases("
|
379
|
+
add_19edgecases("-> { (x + 1) }",
|
375
380
|
s(:iter,
|
376
|
-
s(:
|
381
|
+
s(:lambda),
|
377
382
|
0,
|
378
383
|
s(:call, s(:call, nil, :x), :+, s(:lit, 1))),
|
379
384
|
"stabby_args_0_no_parens" => "-> { (x + 1) }",
|
380
385
|
"stabby_args_0_no_parens_doend" => "-> do (x + 1) end",
|
381
386
|
"stabby_args_0_spacebar_broken" => "->{x+1}") # I hate you
|
382
387
|
|
383
|
-
add_19edgecases("
|
388
|
+
add_19edgecases("-> (x, y) { (x + y) }",
|
384
389
|
s(:iter,
|
385
|
-
s(:
|
390
|
+
s(:lambda),
|
386
391
|
s(:args, :x, :y),
|
387
392
|
s(:call, s(:lvar, :x), :+, s(:lvar, :y))),
|
388
393
|
"stabby_args_2" => "->(x, y) { (x + y) }",
|
@@ -390,9 +395,9 @@ class ParseTreeTestCase < Minitest::Test
|
|
390
395
|
"stabby_args_2_no_parens" => "-> x, y { (x + y) }",
|
391
396
|
"stabby_args_2_no_parens_doend" => "-> x, y do (x + y) end")
|
392
397
|
|
393
|
-
add_19edgecases("
|
398
|
+
add_19edgecases("-> (x) { (x + 1) }",
|
394
399
|
s(:iter,
|
395
|
-
s(:
|
400
|
+
s(:lambda),
|
396
401
|
s(:args, :x),
|
397
402
|
s(:call, s(:lvar, :x), :+, s(:lit, 1))),
|
398
403
|
"stabby_args_1" => "->(x) { (x + 1) }",
|
@@ -2080,17 +2085,15 @@ class ParseTreeTestCase < Minitest::Test
|
|
2080
2085
|
"Ruby" => "lambda { |a,| a }",
|
2081
2086
|
"ParseTree" => s(:iter,
|
2082
2087
|
s(:call, nil, :lambda),
|
2083
|
-
s(:args, :a),
|
2084
|
-
s(:lvar, :a))
|
2085
|
-
"Ruby2Ruby" => "lambda { |a| a }")
|
2088
|
+
s(:args, :a, nil),
|
2089
|
+
s(:lvar, :a)))
|
2086
2090
|
|
2087
2091
|
add_tests("lambda_args_norm_comma2",
|
2088
|
-
"Ruby" => "lambda { |a,b,| a }",
|
2092
|
+
"Ruby" => "lambda { |a, b,| a }",
|
2089
2093
|
"ParseTree" => s(:iter,
|
2090
2094
|
s(:call, nil, :lambda),
|
2091
|
-
s(:args, :a, :b),
|
2092
|
-
s(:lvar, :a))
|
2093
|
-
"Ruby2Ruby" => "lambda { |a, b| a }")
|
2095
|
+
s(:args, :a, :b, nil),
|
2096
|
+
s(:lvar, :a)))
|
2094
2097
|
|
2095
2098
|
add_tests("lambda_args_norm_star",
|
2096
2099
|
"Ruby" => "lambda { |a, *star| star }",
|