sexp_processor 4.12.1 → 4.17.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2fe32dcd3e36da0a96d86a6a1a7fd60dd8cef96ebd1e0d1b0d87338e3d7fee85
4
- data.tar.gz: d55a40a0ed66d6d84cf653efba498f01d64fba61e7fd4a9eb87caa04f8dcb396
3
+ metadata.gz: 84e793115874bbbb3ca9d8970dff4d549d2d6c34b7e92ced84f04bc397e1c8fa
4
+ data.tar.gz: 9cced0bc88ebba617ec5ac8503f885df9e3d31a594e52d40c2013b1a69bb035d
5
5
  SHA512:
6
- metadata.gz: 8574bf015b701313f58aa5650b963ab35f9119567826606190658640ee32c870ce957ad73e0b2e17b6350c9217fb691383f8794d91d152a4ff2c18873cb18d5b
7
- data.tar.gz: 4a0a6754c29ac19d5654a3a8909a1fd233bfa1831fce155e9c4bee3e25143923693d84a2019079965f507fef34e0502ac412621a671076ba45ce42a312ccbac3
6
+ metadata.gz: 6ce5adc11c8dd07cfabeccf433fe560687f8a75aa61e5917e46be45cef28f9fbefbf952c4b1a83fdfcc8dcf9a66fec72dda9cc0ca8cc638159d9c689d966920a
7
+ data.tar.gz: 8b6b690cc7ed1428fd82cf6ccf4b9110bc3aa68dd7724affff8d91824667b5dcbcf7b625a28677a2c0d80fb228704928b52b2e76a481007feeca65069a244def
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,96 @@
1
+ === 4.17.1 / 2024-01-15
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Added 3.3 to pt_testcase.rb
6
+
7
+ === 4.17.0 / 2023-05-03
8
+
9
+ * 2 minor enhancements:
10
+
11
+ * Added Sexp#line_max=.
12
+ * Will load strict_sexp if $SP_DEBUG is set.
13
+
14
+ * 3 bug fixes:
15
+
16
+ * Sexp#line_max lazy accessor now compacts.
17
+ * Sexp#new copies line_max if defined.
18
+ * strict_sexp.rb: #first can take an int arg. Fixed mutator wrappers to pass args.
19
+
20
+ === 4.16.1 / 2022-04-09
21
+
22
+ * 1 minor enhancement:
23
+
24
+ * Reworked ParseTreeTestCase's notion of versions to make it easier to extend.
25
+
26
+ === 4.16.0 / 2021-10-27
27
+
28
+ * 4 minor enhancements:
29
+
30
+ * Added Sexp#value (pushed up from ruby_parser).
31
+ * Aliased Sexp#concat to #_concat and use that so it can be overridden.
32
+ * Cache the #hash result.
33
+ * StrictSexp mode (4) now covers concat.
34
+
35
+ * 3 bug fixes:
36
+
37
+ * Fix some doco on each_sexp to clarify that it is not recursive.
38
+ * Fixed a bug calling enum_for when using each_of_type w/ no block.
39
+ * Minor fixes to pt_testcase.rb for custom timeouts and better error handling.
40
+
41
+ === 4.15.3 / 2021-05-15
42
+
43
+ * 1 minor enhancement:
44
+
45
+ * Added 3.0 to pt_testcase.rb
46
+
47
+ === 4.15.2 / 2021-01-10
48
+
49
+ * 1 bug fix:
50
+
51
+ * Bumped ruby version to include < 4 (trunk).
52
+
53
+ === 4.15.1 / 2020-08-31
54
+
55
+ * 1 bug fix:
56
+
57
+ * Bumped ruby version to include 3.0 (trunk).
58
+
59
+ === 4.15.0 / 2020-06-09
60
+
61
+ * 1 minor enhancement:
62
+
63
+ * Added `child` and `include` to Sexp::Matcher.parse language.
64
+
65
+ === 4.14.1 / 2020-02-09
66
+
67
+ * 2 bug fixes:
68
+
69
+ * Declared support for ruby 2.2+ to gemspec.
70
+ * Fixed alias for `not?` to `-` for ruby <= 2.4. (nard-tech).
71
+
72
+ === 4.14.0 / 2020-02-06
73
+
74
+ * 4 minor enhancements:
75
+
76
+ * Added '-' as an alias for the 'not?' pattern matching command.
77
+ * Added Klass matcher to match on types.
78
+ * Added `k` shortcut for Klass & hooked into Sexp::Matcher.parse.
79
+ * Added any matcher to pattern parser.
80
+
81
+ === 4.13.0 / 2019-09-24
82
+
83
+ * 4 minor enhancements:
84
+
85
+ * Added Sexp.q (query) and deprecated Sexp.s to distinguish better and match inspect output.
86
+ * Extended Sexp::Matcher::Parser to allow `not?` patterns.
87
+ * Extended Sexp::Matcher::Parser to cover more method names.
88
+ * Split out all pattern-oriented code to sexp_matcher.rb.
89
+
90
+ * 1 bug fix:
91
+
92
+ * Fixed bug w/ ruby's Array#eql? and #hash not looking at ivars.
93
+
1
94
  === 4.12.1 / 2019-06-03
2
95
 
3
96
  * 1 minor enhancement:
data/Manifest.txt CHANGED
@@ -5,6 +5,7 @@ Rakefile
5
5
  lib/composite_sexp_processor.rb
6
6
  lib/pt_testcase.rb
7
7
  lib/sexp.rb
8
+ lib/sexp_matcher.rb
8
9
  lib/sexp_processor.rb
9
10
  lib/strict_sexp.rb
10
11
  lib/unique.rb
data/Rakefile CHANGED
@@ -11,6 +11,8 @@ Hoe.add_include_dirs("../../ruby_parser/dev/lib")
11
11
  Hoe.spec 'sexp_processor' do
12
12
  developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
13
13
 
14
+ require_ruby_version [">= 2.6", "< 4"]
15
+
14
16
  license "MIT"
15
17
  end
16
18
 
data/lib/pt_testcase.rb CHANGED
@@ -34,6 +34,12 @@ class Examples
34
34
  end
35
35
 
36
36
  class ParseTreeTestCase < Minitest::Test
37
+ all_versions = %w[18 19 20 21 22 23 24 25 26 27 30 31 32 33]
38
+ most_versions = all_versions.drop(1)
39
+
40
+ TEST_SUFFIX = "_#{most_versions.join "_"}"
41
+ VER_RE = /(#{Regexp.union(*all_versions)})/
42
+
37
43
  attr_accessor :processor # to be defined by subclass
38
44
 
39
45
  def setup
@@ -77,7 +83,7 @@ class ParseTreeTestCase < Minitest::Test
77
83
  end
78
84
 
79
85
  def self.add_19tests name, hash
80
- add_tests "#{name}__19_20_21_22_23_24_25_26", hash # HACK?
86
+ add_tests "#{name}_#{TEST_SUFFIX}", hash # HACK?
81
87
  end
82
88
 
83
89
  def self.add_19edgecases ruby, sexp, cases
@@ -102,8 +108,6 @@ class ParseTreeTestCase < Minitest::Test
102
108
  testcases[verbose][klass] = testcases[nonverbose][klass]
103
109
  end
104
110
 
105
- VER_RE = "(1[89]|2[0123456])"
106
-
107
111
  def self.generate_test klass, node, data, input_name, output_name
108
112
  klass.send :define_method, "test_#{node}" do
109
113
  flunk "Processor is nil" if processor.nil?
@@ -150,7 +154,8 @@ class ParseTreeTestCase < Minitest::Test
150
154
 
151
155
  before_process_hook klass, node, data, input_name, output_name
152
156
  refute_nil data[input_name], "testcase does not exist?"
153
- @result = processor.process input
157
+ timeout = (ENV["RP_TIMEOUT"] || 10).to_i
158
+ @result = processor.process input, "(string)", timeout
154
159
  assert_equal(expected, @result,
155
160
  "failed on input: #{data[input_name].inspect}")
156
161
  after_process_hook klass, node, data, input_name, output_name
@@ -158,7 +163,11 @@ class ParseTreeTestCase < Minitest::Test
158
163
  extra_input.each do |extra|
159
164
  processor.process(extra)
160
165
  end
161
- extra = processor.extra_methods rescue []
166
+ extra = if processor.respond_to?(:extra_methods) then
167
+ processor.extra_methods
168
+ else
169
+ []
170
+ end
162
171
  assert_equal extra_expected, extra
163
172
  end
164
173
  end
@@ -1063,7 +1072,7 @@ class ParseTreeTestCase < Minitest::Test
1063
1072
  "Ruby2Ruby" => "-(2 ** 31)")
1064
1073
 
1065
1074
  add_tests("case",
1066
- "Ruby" => "var = 2\nresult = \"\"\ncase var\nwhen 1 then\n puts(\"something\")\n result = \"red\"\nwhen 2, 3 then\n result = \"yellow\"\nwhen 4 then\n # do nothing\nelse\n result = \"green\"\nend\ncase result\nwhen \"red\" then\n var = 1\nwhen \"yellow\" then\n var = 2\nwhen \"green\" then\n var = 3\nelse\n # do nothing\nend\n",
1075
+ "Ruby" => "var = 2\nresult = \"\"\ncase var\nwhen 1 then\n puts(\"something\")\n result = \"red\"\nwhen 2, 3 then\n result = \"yellow\"\nwhen 4 then\n # do nothing\nelse\n result = \"green\"\nend\ncase result\nwhen \"red\" then\n var = 1\nwhen \"yellow\" then\n var = 2\nwhen \"green\" then\n var = 3\nend\n",
1067
1076
  "ParseTree" => s(:block,
1068
1077
  s(:lasgn, :var, s(:lit, 2)),
1069
1078
  s(:lasgn, :result, s(:str, "")),
@@ -1115,7 +1124,7 @@ class ParseTreeTestCase < Minitest::Test
1115
1124
  s(:lasgn, :result, s(:lit, 7)))))
1116
1125
 
1117
1126
  add_tests("case_nested_inner_no_expr",
1118
- "Ruby" => "case a\nwhen b then\n case\n when (d and e) then\n f\n else\n # do nothing\n end\nelse\n # do nothing\nend",
1127
+ "Ruby" => "case a\nwhen b then\n case\n when (d and e) then\n f\n end\nend",
1119
1128
  "ParseTree" => s(:case, s(:call, nil, :a),
1120
1129
  s(:when,
1121
1130
  s(:array, s(:call, nil, :b)),