ruby_parser 3.7.0 → 3.7.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
  SHA1:
3
- metadata.gz: 41b49f3089bda3758931dcacdbfacfe188099d40
4
- data.tar.gz: 16bdfbd9b6b350aadee20337abdc30145df20b01
3
+ metadata.gz: 54985a83895c86ee90364ad54e7325fb977b40d4
4
+ data.tar.gz: e5d03de51047979f876706e1da128242fdfa331b
5
5
  SHA512:
6
- metadata.gz: 54e6bf7dd57d961e29c7378f9779cc0b62d2f3e9f3d8c940605b78306fa6a27bc4bd37d49da2e96e1ca15c324b0d51fc03f861d12ffe8e919b491d9a5e2fcdac
7
- data.tar.gz: 31a135b14a05303a46d8f5f227900139bf255ce297f1c1b23fcef382edd2362e77468aa5562588d516a9e8098be0be1bbfd43716e957b6b19e24bcaaf7def85c
6
+ metadata.gz: b420efaa47bb45a7069312912f537fc33079d3b67f0618c6d3b62adc9a8cfb9b22ca236d1aadb2e12a1d4743624871c9f35152083436a1755073047994d7064b
7
+ data.tar.gz: c794ff4f9b6906ebaccfdbc0f5b7fd912ada0976360813b2841eade89131375eeb8e0880b05c27e8cc40abca74388b06e772e1ccabcad6944e88d5fc502153fa
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,14 @@
1
+ === 3.7.1 / 2015-08-06
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Improved understandability of lexing postfix symbols.
6
+
7
+ * 2 bug fixes:
8
+
9
+ * Fixed timeout caused by regexp backtracking bug w/ long strings in 2.2 parser. (presidentbeef)
10
+ * Rename DEBUG env toggle to RB_LINENO_DEBUG. (tenderlove)
11
+
1
12
  === 3.7.0 / 2015-05-28
2
13
 
3
14
  * 2 major enhancements:
@@ -662,6 +662,23 @@ class RubyLexer
662
662
  return result(:expr_end, :tSYMBOL, symbol)
663
663
  end
664
664
 
665
+ def was_label?
666
+ @was_label = ruby22_label?
667
+ true
668
+ end
669
+
670
+ def process_label_or_string text
671
+ if @was_label && text =~ /:$/ then
672
+ @was_label = nil
673
+ return process_label text
674
+ elsif text =~ /:$/ then
675
+ ss.pos -= 1 # put back ":"
676
+ text = text[0..-2]
677
+ end
678
+
679
+ result :expr_end, :tSTRING, text[1..-2].gsub(/\\\\/, "\\").gsub(/\\'/, "'")
680
+ end
681
+
665
682
  def process_label text
666
683
  result = process_symbol text
667
684
  result[0] = :tLABEL
@@ -1202,7 +1219,7 @@ end
1202
1219
 
1203
1220
  require "ruby_lexer.rex"
1204
1221
 
1205
- if ENV["DEBUG"] then
1222
+ if ENV["RP_LINENO_DEBUG"] then
1206
1223
  class RubyLexer
1207
1224
  alias :old_lineno= :lineno=
1208
1225
 
@@ -93,9 +93,7 @@ ruby22_label? /\"(#{SIMPLE_STRING})\":/o process_label
93
93
 
94
94
  /\[/ process_square_bracket
95
95
 
96
- # TODO: make this conditional on ruby 2.2
97
- ruby22_label? /\'#{SSTRING}\':/o process_label
98
- /\'#{SSTRING}\'/o { result :expr_end, :tSTRING, matched[1..-2].gsub(/\\\\/, "\\").gsub(/\\'/, "'") } # " stupid emacs
96
+ was_label? /\'#{SSTRING}\':?/o process_label_or_string
99
97
 
100
98
  : /\|/
101
99
  | /\|\|\=/ { result :expr_beg, :tOP_ASGN, "||" }
@@ -163,10 +163,8 @@ class RubyLexer
163
163
  end # group /[+\d]/
164
164
  when text = ss.scan(/\[/) then
165
165
  process_square_bracket text
166
- when ruby22_label? && (text = ss.scan(/\'#{SSTRING}\':/o)) then
167
- process_label text
168
- when text = ss.scan(/\'#{SSTRING}\'/o) then
169
- action { result :expr_end, :tSTRING, matched[1..-2].gsub(/\\\\/, "\\").gsub(/\\'/, "'") } # " stupid emacs
166
+ when was_label? && (text = ss.scan(/\'#{SSTRING}\':?/o)) then
167
+ process_label_or_string text
170
168
  when ss.check(/\|/) then
171
169
  case
172
170
  when text = ss.scan(/\|\|\=/) then
@@ -91,7 +91,7 @@ class RPStringScanner < StringScanner
91
91
  end
92
92
 
93
93
  module RubyParserStuff
94
- VERSION = "3.7.0" unless constants.include? "VERSION" # SIGH
94
+ VERSION = "3.7.1" unless constants.include? "VERSION" # SIGH
95
95
 
96
96
  attr_accessor :lexer, :in_def, :in_single, :file
97
97
  attr_reader :env, :comments
@@ -575,6 +575,14 @@ module TestRubyParserShared
575
575
  # TODO: add more including interpolation etc
576
576
  end
577
577
 
578
+ def test_str_backslashes
579
+ long_string = '\n' * 100
580
+ rb = "x '#{long_string}'"
581
+ pt = s(:call, nil, :x, s(:str, long_string))
582
+
583
+ assert_parse rb, pt
584
+ end
585
+
578
586
  def test_str_pct_Q_nested
579
587
  rb = "%Q[before [#\{nest}] after]"
580
588
  pt = s(:dstr, "before [", s(:evstr, s(:call, nil, :nest)), s(:str, "] after"))
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.7.0
4
+ version: 3.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  xJcC6UN6NHMOVMyAXsr2HR0gRRx4ofN1LoP2KhXzSr8UMvQYlwPmE0N5GQv1b5AO
30
30
  VpzF30vNaJK6ZT7xlIsIlwmH
31
31
  -----END CERTIFICATE-----
32
- date: 2015-05-28 00:00:00.000000000 Z
32
+ date: 2015-08-06 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: sexp_processor
@@ -45,6 +45,20 @@ dependencies:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '4.1'
48
+ - !ruby/object:Gem::Dependency
49
+ name: minitest
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '5.7'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '5.7'
48
62
  - !ruby/object:Gem::Dependency
49
63
  name: rdoc
50
64
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file