ruby_parser 3.1.2 → 3.1.3

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.tar.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- 9[�<��kSM/��5sp�,&+� S%�U2eSat9���Kɦ�7N9����F"��FYJ�ɣ�X�G��
2
- ���Nrd�O)��U��϶ъ��Q{�����X����= oLUm]|���C�����iϾ;e[� g)>�u{@� �pJS�E�0걆ӑ֤Ӱ~i*;Ŋ�v9�� #�N^�͊���,�������T-Ub�S]Ux�{�l��c��[�� Nʕ����`�3�ʰ��8��Q<
1
+ ��)Ehst��)��3Z�-�4h���� (L'&@E�-6)�.����EN1'Pћ�ۓ�1DnS ;�GEz]h
2
+ Pk����D��9w���$�����ԉ�Y��Iޮf0Ǭ�Mxm�G�<lrZ�K*ʍ�A����O��㸌�(4�������vu=��|T6�]�D6� ��Zn䤧-�g�������h���EI@S^��T ���+�QҘR��Ι���Jh�ҡ�@���|�Ni5Я{�W�
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ === 3.1.3 / 2013-04-09
2
+
3
+ * 2 bug fixes:
4
+
5
+ * Fixed begin w/ else but no rescue. (whitequark)
6
+ * Removed literal stripping from block_append. Not its job.
7
+
1
8
  === 3.1.2 / 2013-03-18
2
9
 
3
10
  * 1 minor enhancement:
data/lib/ruby18_parser.rb CHANGED
@@ -11,6 +11,8 @@ class Ruby18Parser < Racc::Parser
11
11
  require "ruby_lexer"
12
12
  require "ruby_parser_extras"
13
13
 
14
+ # :stopdoc:
15
+
14
16
  # Local Variables: **
15
17
  # racc-token-length-max:14 **
16
18
  # End: **
data/lib/ruby18_parser.y CHANGED
@@ -1872,6 +1872,8 @@ end
1872
1872
  require "ruby_lexer"
1873
1873
  require "ruby_parser_extras"
1874
1874
 
1875
+ # :stopdoc:
1876
+
1875
1877
  # Local Variables: **
1876
1878
  # racc-token-length-max:14 **
1877
1879
  # End: **
data/lib/ruby19_parser.rb CHANGED
@@ -11,6 +11,8 @@ class Ruby19Parser < Racc::Parser
11
11
  require "ruby_lexer"
12
12
  require "ruby_parser_extras"
13
13
 
14
+ # :stopdoc:
15
+
14
16
  # Local Variables: **
15
17
  # racc-token-length-max:14 **
16
18
  # End: **
data/lib/ruby19_parser.y CHANGED
@@ -2077,6 +2077,8 @@ end
2077
2077
  require "ruby_lexer"
2078
2078
  require "ruby_parser_extras"
2079
2079
 
2080
+ # :stopdoc:
2081
+
2080
2082
  # Local Variables: **
2081
2083
  # racc-token-length-max:14 **
2082
2084
  # End: **
data/lib/ruby_lexer.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  class RubyLexer
4
4
 
5
+ # :stopdoc:
5
6
  RUBY19 = "".respond_to? :encoding
6
7
 
7
8
  IDENT_CHAR_RE = if RUBY19 then
@@ -19,6 +20,7 @@ class RubyLexer
19
20
  attr_accessor :nest
20
21
 
21
22
  ESC_RE = /\\((?>[0-7]{1,3}|x[0-9a-fA-F]{1,2}|M-[^\\]|(C-|c)[^\\]|[^0-7xMCc]))/
23
+ # :startdoc:
22
24
 
23
25
  ##
24
26
  # What version of ruby to parse. 18 and 19 are the only valid values
@@ -53,6 +55,8 @@ class RubyLexer
53
55
  EOF = :eof_haha!
54
56
 
55
57
  # ruby constants for strings (should this be moved somewhere else?)
58
+
59
+ # :stopdoc:
56
60
  STR_FUNC_BORING = 0x00
57
61
  STR_FUNC_ESCAPE = 0x01 # TODO: remove and replace with REGEXP
58
62
  STR_FUNC_EXPAND = 0x02
@@ -82,6 +86,7 @@ class RubyLexer
82
86
  "=~" => :tMATCH,
83
87
  "->" => :tLAMBDA,
84
88
  }
89
+ # :startdoc:
85
90
 
86
91
  # How the parser advances to the next token.
87
92
  #
@@ -7,6 +7,7 @@ require 'strscan'
7
7
  require 'ruby_lexer'
8
8
  require "timeout"
9
9
 
10
+ # :stopdoc:
10
11
  # WHY do I have to do this?!?
11
12
  class Regexp
12
13
  ONCE = 0 unless defined? ONCE # FIX: remove this - it makes no sense
@@ -25,6 +26,7 @@ class Fixnum
25
26
  self
26
27
  end
27
28
  end unless "a"[0] == "a"
29
+ # :startdoc:
28
30
 
29
31
  class RPStringScanner < StringScanner
30
32
  # if ENV['TALLY'] then
@@ -108,7 +110,7 @@ class RPStringScanner < StringScanner
108
110
  end
109
111
 
110
112
  module RubyParserStuff
111
- VERSION = '3.1.2' unless constants.include? "VERSION" # SIGH
113
+ VERSION = "3.1.3" unless constants.include? "VERSION" # SIGH
112
114
 
113
115
  attr_accessor :lexer, :in_def, :in_single, :file
114
116
  attr_reader :env, :comments
@@ -263,11 +265,6 @@ module RubyParserStuff
263
265
  return head if tail.nil?
264
266
  return tail if head.nil?
265
267
 
266
- case head[0]
267
- when :lit, :str then
268
- return tail
269
- end
270
-
271
268
  line = [head.line, tail.line].compact.min
272
269
 
273
270
  head = remove_begin(head)
@@ -473,29 +470,34 @@ module RubyParserStuff
473
470
  end
474
471
 
475
472
  def new_body val
476
- result = val[0]
473
+ body, resbody, elsebody, ensurebody = val
477
474
 
478
- if val[1] then
475
+ result = body
476
+
477
+ if resbody then
479
478
  result = s(:rescue)
480
- result << val[0] if val[0]
479
+ result << body if body
481
480
 
482
- resbody = val[1]
481
+ res = resbody
483
482
 
484
- while resbody do
485
- result << resbody
486
- resbody = resbody.resbody(true)
483
+ while res do
484
+ result << res
485
+ res = res.resbody(true)
487
486
  end
488
487
 
489
- result << val[2] if val[2]
488
+ result << elsebody if elsebody
489
+
490
+ result.line = (body || resbody).line
491
+ end
490
492
 
491
- result.line = (val[0] || val[1]).line
492
- elsif not val[2].nil? then
493
+ if elsebody and not resbody then
493
494
  warning("else without rescue is useless")
494
- result = block_append(result, val[2])
495
+ result = block_append(s(:begin, result), elsebody)
495
496
  end
496
497
 
497
- result = s(:ensure, result, val[3]).compact if val[3]
498
- return result
498
+ result = s(:ensure, result, ensurebody).compact if ensurebody
499
+
500
+ result
499
501
  end
500
502
 
501
503
  def argl x
@@ -275,6 +275,13 @@ module TestRubyParserShared
275
275
  assert_parse rb, pt
276
276
  end
277
277
 
278
+ def test_bug_begin_else
279
+ rb = "begin 1; else; 2 end"
280
+ pt = s(:block, s(:lit, 1), s(:lit, 2))
281
+
282
+ assert_parse rb, pt
283
+ end
284
+
278
285
  def test_bug_comment_eq_begin
279
286
  rb = "\n\n#\n=begin\nblah\n=end\n\n"
280
287
  pt = nil
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_parser
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
- - 2
10
- version: 3.1.2
9
+ - 3
10
+ version: 3.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Davis
@@ -36,7 +36,7 @@ cert_chain:
36
36
  FBHgymkyj/AOSqKRIpXPhjC6
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2013-03-18 00:00:00 Z
39
+ date: 2013-04-10 00:00:00 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sexp_processor
@@ -61,11 +61,11 @@ dependencies:
61
61
  requirements:
62
62
  - - ~>
63
63
  - !ruby/object:Gem::Version
64
- hash: 23
64
+ hash: 21
65
65
  segments:
66
66
  - 4
67
- - 6
68
- version: "4.6"
67
+ - 7
68
+ version: "4.7"
69
69
  type: :development
70
70
  version_requirements: *id002
71
71
  - !ruby/object:Gem::Dependency
@@ -76,11 +76,11 @@ dependencies:
76
76
  requirements:
77
77
  - - ~>
78
78
  - !ruby/object:Gem::Version
79
- hash: 19
79
+ hash: 27
80
80
  segments:
81
- - 3
82
- - 10
83
- version: "3.10"
81
+ - 4
82
+ - 0
83
+ version: "4.0"
84
84
  type: :development
85
85
  version_requirements: *id003
86
86
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file