ruby_parser 3.20.2 → 3.20.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ecb31322a35ef752328921f895d350d220a56e7ed6fb36462742fefc7962f55
4
- data.tar.gz: aac07b5fa420c5d9c86c8b32c9d0232f1760c16354a9765530a6a1a87a209cfa
3
+ metadata.gz: 4c0c3e107b8953bdbaf64c24c32d5428696fa648398c4fdc896cba560547341b
4
+ data.tar.gz: b268454b6584eee700d5d90e37c7986e252a024b89422d47db69d5c0cfd7f917
5
5
  SHA512:
6
- metadata.gz: 51239eb0334a8fbc60f6e7a8011853a126f3c6db1889bc5204652a7f0d33791f7d704ed0334a5061deb08e4a82fd10a299565e71cc2861b6a869a718dd87057c
7
- data.tar.gz: acfd8ce38fdbea35fbb89664e445deee0c2ab686e0fb5e4db3cc151f42ef6305c412939ce2e77a95e66d9bd2856e33d1098c0d12cb05eb99b82616bda5f444d2
6
+ metadata.gz: f466e027ad5467b7a799a44378756fb082cd86d59c7696815347af2be9360b21f2ff9f5f5e8687b7073cc9ab2432330808a07eaee57e8802783ffe6b6a16b602
7
+ data.tar.gz: 8eb1af21a6936f44bcc8ea42b8dae4773e1a86a8e4815c67a536e1d10363e5c95123d77c04402f156e8f9e7b786b21ff382d3134a650c6428f903552a61ec495
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,15 @@
1
+ === 3.20.3 / 2023-07-11
2
+
3
+ * 2 minor enhancements:
4
+
5
+ * Added Parser#in_argdef and integrated into 3.x parsers.
6
+ * Improved tools/munge.rb to handler MRI 3.2 output
7
+
8
+ * 2 bug fixes:
9
+
10
+ * Fixed process_dots to properly deal with paren-less forward_args. (eric1234)
11
+ * Fixed tools/ripper.rb to properly print ripper sexp at the end
12
+
1
13
  === 3.20.2 / 2023-06-06
2
14
 
3
15
  * 1 bug fix:
data/lib/ruby30_parser.rb CHANGED
@@ -8013,7 +8013,7 @@ racc_reduce_table = [
8013
8013
  3, 395, :_reduce_692,
8014
8014
  1, 309, :_reduce_693,
8015
8015
  3, 309, :_reduce_694,
8016
- 1, 396, :_reduce_none,
8016
+ 1, 396, :_reduce_695,
8017
8017
  2, 397, :_reduce_696,
8018
8018
  1, 397, :_reduce_697,
8019
8019
  2, 398, :_reduce_698,
@@ -9109,6 +9109,7 @@ end
9109
9109
 
9110
9110
  def _reduce_64(val, _values, result)
9111
9111
  lexer.lex_state = EXPR_FNAME
9112
+ self.in_argdef = true
9112
9113
 
9113
9114
  result
9114
9115
  end
@@ -10806,6 +10807,7 @@ end
10806
10807
 
10807
10808
  def _reduce_366(val, _values, result)
10808
10809
  self.comments.push self.lexer.comments
10810
+ self.in_argdef = true
10809
10811
 
10810
10812
  result
10811
10813
  end
@@ -11105,6 +11107,7 @@ end
11105
11107
  def _reduce_424(val, _values, result)
11106
11108
  # TODO: current_arg = 0
11107
11109
  result = args val
11110
+ self.in_argdef = false
11108
11111
 
11109
11112
  result
11110
11113
  end
@@ -11120,6 +11123,7 @@ end
11120
11123
  def _reduce_426(val, _values, result)
11121
11124
  # TODO: current_arg = 0
11122
11125
  result = args val
11126
+ self.in_argdef = false
11123
11127
 
11124
11128
  result
11125
11129
  end
@@ -11182,12 +11186,14 @@ def _reduce_435(val, _values, result)
11182
11186
  end
11183
11187
 
11184
11188
  def _reduce_436(val, _values, result)
11189
+ self.in_argdef = false
11185
11190
  result = args val
11186
11191
 
11187
11192
  result
11188
11193
  end
11189
11194
 
11190
11195
  def _reduce_437(val, _values, result)
11196
+ self.in_argdef = false
11191
11197
  result = val[0]
11192
11198
  result = 0 if result == s(:args)
11193
11199
 
@@ -12678,12 +12684,14 @@ end
12678
12684
  # reduce 654 omitted
12679
12685
 
12680
12686
  def _reduce_655(val, _values, result)
12687
+ self.in_argdef = false
12681
12688
  result = end_args val
12682
12689
 
12683
12690
  result
12684
12691
  end
12685
12692
 
12686
12693
  def _reduce_656(val, _values, result)
12694
+ self.in_argdef = false
12687
12695
  result = end_args val
12688
12696
 
12689
12697
  result
@@ -12706,12 +12714,14 @@ end
12706
12714
  def _reduce_660(val, _values, result)
12707
12715
  result = self.in_kwarg
12708
12716
  self.in_kwarg = true
12717
+ self.in_argdef = true
12709
12718
  self.lexer.lex_state |= EXPR_LABEL
12710
12719
 
12711
12720
  result
12712
12721
  end
12713
12722
 
12714
12723
  def _reduce_661(val, _values, result)
12724
+ self.in_argdef = false
12715
12725
  result = end_args val
12716
12726
 
12717
12727
  result
@@ -12921,7 +12931,16 @@ def _reduce_694(val, _values, result)
12921
12931
  result
12922
12932
  end
12923
12933
 
12924
- # reduce 695 omitted
12934
+ def _reduce_695(val, _values, result)
12935
+ label, = val
12936
+ # arg_var(p, formal_argument(p, $1));
12937
+ # p->cur_arg = get_id($1);
12938
+ # p->max_numparam = ORDINAL_PARAM;
12939
+ self.in_argdef = false
12940
+ result = label
12941
+
12942
+ result
12943
+ end
12925
12944
 
12926
12945
  def _reduce_696(val, _values, result)
12927
12946
  # TODO: new_kw_arg
@@ -12929,6 +12948,7 @@ def _reduce_696(val, _values, result)
12929
12948
 
12930
12949
  identifier = label.to_sym
12931
12950
  self.env[identifier] = :lvar
12951
+ self.in_argdef = true
12932
12952
 
12933
12953
  kwarg = s(:kwarg, identifier, arg).line line
12934
12954
  result = s(:array, kwarg).line line
@@ -12941,6 +12961,7 @@ def _reduce_697(val, _values, result)
12941
12961
 
12942
12962
  id = label.to_sym
12943
12963
  self.env[id] = :lvar
12964
+ self.in_argdef = true
12944
12965
 
12945
12966
  result = s(:array, s(:kwarg, id).line(line)).line line
12946
12967
 
@@ -12952,6 +12973,7 @@ def _reduce_698(val, _values, result)
12952
12973
  (label, line), expr = val
12953
12974
  id = label.to_sym
12954
12975
  self.env[id] = :lvar
12976
+ self.in_argdef = true
12955
12977
 
12956
12978
  result = s(:array, s(:kwarg, id, expr).line(line)).line line
12957
12979
 
@@ -12963,6 +12985,7 @@ def _reduce_699(val, _values, result)
12963
12985
  (label, line), = val
12964
12986
  id = label.to_sym
12965
12987
  self.env[id] = :lvar
12988
+ self.in_argdef = true
12966
12989
 
12967
12990
  result = s(:array, s(:kwarg, id).line(line)).line line
12968
12991
 
@@ -13018,19 +13041,19 @@ end
13018
13041
 
13019
13042
  def _reduce_709(val, _values, result)
13020
13043
  lhs, _, rhs = val
13044
+ self.in_argdef = true
13021
13045
  result = self.assignable lhs, rhs
13022
13046
  # TODO: detect duplicate names
13023
13047
  # TODO? p->cur_arg = 0;
13024
- # TODO? p->ctxt.in_argdef = 1;
13025
13048
 
13026
13049
  result
13027
13050
  end
13028
13051
 
13029
13052
  def _reduce_710(val, _values, result)
13030
13053
  lhs, _, rhs = val
13054
+ self.in_argdef = true
13031
13055
  result = self.assignable lhs, rhs
13032
13056
  # TODO? p->cur_arg = 0;
13033
- # TODO? p->ctxt.in_argdef = 1;
13034
13057
 
13035
13058
  result
13036
13059
  end
data/lib/ruby30_parser.y CHANGED
@@ -392,6 +392,7 @@ rule
392
392
  defs_head: k_def singleton dot_or_colon
393
393
  {
394
394
  lexer.lex_state = EXPR_FNAME
395
+ self.in_argdef = true
395
396
  }
396
397
  def_name
397
398
  {
@@ -1588,6 +1589,7 @@ rule
1588
1589
  k_def: kDEF
1589
1590
  {
1590
1591
  self.comments.push self.lexer.comments
1592
+ self.in_argdef = true
1591
1593
  }
1592
1594
  k_do: kDO
1593
1595
  k_do_block: kDO_BLOCK
@@ -1806,6 +1808,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1806
1808
  {
1807
1809
  # TODO: current_arg = 0
1808
1810
  result = args val
1811
+ self.in_argdef = false
1809
1812
  }
1810
1813
  | tOROP
1811
1814
  {
@@ -1817,6 +1820,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1817
1820
  {
1818
1821
  # TODO: current_arg = 0
1819
1822
  result = args val
1823
+ self.in_argdef = false
1820
1824
  }
1821
1825
 
1822
1826
  opt_bv_decl: opt_nl
@@ -1866,10 +1870,12 @@ opt_block_args_tail: tCOMMA block_args_tail
1866
1870
 
1867
1871
  f_larglist: tLPAREN2 f_args opt_bv_decl rparen
1868
1872
  {
1873
+ self.in_argdef = false
1869
1874
  result = args val
1870
1875
  }
1871
1876
  | f_args
1872
1877
  {
1878
+ self.in_argdef = false
1873
1879
  result = val[0]
1874
1880
  result = 0 if result == s(:args)
1875
1881
  }
@@ -3027,11 +3033,13 @@ keyword_variable: kNIL { (_, line), = val; result = s(:nil).line line }
3027
3033
  f_opt_paren_args: f_paren_args
3028
3034
  | none
3029
3035
  {
3036
+ self.in_argdef = false
3030
3037
  result = end_args val
3031
3038
  }
3032
3039
 
3033
3040
  f_paren_args: tLPAREN2 f_args rparen
3034
3041
  {
3042
+ self.in_argdef = false
3035
3043
  result = end_args val
3036
3044
  }
3037
3045
  | tLPAREN2 f_arg tCOMMA args_forward rparen
@@ -3047,10 +3055,12 @@ f_opt_paren_args: f_paren_args
3047
3055
  | {
3048
3056
  result = self.in_kwarg
3049
3057
  self.in_kwarg = true
3058
+ self.in_argdef = true
3050
3059
  self.lexer.lex_state |= EXPR_LABEL
3051
3060
  }
3052
3061
  f_args term
3053
3062
  {
3063
+ self.in_argdef = false
3054
3064
  result = end_args val
3055
3065
  }
3056
3066
 
@@ -3206,6 +3216,14 @@ f_opt_paren_args: f_paren_args
3206
3216
  }
3207
3217
 
3208
3218
  f_label: tLABEL
3219
+ {
3220
+ label, = val
3221
+ # arg_var(p, formal_argument(p, $1));
3222
+ # p->cur_arg = get_id($1);
3223
+ # p->max_numparam = ORDINAL_PARAM;
3224
+ self.in_argdef = false
3225
+ result = label
3226
+ }
3209
3227
 
3210
3228
  f_kw: f_label arg_value
3211
3229
  {
@@ -3214,6 +3232,7 @@ f_opt_paren_args: f_paren_args
3214
3232
 
3215
3233
  identifier = label.to_sym
3216
3234
  self.env[identifier] = :lvar
3235
+ self.in_argdef = true
3217
3236
 
3218
3237
  kwarg = s(:kwarg, identifier, arg).line line
3219
3238
  result = s(:array, kwarg).line line
@@ -3224,6 +3243,7 @@ f_opt_paren_args: f_paren_args
3224
3243
 
3225
3244
  id = label.to_sym
3226
3245
  self.env[id] = :lvar
3246
+ self.in_argdef = true
3227
3247
 
3228
3248
  result = s(:array, s(:kwarg, id).line(line)).line line
3229
3249
  }
@@ -3234,6 +3254,7 @@ f_opt_paren_args: f_paren_args
3234
3254
  (label, line), expr = val
3235
3255
  id = label.to_sym
3236
3256
  self.env[id] = :lvar
3257
+ self.in_argdef = true
3237
3258
 
3238
3259
  result = s(:array, s(:kwarg, id, expr).line(line)).line line
3239
3260
  }
@@ -3243,6 +3264,7 @@ f_opt_paren_args: f_paren_args
3243
3264
  (label, line), = val
3244
3265
  id = label.to_sym
3245
3266
  self.env[id] = :lvar
3267
+ self.in_argdef = true
3246
3268
 
3247
3269
  result = s(:array, s(:kwarg, id).line(line)).line line
3248
3270
  }
@@ -3290,10 +3312,10 @@ f_opt_paren_args: f_paren_args
3290
3312
  arg_value
3291
3313
  {
3292
3314
  lhs, _, rhs = val
3315
+ self.in_argdef = true
3293
3316
  result = self.assignable lhs, rhs
3294
3317
  # TODO: detect duplicate names
3295
3318
  # TODO? p->cur_arg = 0;
3296
- # TODO? p->ctxt.in_argdef = 1;
3297
3319
  }
3298
3320
 
3299
3321
  f_block_opt: f_arg_asgn
@@ -3301,9 +3323,9 @@ f_opt_paren_args: f_paren_args
3301
3323
  primary_value
3302
3324
  {
3303
3325
  lhs, _, rhs = val
3326
+ self.in_argdef = true
3304
3327
  result = self.assignable lhs, rhs
3305
3328
  # TODO? p->cur_arg = 0;
3306
- # TODO? p->ctxt.in_argdef = 1;
3307
3329
  }
3308
3330
 
3309
3331
  f_block_optarg: f_block_opt