ruby-next-parser 3.0.0.3 → 3.0.1.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.
@@ -261,6 +261,74 @@ rule
261
261
  val[0], val[1], val[2]),
262
262
  val[3], val[4])
263
263
  }
264
+ | defn_head f_opt_paren_args tEQL command
265
+ {
266
+ _def_t, name_t = val[0]
267
+ endless_method_name(name_t)
268
+
269
+ result = @builder.def_endless_method(*val[0],
270
+ val[1], val[2], val[3])
271
+
272
+ @lexer.cmdarg.pop
273
+ @lexer.cond.pop
274
+ @static_env.unextend
275
+ @context.pop
276
+ @current_arg_stack.pop
277
+ }
278
+ | defn_head f_opt_paren_args tEQL command kRESCUE_MOD arg
279
+ {
280
+ _def_t, name_t = val[0]
281
+ endless_method_name(name_t)
282
+
283
+ rescue_body = @builder.rescue_body(val[4],
284
+ nil, nil, nil,
285
+ nil, val[5])
286
+
287
+ method_body = @builder.begin_body(val[3], [ rescue_body ])
288
+
289
+ result = @builder.def_endless_method(*val[0],
290
+ val[1], val[2], method_body)
291
+
292
+ @lexer.cmdarg.pop
293
+ @lexer.cond.pop
294
+ @static_env.unextend
295
+ @context.pop
296
+ @current_arg_stack.pop
297
+ }
298
+ | defs_head f_opt_paren_args tEQL command
299
+ {
300
+ _def_t, _recv, _dot_t, name_t = val[0]
301
+ endless_method_name(name_t)
302
+
303
+ result = @builder.def_endless_singleton(*val[0],
304
+ val[1], val[2], val[3])
305
+
306
+ @lexer.cmdarg.pop
307
+ @lexer.cond.pop
308
+ @static_env.unextend
309
+ @context.pop
310
+ @current_arg_stack.pop
311
+ }
312
+ | defs_head f_opt_paren_args tEQL command kRESCUE_MOD arg
313
+ {
314
+ _def_t, _recv, _dot_t, name_t = val[0]
315
+ endless_method_name(name_t)
316
+
317
+ rescue_body = @builder.rescue_body(val[4],
318
+ nil, nil, nil,
319
+ nil, val[5])
320
+
321
+ method_body = @builder.begin_body(val[3], [ rescue_body ])
322
+
323
+ result = @builder.def_endless_singleton(*val[0],
324
+ val[1], val[2], method_body)
325
+
326
+ @lexer.cmdarg.pop
327
+ @lexer.cond.pop
328
+ @static_env.unextend
329
+ @context.pop
330
+ @current_arg_stack.pop
331
+ }
264
332
  | backref tOP_ASGN command_rhs
265
333
  {
266
334
  @builder.op_assign(val[0], val[1], val[2])
@@ -1950,6 +2018,7 @@ opt_block_args_tail:
1950
2018
  }
1951
2019
 
1952
2020
  p_expr_basic: p_value
2021
+ | p_variable
1953
2022
  | p_const p_lparen p_args rparen
1954
2023
  {
1955
2024
  @pattern_hash_keys.pop
@@ -2195,8 +2264,8 @@ opt_block_args_tail:
2195
2264
  {
2196
2265
  result = @builder.range_exclusive(val[0], val[1], nil)
2197
2266
  }
2198
- | p_variable
2199
2267
  | p_var_ref
2268
+ | p_expr_ref
2200
2269
  | p_const
2201
2270
  | tBDOT2 p_primitive
2202
2271
  {
@@ -2236,7 +2305,11 @@ opt_block_args_tail:
2236
2305
  lvar = @builder.accessible(@builder.ident(val[1]))
2237
2306
  result = @builder.pin(val[0], lvar)
2238
2307
  }
2239
-
2308
+ p_expr_ref: tCARET tLPAREN expr_value tRPAREN
2309
+ {
2310
+ expr = @builder.begin(val[1], val[2], val[3])
2311
+ result = @builder.pin(val[0], expr)
2312
+ }
2240
2313
  p_const: tCOLON3 cname
2241
2314
  {
2242
2315
  result = @builder.const_global(val[0], val[1])
@@ -3092,7 +3165,7 @@ require 'parser/ruby-next/parser_ext'
3092
3165
  prepend Parser::NextExt
3093
3166
 
3094
3167
  def version
3095
- 30
3168
+ 31
3096
3169
  end
3097
3170
 
3098
3171
  def default_encoding
@@ -3100,7 +3173,7 @@ require 'parser/ruby-next/parser_ext'
3100
3173
  end
3101
3174
 
3102
3175
  def endless_method_name(name_t)
3103
- if name_t[0].end_with?('=')
3176
+ if !%w[=== == != <= >=].include?(name_t[0]) && name_t[0].end_with?('=')
3104
3177
  diagnostic :error, :endless_setter, nil, name_t
3105
3178
  end
3106
3179
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-next-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.3
4
+ version: 3.0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-24 00:00:00.000000000 Z
11
+ date: 2021-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -46,9 +46,9 @@ homepage: http://github.com/ruby-next/parser
46
46
  licenses:
47
47
  - MIT
48
48
  metadata:
49
- homepage_uri: http://github.com/parser/ruby-next
50
- source_code_uri: http://github.com/parser/ruby-next
51
- post_install_message:
49
+ homepage_uri: http://github.com/ruby-next/parser
50
+ source_code_uri: http://github.com/ruby-next/parser
51
+ post_install_message:
52
52
  rdoc_options: []
53
53
  require_paths:
54
54
  - lib
@@ -63,8 +63,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0'
65
65
  requirements: []
66
- rubygems_version: 3.0.6
67
- signing_key:
66
+ rubygems_version: 3.2.15
67
+ signing_key:
68
68
  specification_version: 4
69
69
  summary: Parser extension to support edge and experimental Ruby syntax
70
70
  test_files: []