parser 2.3.3.1 → 2.4.0.0

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: 6fe7089df6fb85523b63d43e3a2392797b918b15
4
- data.tar.gz: 984d8422f2c36a025ac342ffd121cdd050e0f6cc
3
+ metadata.gz: 255b58022cc99fb078d57e0fcc881d5892401872
4
+ data.tar.gz: e00f38a300cc9c62b6bab48a155e6dc3639e51ac
5
5
  SHA512:
6
- metadata.gz: ea6ea562998ed255c0428e547ce062eb1cfa94bb5ecc4201d7bf339cbc689d59428310f549f1e56da69880157291075bebe597ce68bd92760ad774f95db68ba2
7
- data.tar.gz: 1af370b8acdcbc65a690c98032296bd99d6d636420a7a717492fa9081b08ace7423e17349654f8a3ec09a7e72a9e43133c09d760b581d62f1c3c673a9c62621b
6
+ metadata.gz: ad1ae6b22370cd26b56a39791984aae59e440bd58ce2f738522b71224b07cf3d0db45abf4bf8b2765c659d81dfa4117f57c03da7e7696f63da9ee25389a40a88
7
+ data.tar.gz: c3e9d34d73795b90501ce47cae91886198358dd3d5bb62de1e44485b3280537463e79da30ae652c4fc21da017a9d5be0fa57a86acdcdca4439414e5049de6607
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
3
  - 1.9.2
5
4
  - 1.9.3
6
5
  - 2.0.0
@@ -1,6 +1,16 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ v2.4.0.0 (2017-02-07)
5
+ ---------------------
6
+
7
+ API modifications:
8
+ * parser/current: update for the 2.4 release. (whitequark)
9
+ * rubymotion.y: "a&.b": implement safe navigation operator in RubyMotion. (Mark Villacampa)
10
+
11
+ Bugs fixed:
12
+ * lexer.rl: "a &. b": accept &. in EXPR_ARG also. (whitequark)
13
+
4
14
  v2.3.3.1 (2016-12-02)
5
15
  ---------------------
6
16
 
@@ -122,7 +132,7 @@ Bugs fixed:
122
132
  * Add :csend to Parser::Meta::NODE_TYPES (Markus Schirp)
123
133
  * lexer/dedenter: "\<\<x\n y\\n z\nx": don't dedent after escaped newline. (whitequark)
124
134
 
125
- v2.3.3.1 (2016-01-16)
135
+ v2.4.0.0 (2016-01-16)
126
136
  ---------------------
127
137
 
128
138
  v2.3.0.1 (2016-01-14)
@@ -64,7 +64,7 @@ module Parser
64
64
  CurrentRuby = Ruby23
65
65
 
66
66
  when /^2\.4\./
67
- current_version = 'HEAD'
67
+ current_version = '2.4.0'
68
68
  if RUBY_VERSION != current_version
69
69
  warn_syntax_deviation 'parser/ruby24', current_version
70
70
  end
@@ -74,8 +74,8 @@ module Parser
74
74
 
75
75
  else # :nocov:
76
76
  # Keep this in sync with released Ruby.
77
- warn_syntax_deviation 'parser/ruby23', '2.3.x'
78
- require 'parser/ruby22'
79
- CurrentRuby = Ruby22
77
+ warn_syntax_deviation 'parser/ruby24', '2.4.x'
78
+ require 'parser/ruby24'
79
+ CurrentRuby = Ruby24
80
80
  end
81
81
  end
@@ -1490,6 +1490,8 @@ class Parser::Lexer
1490
1490
  ( '=' | c_space_nl )? |
1491
1491
  # x rescue y: Modifier keyword.
1492
1492
  w_space* keyword_modifier |
1493
+ # a &. b: Safe navigation operator.
1494
+ w_space* '&.' |
1493
1495
  # Miscellanea.
1494
1496
  w_space* punctuation_end
1495
1497
  => {
@@ -16,7 +16,7 @@ token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
16
16
  tBACK_REF2 tSYMBEG tSTRING_BEG tXSTRING_BEG tREGEXP_BEG tREGEXP_OPT
17
17
  tWORDS_BEG tQWORDS_BEG tSTRING_DBEG tSTRING_DVAR tSTRING_END
18
18
  tSTRING tSYMBOL tNL tEH tCOLON tCOMMA tSPACE tSEMI tLAMBDA tLAMBEG
19
- tCHARACTER
19
+ tCHARACTER tANDDOT
20
20
 
21
21
  prechigh
22
22
  right tBANG tTILDE tUPLUS
@@ -170,14 +170,14 @@ rule
170
170
  val[0], val[1], val[2], val[3]),
171
171
  val[4], val[5])
172
172
  }
173
- | primary_value tDOT tIDENTIFIER tOP_ASGN command_call
173
+ | primary_value call_op tIDENTIFIER tOP_ASGN command_call
174
174
  {
175
175
  result = @builder.op_assign(
176
176
  @builder.call_method(
177
177
  val[0], val[1], val[2]),
178
178
  val[3], val[4])
179
179
  }
180
- | primary_value tDOT tCONSTANT tOP_ASGN command_call
180
+ | primary_value call_op tCONSTANT tOP_ASGN command_call
181
181
  {
182
182
  result = @builder.op_assign(
183
183
  @builder.call_method(
@@ -251,7 +251,7 @@ rule
251
251
  }
252
252
 
253
253
  block_command: block_call
254
- | block_call tDOT operation2 command_args
254
+ | block_call call_op operation2 command_args
255
255
  {
256
256
  result = @builder.call_method(val[0], val[1], val[2],
257
257
  *val[3])
@@ -287,12 +287,12 @@ rule
287
287
  result = @builder.block(method_call,
288
288
  begin_t, args, body, end_t)
289
289
  }
290
- | primary_value tDOT operation2 command_args =tLOWEST
290
+ | primary_value call_op operation2 command_args =tLOWEST
291
291
  {
292
292
  result = @builder.call_method(val[0], val[1], val[2],
293
293
  *val[3])
294
294
  }
295
- | primary_value tDOT operation2 command_args cmd_brace_block
295
+ | primary_value call_op operation2 command_args cmd_brace_block
296
296
  {
297
297
  method_call = @builder.call_method(val[0], val[1], val[2],
298
298
  *val[3])
@@ -423,7 +423,7 @@ rule
423
423
  {
424
424
  result = @builder.index_asgn(val[0], val[1], val[2], val[3])
425
425
  }
426
- | primary_value tDOT tIDENTIFIER
426
+ | primary_value call_op tIDENTIFIER
427
427
  {
428
428
  result = @builder.attr_asgn(val[0], val[1], val[2])
429
429
  }
@@ -431,7 +431,7 @@ rule
431
431
  {
432
432
  result = @builder.attr_asgn(val[0], val[1], val[2])
433
433
  }
434
- | primary_value tDOT tCONSTANT
434
+ | primary_value call_op tCONSTANT
435
435
  {
436
436
  result = @builder.attr_asgn(val[0], val[1], val[2])
437
437
  }
@@ -458,7 +458,7 @@ rule
458
458
  {
459
459
  result = @builder.index_asgn(val[0], val[1], val[2], val[3])
460
460
  }
461
- | primary_value tDOT tIDENTIFIER
461
+ | primary_value call_op tIDENTIFIER
462
462
  {
463
463
  result = @builder.attr_asgn(val[0], val[1], val[2])
464
464
  }
@@ -466,7 +466,7 @@ rule
466
466
  {
467
467
  result = @builder.attr_asgn(val[0], val[1], val[2])
468
468
  }
469
- | primary_value tDOT tCONSTANT
469
+ | primary_value call_op tCONSTANT
470
470
  {
471
471
  result = @builder.attr_asgn(val[0], val[1], val[2])
472
472
  }
@@ -581,14 +581,14 @@ rule
581
581
  val[0], val[1], val[2], val[3]),
582
582
  val[4], val[5])
583
583
  }
584
- | primary_value tDOT tIDENTIFIER tOP_ASGN arg
584
+ | primary_value call_op tIDENTIFIER tOP_ASGN arg
585
585
  {
586
586
  result = @builder.op_assign(
587
587
  @builder.call_method(
588
588
  val[0], val[1], val[2]),
589
589
  val[3], val[4])
590
590
  }
591
- | primary_value tDOT tCONSTANT tOP_ASGN arg
591
+ | primary_value call_op tCONSTANT tOP_ASGN arg
592
592
  {
593
593
  result = @builder.op_assign(
594
594
  @builder.call_method(
@@ -1470,7 +1470,7 @@ rule
1470
1470
  result = @builder.block(val[0],
1471
1471
  begin_t, block_args, body, end_t)
1472
1472
  }
1473
- | block_call tDOT operation2 opt_paren_args
1473
+ | block_call call_op operation2 opt_paren_args
1474
1474
  {
1475
1475
  lparen_t, args, rparen_t = val[3]
1476
1476
  result = @builder.call_method(val[0], val[1], val[2],
@@ -1489,7 +1489,7 @@ rule
1489
1489
  result = @builder.call_method(nil, nil, val[0],
1490
1490
  lparen_t, args, rparen_t)
1491
1491
  }
1492
- | primary_value tDOT operation2 opt_paren_args
1492
+ | primary_value call_op operation2 opt_paren_args
1493
1493
  {
1494
1494
  lparen_t, args, rparen_t = val[3]
1495
1495
  result = @builder.call_method(val[0], val[1], val[2],
@@ -1505,7 +1505,7 @@ rule
1505
1505
  {
1506
1506
  result = @builder.call_method(val[0], val[1], val[2])
1507
1507
  }
1508
- | primary_value tDOT paren_args
1508
+ | primary_value call_op paren_args
1509
1509
  {
1510
1510
  lparen_t, args, rparen_t = val[2]
1511
1511
  result = @builder.call_method(val[0], val[1], nil,
@@ -2104,7 +2104,15 @@ regexp_contents: # nothing
2104
2104
  operation: tIDENTIFIER | tCONSTANT | tFID
2105
2105
  operation2: tIDENTIFIER | tCONSTANT | tFID | op
2106
2106
  operation3: tIDENTIFIER | tFID | op
2107
- dot_or_colon: tDOT | tCOLON2
2107
+ dot_or_colon: call_op | tCOLON2
2108
+ call_op: tDOT
2109
+ {
2110
+ result = [:dot, val[0][1]]
2111
+ }
2112
+ | tANDDOT
2113
+ {
2114
+ result = [:anddot, val[0][1]]
2115
+ }
2108
2116
  opt_terms: | terms
2109
2117
  opt_nl: | tNL
2110
2118
  rparen: opt_nl tRPAREN
@@ -1,3 +1,3 @@
1
1
  module Parser
2
- VERSION = '2.3.3.1'
2
+ VERSION = '2.4.0.0'
3
3
  end
@@ -231,7 +231,13 @@ class TestLexer < Minitest::Test
231
231
  assert_lex_fname "&", :tAMPER2, [0, 1]
232
232
  end
233
233
 
234
- def test_and_dot
234
+ def test_and_dot_arg
235
+ @lex.state = :expr_arg
236
+
237
+ assert_scanned "&.", :tANDDOT, "&.", [0, 2]
238
+ end
239
+
240
+ def test_and_dot_cmdarg
235
241
  @lex.state = :expr_cmdarg
236
242
 
237
243
  assert_scanned "&.", :tANDDOT, "&.", [0, 2]
@@ -3453,7 +3453,7 @@ class TestParser < Minitest::Test
3453
3453
  s(:csend, s(:send, nil, :a), :b),
3454
3454
  %q{a&.b},
3455
3455
  %q{ ^^ dot},
3456
- SINCE_2_3)
3456
+ SINCE_2_3 + %w{ios})
3457
3457
  end
3458
3458
 
3459
3459
  def test_send_attr_asgn_conditional
@@ -3461,7 +3461,7 @@ class TestParser < Minitest::Test
3461
3461
  s(:csend, s(:send, nil, :a), :b=, s(:int, 1)),
3462
3462
  %q{a&.b = 1},
3463
3463
  %q{ ^^ dot},
3464
- SINCE_2_3)
3464
+ SINCE_2_3 + %w{ios})
3465
3465
  end
3466
3466
 
3467
3467
  def test_send_block_conditional
@@ -3472,7 +3472,7 @@ class TestParser < Minitest::Test
3472
3472
  s(:args), nil),
3473
3473
  %q{foo&.bar {}},
3474
3474
  %q{},
3475
- SINCE_2_3)
3475
+ SINCE_2_3 + %w{ios})
3476
3476
  end
3477
3477
 
3478
3478
  def test_send_op_asgn_conditional
@@ -3480,7 +3480,7 @@ class TestParser < Minitest::Test
3480
3480
  s(:and_asgn, s(:csend, s(:send, nil, :a), :b), s(:int, 1)),
3481
3481
  %q{a&.b &&= 1},
3482
3482
  %q{},
3483
- SINCE_2_3)
3483
+ SINCE_2_3 + %w{ios})
3484
3484
  end
3485
3485
 
3486
3486
  def test_lvar_injecting_match
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.3.1
4
+ version: 2.4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - whitequark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-02 00:00:00.000000000 Z
11
+ date: 2017-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast
@@ -286,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
286
286
  version: '0'
287
287
  requirements: []
288
288
  rubyforge_project:
289
- rubygems_version: 2.5.1
289
+ rubygems_version: 2.5.2
290
290
  signing_key:
291
291
  specification_version: 4
292
292
  summary: A Ruby parser written in pure Ruby.
@@ -315,4 +315,3 @@ test_files:
315
315
  - test/test_source_rewriter.rb
316
316
  - test/test_source_rewriter_action.rb
317
317
  - test/test_static_environment.rb
318
- has_rdoc: yard