ruby-next-parser 2.8.0.0 → 2.8.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -206,8 +206,26 @@ rule
206
206
  {
207
207
  result = @builder.multi_assign(val[0], val[1], val[2])
208
208
  }
209
+ | rassign
209
210
  | expr
210
211
 
212
+ rassign: arg_value tASSOC lhs
213
+ {
214
+ result = @builder.rassign(val[0], val[1], val[2])
215
+ }
216
+ | arg_value tASSOC mlhs
217
+ {
218
+ result = @builder.multi_rassign(val[0], val[1], val[2])
219
+ }
220
+ | rassign tASSOC lhs
221
+ {
222
+ result = @builder.rassign(val[0], val[1], val[2])
223
+ }
224
+ | rassign tASSOC mlhs
225
+ {
226
+ result = @builder.multi_rassign(val[0], val[1], val[2])
227
+ }
228
+
211
229
  command_asgn: lhs tEQL command_rhs
212
230
  {
213
231
  result = @builder.assign(val[0], val[1], val[2])
@@ -310,6 +328,35 @@ rule
310
328
  result = [ val[1], val[2] ]
311
329
  }
312
330
 
331
+ def_name: fname
332
+ {
333
+ @static_env.extend_static
334
+ @lexer.cmdarg.push(false)
335
+ @lexer.cond.push(false)
336
+ @current_arg_stack.push(nil)
337
+
338
+ result = val[0]
339
+ }
340
+
341
+ defn_head: kDEF def_name
342
+ {
343
+ @context.push(:def)
344
+
345
+ result = [ val[0], val[1] ]
346
+ }
347
+
348
+ defs_head: kDEF singleton dot_or_colon
349
+ {
350
+ @lexer.state = :expr_fname
351
+ }
352
+ def_name
353
+ {
354
+ @context.push(:defs)
355
+
356
+ result = [ val[0], val[1], val[2], val[4] ]
357
+ }
358
+
359
+
313
360
  command_call: command
314
361
  | block_command
315
362
 
@@ -817,6 +864,62 @@ rule
817
864
  result = @builder.ternary(val[0], val[1],
818
865
  val[2], val[4], val[5])
819
866
  }
867
+ | defn_head f_paren_args tEQL arg
868
+ {
869
+ result = @builder.def_endless_method(*val[0],
870
+ val[1], val[2], val[3])
871
+
872
+ @lexer.cmdarg.pop
873
+ @lexer.cond.pop
874
+ @static_env.unextend
875
+ @context.pop
876
+ @current_arg_stack.pop
877
+ }
878
+ | defn_head f_paren_args tEQL arg kRESCUE_MOD arg
879
+ {
880
+ rescue_body = @builder.rescue_body(val[4],
881
+ nil, nil, nil,
882
+ nil, val[5])
883
+
884
+ method_body = @builder.begin_body(val[3], [ rescue_body ])
885
+
886
+ result = @builder.def_endless_method(*val[0],
887
+ val[1], val[2], method_body)
888
+
889
+ @lexer.cmdarg.pop
890
+ @lexer.cond.pop
891
+ @static_env.unextend
892
+ @context.pop
893
+ @current_arg_stack.pop
894
+ }
895
+ | defs_head f_paren_args tEQL arg
896
+ {
897
+ result = @builder.def_endless_singleton(*val[0],
898
+ val[1], val[2], val[3])
899
+
900
+ @lexer.cmdarg.pop
901
+ @lexer.cond.pop
902
+ @static_env.unextend
903
+ @context.pop
904
+ @current_arg_stack.pop
905
+ }
906
+ | defs_head f_paren_args tEQL arg kRESCUE_MOD arg
907
+ {
908
+ rescue_body = @builder.rescue_body(val[4],
909
+ nil, nil, nil,
910
+ nil, val[5])
911
+
912
+ method_body = @builder.begin_body(val[3], [ rescue_body ])
913
+
914
+ result = @builder.def_endless_singleton(*val[0],
915
+ val[1], val[2], method_body)
916
+
917
+ @lexer.cmdarg.pop
918
+ @lexer.cond.pop
919
+ @static_env.unextend
920
+ @context.pop
921
+ @current_arg_stack.pop
922
+ }
820
923
  | primary
821
924
 
822
925
  relop: tGT | tLT | tGEQ | tLEQ
@@ -1224,18 +1327,10 @@ rule
1224
1327
  @lexer.cmdarg.pop
1225
1328
  @static_env.unextend
1226
1329
  }
1227
- | kDEF fname
1228
- {
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
1330
+ | defn_head f_arglist bodystmt kEND
1236
1331
  {
1237
- result = @builder.def_method(val[0], val[1],
1238
- val[3], val[4], val[5])
1332
+ result = @builder.def_method(*val[0], val[1],
1333
+ val[2], val[3])
1239
1334
 
1240
1335
  @lexer.cmdarg.pop
1241
1336
  @lexer.cond.pop
@@ -1243,22 +1338,10 @@ rule
1243
1338
  @context.pop
1244
1339
  @current_arg_stack.pop
1245
1340
  }
1246
- | kDEF singleton dot_or_colon
1341
+ | defs_head f_arglist bodystmt kEND
1247
1342
  {
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
1259
- {
1260
- result = @builder.def_singleton(val[0], val[1], val[2],
1261
- val[4], val[6], val[7], val[8])
1343
+ result = @builder.def_singleton(*val[0], val[1],
1344
+ val[2], val[3])
1262
1345
 
1263
1346
  @lexer.cmdarg.pop
1264
1347
  @lexer.cond.pop
@@ -2519,7 +2602,7 @@ keyword_variable: kNIL
2519
2602
  result = nil
2520
2603
  }
2521
2604
 
2522
- f_arglist: tLPAREN2 f_args rparen
2605
+ f_paren_args: tLPAREN2 f_args rparen
2523
2606
  {
2524
2607
  result = @builder.args(val[0], val[1], val[2])
2525
2608
 
@@ -2532,6 +2615,8 @@ keyword_variable: kNIL
2532
2615
 
2533
2616
  @lexer.state = :expr_value
2534
2617
  }
2618
+
2619
+ f_arglist: f_paren_args
2535
2620
  | {
2536
2621
  result = @lexer.in_kwarg
2537
2622
  @lexer.in_kwarg = true
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.5
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-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -33,11 +33,13 @@ extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
35
  - lib/parser/ruby-next/AST_FORMAT.md
36
+ - lib/parser/ruby-next/ast/processor.rb
36
37
  - lib/parser/ruby-next/builder.rb
37
38
  - lib/parser/ruby-next/lexer.rb
38
39
  - lib/parser/ruby-next/lexer.rl
39
40
  - lib/parser/ruby-next/meta.rb
40
41
  - lib/parser/ruby-next/parser_ext.rb
42
+ - lib/parser/ruby-next/source/map/endless_definition.rb
41
43
  - lib/parser/ruby-next/version.rb
42
44
  - lib/parser/rubynext.rb
43
45
  - lib/parser/rubynext.y
@@ -55,7 +57,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
55
57
  requirements:
56
58
  - - ">="
57
59
  - !ruby/object:Gem::Version
58
- version: 2.4.0
60
+ version: 2.0.0
59
61
  required_rubygems_version: !ruby/object:Gem::Requirement
60
62
  requirements:
61
63
  - - ">="