parser 2.3.1.0 → 2.3.1.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
  SHA1:
3
- metadata.gz: 9403827537b14d96c76aee39812704f453daf0fd
4
- data.tar.gz: 3e2fa957c7c68533af47e28e4c2e48fef5a28a14
3
+ metadata.gz: 87c2540f2a9f9c12e30397074ff44b6dc26326d8
4
+ data.tar.gz: 2d7dcc34d13dea8bd26ad5d2c3255da9458b694b
5
5
  SHA512:
6
- metadata.gz: f5e0f974c0a580cd610c166a61eb6c65f9cb3c5458e4c759abb9c3858b2aa5772824d6b00d53707b5dca0cb6eab4d20d444d8b8cdb0a4705263ef3ea615c763c
7
- data.tar.gz: 893aaddd0619465fd746ba816773f6add95a7e0e98e3090236e4cb0277bd600fcd10ecb41ec1f0a0da1077436ff479bc06791f8ad3fd1cfa3331a54398e73adb
6
+ metadata.gz: 3e8bbcc8a395ab2329190d5ed71baf2a9a24f1fcd548c1470a638fb9ed3364b44d1689699a29eaf5283420650e25cb94753f7b9c8dc7846e9a7e4c144ff443df
7
+ data.tar.gz: b224cee755968eeb44a1220afb6d1ed29559273c1178ae0783225542acd2bde2fc06d99e1cc3a65a01c055bbe34d251197e608564ba5b02805ac8a43783a9263
data/.gitignore CHANGED
@@ -16,6 +16,8 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  *.output
19
+ .ruby-version
20
+ .ruby-gemset
19
21
  lib/parser/lexer.rb
20
22
  lib/parser/ruby18.rb
21
23
  lib/parser/ruby19.rb
@@ -1,6 +1,15 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ v2.3.1.1 (2016-06-01)
5
+ ---------------------
6
+
7
+ Bugs fixed:
8
+ * ruby{^18}.y: "lambda{|;a|a}": treat shadowarg as local inside block. (Ilya Bylich)
9
+ * Builders::Default: "foo&.bar{}": emit csend in block properly. (whitequark)
10
+ * runner.rb: re-add --23 (cremno)
11
+ * runner.rb: make --24 actually use the 2.4 parser (cremno)
12
+
4
13
  v2.3.1.0 (2016-04-27)
5
14
  ---------------------
6
15
 
@@ -54,7 +63,7 @@ Bugs fixed:
54
63
  * Add :csend to Parser::Meta::NODE_TYPES (Markus Schirp)
55
64
  * lexer/dedenter: "\<\<x\n y\\n z\nx": don't dedent after escaped newline. (whitequark)
56
65
 
57
- v2.3.1.0 (2016-01-16)
66
+ v2.3.1.1 (2016-01-16)
58
67
  ---------------------
59
68
 
60
69
  v2.3.0.1 (2016-01-14)
data/Rakefile CHANGED
@@ -148,6 +148,7 @@ rule '.rb' => '.y' do |t|
148
148
  t.source,
149
149
  "-o", t.name
150
150
  ]
151
+ opts << "--no-line-convert" unless ENV['RACC_DEBUG']
151
152
  opts << "--debug" if ENV['RACC_DEBUG']
152
153
 
153
154
  sh "racc", *opts
@@ -749,7 +749,7 @@ module Parser
749
749
  diagnostic :error, :block_and_blockarg, nil, last_arg.loc.expression, [loc(begin_t)]
750
750
  end
751
751
 
752
- if [:send, :super, :zsuper, :lambda].include?(method_call.type)
752
+ if [:send, :csend, :super, :zsuper, :lambda].include?(method_call.type)
753
753
  n(:block, [ method_call, args, body ],
754
754
  block_map(method_call.loc.expression, begin_t, end_t))
755
755
  else
@@ -78,7 +78,7 @@ module Parser
78
78
  !heredoc?)
79
79
 
80
80
  # Capture opening delimiter in percent-literals.
81
- @str_type << delimiter if @str_type.start_with?('%'.freeze)
81
+ @str_type += delimiter if @str_type.start_with?('%'.freeze)
82
82
 
83
83
  clear_buffer
84
84
 
@@ -187,7 +187,7 @@ module Parser
187
187
  @buffer_s ||= ts
188
188
  @buffer_e = te
189
189
 
190
- @buffer << string
190
+ @buffer += string
191
191
  end
192
192
 
193
193
  def flush_string
@@ -1443,6 +1443,7 @@ rule
1443
1443
 
1444
1444
  bvar: tIDENTIFIER
1445
1445
  {
1446
+ @static_env.declare val[0][0]
1446
1447
  result = @builder.shadowarg(val[0])
1447
1448
  }
1448
1449
  | f_bad_arg
@@ -1423,6 +1423,7 @@ rule
1423
1423
 
1424
1424
  bvar: tIDENTIFIER
1425
1425
  {
1426
+ @static_env.declare val[0][0]
1426
1427
  result = @builder.shadowarg(val[0])
1427
1428
  }
1428
1429
  | f_bad_arg
@@ -1475,6 +1475,7 @@ opt_block_args_tail:
1475
1475
 
1476
1476
  bvar: tIDENTIFIER
1477
1477
  {
1478
+ @static_env.declare val[0][0]
1478
1479
  result = @builder.shadowarg(val[0])
1479
1480
  }
1480
1481
  | f_bad_arg
@@ -1455,6 +1455,7 @@ opt_block_args_tail:
1455
1455
 
1456
1456
  bvar: tIDENTIFIER
1457
1457
  {
1458
+ @static_env.declare val[0][0]
1458
1459
  result = @builder.shadowarg(val[0])
1459
1460
  }
1460
1461
  | f_bad_arg
@@ -1454,6 +1454,7 @@ opt_block_args_tail:
1454
1454
 
1455
1455
  bvar: tIDENTIFIER
1456
1456
  {
1457
+ @static_env.declare val[0][0]
1457
1458
  result = @builder.shadowarg(val[0])
1458
1459
  }
1459
1460
  | f_bad_arg
@@ -1454,6 +1454,7 @@ opt_block_args_tail:
1454
1454
 
1455
1455
  bvar: tIDENTIFIER
1456
1456
  {
1457
+ @static_env.declare val[0][0]
1457
1458
  result = @builder.shadowarg(val[0])
1458
1459
  }
1459
1460
  | f_bad_arg
@@ -1454,6 +1454,7 @@ opt_block_args_tail:
1454
1454
 
1455
1455
  bvar: tIDENTIFIER
1456
1456
  {
1457
+ @static_env.declare val[0][0]
1457
1458
  result = @builder.shadowarg(val[0])
1458
1459
  }
1459
1460
  | f_bad_arg
@@ -1416,6 +1416,7 @@ rule
1416
1416
 
1417
1417
  bvar: tIDENTIFIER
1418
1418
  {
1419
+ @static_env.declare val[0][0]
1419
1420
  result = @builder.shadowarg(val[0])
1420
1421
  }
1421
1422
  | f_bad_arg
@@ -84,9 +84,14 @@ module Parser
84
84
  @parser_class = Parser::Ruby22
85
85
  end
86
86
 
87
+ opts.on '--23', 'Parse as Ruby 2.3 would' do
88
+ require 'parser/ruby23'
89
+ @parser_class = Parser::Ruby23
90
+ end
91
+
87
92
  opts.on '--24', 'Parse as Ruby 2.4 would' do
88
93
  require 'parser/ruby24'
89
- @parser_class = Parser::Ruby23
94
+ @parser_class = Parser::Ruby24
90
95
  end
91
96
 
92
97
  opts.on '--mac', 'Parse as MacRuby 0.12 would' do
@@ -1,3 +1,3 @@
1
1
  module Parser
2
- VERSION = '2.3.1.0'
2
+ VERSION = '2.3.1.1'
3
3
  end
@@ -2026,6 +2026,15 @@ class TestParser < Minitest::Test
2026
2026
  %q{def f(var: defined?(var)) var end},
2027
2027
  %q{},
2028
2028
  ALL_VERSIONS - %w(1.8 1.9 mac ios 2.0))
2029
+
2030
+ assert_parses(
2031
+ s(:block,
2032
+ s(:send, nil, :lambda),
2033
+ s(:args, s(:shadowarg, :a)),
2034
+ s(:lvar, :a)),
2035
+ %q{lambda{|;a|a}},
2036
+ %q{},
2037
+ ALL_VERSIONS - %w(1.8))
2029
2038
  end
2030
2039
 
2031
2040
  def assert_parses_args(ast, code, versions=ALL_VERSIONS)
@@ -3416,6 +3425,17 @@ class TestParser < Minitest::Test
3416
3425
  ALL_VERSIONS - %w(1.8 1.9 2.0 2.1 2.2 ios mac))
3417
3426
  end
3418
3427
 
3428
+ def test_send_block_conditional
3429
+ assert_parses(
3430
+ s(:block,
3431
+ s(:csend,
3432
+ s(:lvar, :foo), :bar),
3433
+ s(:args), nil),
3434
+ %q{foo&.bar {}},
3435
+ %q{},
3436
+ ALL_VERSIONS - %w(1.8 1.9 2.0 2.1 2.2 ios mac))
3437
+ end
3438
+
3419
3439
  def test_lvar_injecting_match
3420
3440
  assert_parses(
3421
3441
  s(:begin,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1.0
4
+ version: 2.3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - whitequark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-27 00:00:00.000000000 Z
11
+ date: 2016-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast