ruby_parser 3.14.0 → 3.14.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7293d43033177f04deb6a7f28ebd39a495b56360e8ddd8386e468b76f931f367
4
- data.tar.gz: 46aaa402559b7b037d2309cc721f6c3664ec6998dd1a6a2d0cd6cb4fc266bcb1
3
+ metadata.gz: 80b91fff73fd2b78aa0e9218f7f975247d0f281c04820b28c99f3b2b378d85c7
4
+ data.tar.gz: 85fee306db91c8f29cfe45728dea537ef068bf1dee3055c5f88395adc335eb71
5
5
  SHA512:
6
- metadata.gz: d4f7a1cab958547867b0ba7d6905b3845b19eca923cf01b16329668f7185ab500b90efd8b9bf04278d747f270a75ad2e5099e7e3a3e39bc25bf883189d7ecd5f
7
- data.tar.gz: a7ed89f3cc668ed8c04912e97145130e5b7a2014bec06680c29a6baadeae0ad17559fed244d38670ef62b49bb749ff1b25553e652217d7c6c8fc7c2ecf56b63b
6
+ metadata.gz: ac46d9e8261e7ad6e182e4fd81551ce357b5b4d39ba3a361f19d8a86f67e40d5645b3fe4fffe47ecf544eb2c8b66fa92aba032ff8663def56490e337a192ffa6
7
+ data.tar.gz: 1070b7d4b64dc73e551ea1d0a0de17f75e21f313e549ac6e735bdf235777e17ec67373c67fec2f31413224c1182eb5ca797fecdd2c1d36219b9586b9c960d838
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,15 @@
1
+ === 3.14.1 / 2019-10-29
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Declared that ruby_parser supports ruby 2.2 and up.
6
+
7
+ * 3 bug fixes:
8
+
9
+ * Fixed a problem with %W with a null-byte terminator. (wtf?) (spohlenz)
10
+ * Fixed line numbering for command (eg methods without parentheses) arguments. (mvz)
11
+ * Fixed lineno on new dxstrs. (presidentbeef)
12
+
1
13
  === 3.14.0 / 2019-09-24
2
14
 
3
15
  * 8 minor enhancements:
data/Rakefile CHANGED
@@ -24,6 +24,8 @@ Hoe.spec "ruby_parser" do
24
24
  dependency "rake", "< 11", :developer
25
25
  dependency "oedipus_lex", "~> 2.5", :developer
26
26
 
27
+ require_ruby_version "~> 2.2"
28
+
27
29
  if plugin? :perforce then # generated files
28
30
  V2.each do |n|
29
31
  self.perforce_ignore << "lib/ruby#{n}_parser.rb"
@@ -1177,8 +1177,6 @@ class RubyLexer
1177
1177
  handled = true
1178
1178
 
1179
1179
  case
1180
- when paren_re && scan(paren_re) then
1181
- self.string_nest += 1
1182
1180
  when scan(term_re) then
1183
1181
  if self.string_nest == 0 then
1184
1182
  ss.pos -= 1
@@ -1186,6 +1184,8 @@ class RubyLexer
1186
1184
  else
1187
1185
  self.string_nest -= 1
1188
1186
  end
1187
+ when paren_re && scan(paren_re) then
1188
+ self.string_nest += 1
1189
1189
  when expand && scan(/#(?=[\$\@\{])/) then # TODO: this seems wrong
1190
1190
  ss.pos -= 1
1191
1191
  break
@@ -1232,9 +1232,9 @@ class RubyLexer
1232
1232
  end
1233
1233
  x = Regexp.escape paren if paren && paren != "\000"
1234
1234
  re = if qwords then
1235
- /[^#{t}#{x}\#\0\\\s]+|./ # |. to pick up whatever
1235
+ /[^#{t}#{x}\#\\\s]+|./ # |. to pick up whatever
1236
1236
  else
1237
- /[^#{t}#{x}\#\0\\]+|./
1237
+ /[^#{t}#{x}\#\\]+|./
1238
1238
  end
1239
1239
 
1240
1240
  scan re
@@ -28,7 +28,7 @@ class Sexp
28
28
  end
29
29
 
30
30
  module RubyParserStuff
31
- VERSION = "3.14.0"
31
+ VERSION = "3.14.1"
32
32
 
33
33
  attr_accessor :lexer, :in_def, :in_single, :file
34
34
  attr_accessor :in_kwarg
@@ -831,6 +831,8 @@ module RubyParserStuff
831
831
  (_, line), name, _, args, body, nil_body_line, * = val
832
832
  body ||= s(:nil).line nil_body_line
833
833
 
834
+ args.line line
835
+
834
836
  result = s(:defn, name.to_sym, args).line line
835
837
 
836
838
  if body then
@@ -1240,7 +1242,7 @@ module RubyParserStuff
1240
1242
  when :dstr
1241
1243
  str.sexp_type = :dxstr
1242
1244
  else
1243
- str = s(:dxstr, "", str)
1245
+ str = s(:dxstr, "", str).line str.line
1244
1246
  end
1245
1247
  str
1246
1248
  else
@@ -2657,6 +2657,22 @@ class TestRubyLexer < Minitest::Test
2657
2657
  :tSTRING_END, "]", EXPR_LIT)
2658
2658
  end
2659
2659
 
2660
+ def test_yylex_string_pct_Q_null_wtf?
2661
+ assert_lex3("%Q\0s1 s2\0",
2662
+ nil,
2663
+ :tSTRING_BEG, "%Q\0", EXPR_BEG,
2664
+ :tSTRING_CONTENT, "s1 s2", EXPR_BEG,
2665
+ :tSTRING_END, "\0", EXPR_LIT)
2666
+ end
2667
+
2668
+ def test_yylex_string_pct_Q_bang
2669
+ assert_lex3("%Q!s1 s2!",
2670
+ nil,
2671
+ :tSTRING_BEG, "%Q\0", EXPR_BEG,
2672
+ :tSTRING_CONTENT, "s1 s2", EXPR_BEG,
2673
+ :tSTRING_END, "!", EXPR_LIT)
2674
+ end
2675
+
2660
2676
  def test_yylex_string_pct_W
2661
2677
  assert_lex3("%W[s1 s2\ns3]", # TODO: add interpolation to these
2662
2678
  nil,
@@ -162,6 +162,16 @@ module TestRubyParserShared
162
162
  assert_parse rb, pt
163
163
  end
164
164
 
165
+ def test_backticks_interpolation_line
166
+ rb = 'x `#{y}`'
167
+ pt = s(:call, nil, :x,
168
+ s(:dxstr, "",
169
+ s(:evstr,
170
+ s(:call, nil, :y).line(1)).line(1))).line(1)
171
+
172
+ assert_parse rb, pt
173
+ end
174
+
165
175
  def test_bang_eq
166
176
  rb = "1 != 2"
167
177
  pt = s(:not, s(:call, s(:lit, 1), :"==", s(:lit, 2)))
@@ -1514,6 +1524,13 @@ module TestRubyParserShared
1514
1524
  assert_equal 2, c.line, "call should have line number"
1515
1525
  end
1516
1526
 
1527
+ def test_parse_line_defn_no_parens_args
1528
+ rb = "def f a\nend"
1529
+ pt = s(:defn, :f, s(:args, :a).line(1), s(:nil).line(2)).line(1)
1530
+
1531
+ assert_parse_line rb, pt, 1
1532
+ end
1533
+
1517
1534
  def test_parse_line_defn_complex
1518
1535
  rb = "def x(y)\n p(y)\n y *= 2\n return y;\nend" # TODO: remove () & ;
1519
1536
  pt = s(:defn, :x, s(:args, :y),
@@ -1530,7 +1547,7 @@ module TestRubyParserShared
1530
1547
  end
1531
1548
 
1532
1549
  def test_parse_line_defn_no_parens
1533
- pt = s(:defn, :f, s(:args), s(:nil))
1550
+ pt = s(:defn, :f, s(:args).line(1), s(:nil)).line(1)
1534
1551
 
1535
1552
  rb = "def f\nend"
1536
1553
  assert_parse_line rb, pt, 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.14.0
4
+ version: 3.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  Em82dBUFsipwMLCYj39kcyHWAxyl6Ae1Cn9r/ItVBCxoeFdrHjfavnrIEoXUt4bU
30
30
  UfBugfLD19bu3nvL+zTAGx/U
31
31
  -----END CERTIFICATE-----
32
- date: 2019-09-25 00:00:00.000000000 Z
32
+ date: 2019-10-30 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: sexp_processor
@@ -209,9 +209,9 @@ require_paths:
209
209
  - lib
210
210
  required_ruby_version: !ruby/object:Gem::Requirement
211
211
  requirements:
212
- - - ">="
212
+ - - "~>"
213
213
  - !ruby/object:Gem::Version
214
- version: '0'
214
+ version: '2.2'
215
215
  required_rubygems_version: !ruby/object:Gem::Requirement
216
216
  requirements:
217
217
  - - ">="
metadata.gz.sig CHANGED
Binary file