ruby-next-parser 2.8.0.0 → 2.8.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -310,6 +310,35 @@ rule
310
310
  result = [ val[1], val[2] ]
311
311
  }
312
312
 
313
+ def_name: fname
314
+ {
315
+ @static_env.extend_static
316
+ @lexer.cmdarg.push(false)
317
+ @lexer.cond.push(false)
318
+ @current_arg_stack.push(nil)
319
+
320
+ result = val[0]
321
+ }
322
+
323
+ defn_head: kDEF def_name
324
+ {
325
+ @context.push(:def)
326
+
327
+ result = [ val[0], val[1] ]
328
+ }
329
+
330
+ defs_head: kDEF singleton dot_or_colon
331
+ {
332
+ @lexer.state = :expr_fname
333
+ }
334
+ def_name
335
+ {
336
+ @context.push(:defs)
337
+
338
+ result = [ val[0], val[1], val[2], val[4] ]
339
+ }
340
+
341
+
313
342
  command_call: command
314
343
  | block_command
315
344
 
@@ -817,6 +846,28 @@ rule
817
846
  result = @builder.ternary(val[0], val[1],
818
847
  val[2], val[4], val[5])
819
848
  }
849
+ | defn_head f_paren_args tEQL arg
850
+ {
851
+ result = @builder.def_endless_method(*val[0],
852
+ val[1], val[2], val[3])
853
+
854
+ @lexer.cmdarg.pop
855
+ @lexer.cond.pop
856
+ @static_env.unextend
857
+ @context.pop
858
+ @current_arg_stack.pop
859
+ }
860
+ | defs_head f_paren_args tEQL arg
861
+ {
862
+ result = @builder.def_endless_singleton(*val[0],
863
+ val[1], val[2], val[3])
864
+
865
+ @lexer.cmdarg.pop
866
+ @lexer.cond.pop
867
+ @static_env.unextend
868
+ @context.pop
869
+ @current_arg_stack.pop
870
+ }
820
871
  | primary
821
872
 
822
873
  relop: tGT | tLT | tGEQ | tLEQ
@@ -1224,18 +1275,10 @@ rule
1224
1275
  @lexer.cmdarg.pop
1225
1276
  @static_env.unextend
1226
1277
  }
1227
- | kDEF fname
1278
+ | defn_head f_arglist bodystmt kEND
1228
1279
  {
1229
- @static_env.extend_static
1230
- @lexer.cmdarg.push(false)
1231
- @lexer.cond.push(false)
1232
- @context.push(:def)
1233
- @current_arg_stack.push(nil)
1234
- }
1235
- f_arglist bodystmt kEND
1236
- {
1237
- result = @builder.def_method(val[0], val[1],
1238
- val[3], val[4], val[5])
1280
+ result = @builder.def_method(*val[0], val[1],
1281
+ val[2], val[3])
1239
1282
 
1240
1283
  @lexer.cmdarg.pop
1241
1284
  @lexer.cond.pop
@@ -1243,22 +1286,10 @@ rule
1243
1286
  @context.pop
1244
1287
  @current_arg_stack.pop
1245
1288
  }
1246
- | kDEF singleton dot_or_colon
1247
- {
1248
- @lexer.state = :expr_fname
1249
- }
1250
- fname
1251
- {
1252
- @static_env.extend_static
1253
- @lexer.cmdarg.push(false)
1254
- @lexer.cond.push(false)
1255
- @context.push(:defs)
1256
- @current_arg_stack.push(nil)
1257
- }
1258
- f_arglist bodystmt kEND
1289
+ | defs_head f_arglist bodystmt kEND
1259
1290
  {
1260
- result = @builder.def_singleton(val[0], val[1], val[2],
1261
- val[4], val[6], val[7], val[8])
1291
+ result = @builder.def_singleton(*val[0], val[1],
1292
+ val[2], val[3])
1262
1293
 
1263
1294
  @lexer.cmdarg.pop
1264
1295
  @lexer.cond.pop
@@ -2519,12 +2550,13 @@ keyword_variable: kNIL
2519
2550
  result = nil
2520
2551
  }
2521
2552
 
2522
- f_arglist: tLPAREN2 f_args rparen
2553
+ f_paren_args: tLPAREN2 f_args rparen
2523
2554
  {
2524
2555
  result = @builder.args(val[0], val[1], val[2])
2525
-
2526
2556
  @lexer.state = :expr_value
2527
2557
  }
2558
+
2559
+ f_arglist: f_paren_args
2528
2560
  | tLPAREN2 args_forward rparen
2529
2561
  {
2530
2562
  result = @builder.forward_args(val[0], val[1], val[2])
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: 2.8.0.0
4
+ version: 2.8.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-23 00:00:00.000000000 Z
11
+ date: 2020-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -38,6 +38,7 @@ files:
38
38
  - lib/parser/ruby-next/lexer.rl
39
39
  - lib/parser/ruby-next/meta.rb
40
40
  - lib/parser/ruby-next/parser_ext.rb
41
+ - lib/parser/ruby-next/source/map/endless_definition.rb
41
42
  - lib/parser/ruby-next/version.rb
42
43
  - lib/parser/rubynext.rb
43
44
  - lib/parser/rubynext.y