ruby_parser 3.6.1 → 3.6.2

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
  SHA1:
3
- metadata.gz: 6f2dc966f655d3ceb23a4b37b06c6c9c26c09ab8
4
- data.tar.gz: 321f2ab576a8233d784df4723d62f8702f9c6945
3
+ metadata.gz: 2ac351ad4525bcf28abdb6443e42224edf4421f3
4
+ data.tar.gz: 8eeb665bfd2c5552211403e22e7ac92fd4d570c6
5
5
  SHA512:
6
- metadata.gz: cc57151574646570da39acfc3300da57157b6b809fc6fe7bb88fc7d76e83efd2c392b20b16c23655d9655a01069909d1d635e88b4b4587763483e6458e266d17
7
- data.tar.gz: 2b1503517bcba3526abc8f233bbe5fef0239b984d511cf6a1e3a3784eae2816e1e8dd3546f8726a83fdd42044fcab71e9779b4179f4d0324828403774f8abc4c
6
+ metadata.gz: 9be0b8f5ac035254f0653d525c4d7b268aa9357b8514f106c76508a3563fbea078f33647178176a5ab40e92df4b97ea1542594245a08532b9d9c2963b73186b0
7
+ data.tar.gz: 6646425bfed81e551aad7051d779ea01a750657a2f88677618e248f03036f34945ab1a876182fde2731be2c2fdccb15939a9b807fd44007f3b3d18e6394a4353
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/.autotest CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- ruby -*-
2
2
 
3
3
  require 'autotest/restart'
4
- require 'autotest/isolate'
4
+ # require 'autotest/isolate'
5
5
  require 'autotest/rcov' if ENV['RCOV']
6
6
 
7
7
  Autotest.add_hook :initialize do |at|
data/History.txt CHANGED
@@ -1,4 +1,10 @@
1
- === 3.6.1 / YYYY-MM-DD
1
+ === 3.6.2 / 2014-07-18
2
+
3
+ * 1 bug fix:
4
+
5
+ * Handle return/next/break/yield w/ block call (WHY).
6
+
7
+ === 3.6.1 / 2014-05-12
2
8
 
3
9
  * 1 bug fix:
4
10
 
data/Rakefile CHANGED
@@ -86,7 +86,7 @@ task :isolate => :phony
86
86
  end
87
87
 
88
88
  task :debug => :isolate do
89
- ENV["V"] ||= "20"
89
+ ENV["V"] ||= "21"
90
90
  Rake.application[:parser].invoke # this way we can have DEBUG set
91
91
  Rake.application[:lexer].invoke # this way we can have DEBUG set
92
92
 
data/lib/ruby19_parser.rb CHANGED
@@ -5202,6 +5202,8 @@ def _reduce_402(val, _values, result)
5202
5202
  syntax_error "Both block arg and actual block given." if
5203
5203
  val[0].block_pass?
5204
5204
 
5205
+ val = invert_block_call val if inverted? val
5206
+
5205
5207
  result = val[1]
5206
5208
  result.insert 1, val[0]
5207
5209
 
data/lib/ruby19_parser.y CHANGED
@@ -1432,6 +1432,8 @@ rule
1432
1432
  syntax_error "Both block arg and actual block given." if
1433
1433
  val[0].block_pass?
1434
1434
 
1435
+ val = invert_block_call val if inverted? val
1436
+
1435
1437
  result = val[1]
1436
1438
  result.insert 1, val[0]
1437
1439
  }
data/lib/ruby20_parser.rb CHANGED
@@ -5503,6 +5503,8 @@ def _reduce_413(val, _values, result)
5503
5503
  syntax_error "Both block arg and actual block given." if
5504
5504
  val[0].block_pass?
5505
5505
 
5506
+ val = invert_block_call val if inverted? val
5507
+
5506
5508
  result = val[1]
5507
5509
  result.insert 1, val[0]
5508
5510
 
data/lib/ruby20_parser.y CHANGED
@@ -1494,6 +1494,8 @@ opt_block_args_tail: tCOMMA block_args_tail
1494
1494
  syntax_error "Both block arg and actual block given." if
1495
1495
  val[0].block_pass?
1496
1496
 
1497
+ val = invert_block_call val if inverted? val
1498
+
1497
1499
  result = val[1]
1498
1500
  result.insert 1, val[0]
1499
1501
  }
data/lib/ruby21_parser.rb CHANGED
@@ -5556,6 +5556,8 @@ def _reduce_412(val, _values, result)
5556
5556
  syntax_error "Both block arg and actual block given." if
5557
5557
  val[0].block_pass?
5558
5558
 
5559
+ val = invert_block_call val if inverted? val
5560
+
5559
5561
  result = val[1]
5560
5562
  result.insert 1, val[0]
5561
5563
 
data/lib/ruby21_parser.y CHANGED
@@ -1495,6 +1495,8 @@ opt_block_args_tail: tCOMMA block_args_tail
1495
1495
  syntax_error "Both block arg and actual block given." if
1496
1496
  val[0].block_pass?
1497
1497
 
1498
+ val = invert_block_call val if inverted? val
1499
+
1498
1500
  result = val[1]
1499
1501
  result.insert 1, val[0]
1500
1502
  }
data/lib/ruby_lexer.rex CHANGED
@@ -1,7 +1,5 @@
1
1
  # encoding: UTF-8
2
- # TODO: this needs to be put on the first line
3
2
  #
4
- # new_ruby_parser.rex
5
3
  # lexical scanner definition for ruby
6
4
 
7
5
  class RubyLexer
@@ -1,13 +1,11 @@
1
+ # encoding: UTF-8
1
2
  #--
2
3
  # This file is automatically generated. Do not modify it.
3
- # Generated by: oedipus_lex version 2.2.1.
4
+ # Generated by: oedipus_lex version 2.3.1.
4
5
  # Source: lib/ruby_lexer.rex
5
6
  #++
6
7
 
7
- # encoding: UTF-8
8
- # TODO: this needs to be put on the first line
9
8
  #
10
- # new_ruby_parser.rex
11
9
  # lexical scanner definition for ruby
12
10
 
13
11
  class RubyLexer
@@ -91,7 +91,7 @@ class RPStringScanner < StringScanner
91
91
  end
92
92
 
93
93
  module RubyParserStuff
94
- VERSION = "3.6.1" unless constants.include? "VERSION" # SIGH
94
+ VERSION = "3.6.2" unless constants.include? "VERSION" # SIGH
95
95
 
96
96
  attr_accessor :lexer, :in_def, :in_single, :file
97
97
  attr_reader :env, :comments
@@ -1061,6 +1061,18 @@ module RubyParserStuff
1061
1061
  block and call_or_args.block_pass?
1062
1062
  end
1063
1063
 
1064
+ def inverted? val
1065
+ [:return, :next, :break, :yield].include? val[0].sexp_type
1066
+ end
1067
+
1068
+ def invert_block_call val
1069
+ (type, call), iter = val
1070
+
1071
+ iter.insert 1, call
1072
+
1073
+ [iter, s(type)]
1074
+ end
1075
+
1064
1076
  def ret_args node
1065
1077
  if node then
1066
1078
  raise "write a test 5" if node[0] == :block_pass
@@ -1643,6 +1643,46 @@ module TestRubyParserShared19to21
1643
1643
  assert_parse rb, pt
1644
1644
  end
1645
1645
 
1646
+ def test_block_return
1647
+ rb = "return foo arg do |bar| end"
1648
+ pt = s(:return,
1649
+ s(:iter,
1650
+ s(:call, nil, :foo, s(:call, nil, :arg)),
1651
+ s(:args, :bar)))
1652
+
1653
+ assert_parse rb, pt
1654
+ end
1655
+
1656
+ def test_block_next
1657
+ rb = "next foo arg do |bar| end"
1658
+ pt = s(:next,
1659
+ s(:iter,
1660
+ s(:call, nil, :foo, s(:call, nil, :arg)),
1661
+ s(:args, :bar)))
1662
+
1663
+ assert_parse rb, pt
1664
+ end
1665
+
1666
+ def test_block_yield
1667
+ rb = "yield foo arg do |bar| end"
1668
+ pt = s(:yield,
1669
+ s(:iter,
1670
+ s(:call, nil, :foo, s(:call, nil, :arg)),
1671
+ s(:args, :bar)))
1672
+
1673
+ assert_parse rb, pt
1674
+ end
1675
+
1676
+ def test_block_break
1677
+ rb = "break foo arg do |bar| end"
1678
+ pt = s(:break,
1679
+ s(:iter,
1680
+ s(:call, nil, :foo, s(:call, nil, :arg)),
1681
+ s(:args, :bar)))
1682
+
1683
+ assert_parse rb, pt
1684
+ end
1685
+
1646
1686
  def test_block_splat_reg
1647
1687
  rb = "a { |*b, c| }"
1648
1688
  pt = s(:iter, s(:call, nil, :a), s(:args, :"*b", :c))
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.6.1
4
+ version: 3.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  Y4evBVezr3SjXz08vPqRO5YRdO3zfeMT8gBjRqZjWJGMZ2lD4XNfrs7eky74CyZw
30
30
  xx3n58i0lQkBE1EpKE0lFu/y
31
31
  -----END CERTIFICATE-----
32
- date: 2014-05-12 00:00:00.000000000 Z
32
+ date: 2014-07-18 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: sexp_processor
@@ -51,14 +51,14 @@ dependencies:
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '5.3'
54
+ version: '5.4'
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '5.3'
61
+ version: '5.4'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rdoc
64
64
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file