prism 1.4.0 → 1.6.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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +51 -1
  3. data/Makefile +4 -2
  4. data/README.md +2 -0
  5. data/config.yml +266 -38
  6. data/docs/design.md +2 -2
  7. data/docs/parser_translation.md +8 -23
  8. data/docs/releasing.md +5 -24
  9. data/docs/ripper_translation.md +1 -1
  10. data/ext/prism/api_node.c +2 -0
  11. data/ext/prism/extension.c +25 -3
  12. data/ext/prism/extension.h +1 -1
  13. data/include/prism/ast.h +306 -50
  14. data/include/prism/diagnostic.h +5 -0
  15. data/include/prism/options.h +43 -3
  16. data/include/prism/regexp.h +2 -2
  17. data/include/prism/util/pm_buffer.h +8 -0
  18. data/include/prism/util/pm_integer.h +4 -0
  19. data/include/prism/util/pm_list.h +6 -0
  20. data/include/prism/util/pm_string.h +12 -2
  21. data/include/prism/version.h +2 -2
  22. data/include/prism.h +39 -14
  23. data/lib/prism/compiler.rb +456 -151
  24. data/lib/prism/desugar_compiler.rb +1 -0
  25. data/lib/prism/dispatcher.rb +16 -0
  26. data/lib/prism/dot_visitor.rb +5 -1
  27. data/lib/prism/dsl.rb +3 -0
  28. data/lib/prism/ffi.rb +25 -9
  29. data/lib/prism/inspect_visitor.rb +3 -0
  30. data/lib/prism/lex_compat.rb +1 -0
  31. data/lib/prism/mutation_compiler.rb +3 -0
  32. data/lib/prism/node.rb +507 -336
  33. data/lib/prism/node_ext.rb +4 -1
  34. data/lib/prism/pack.rb +2 -0
  35. data/lib/prism/parse_result/comments.rb +1 -0
  36. data/lib/prism/parse_result/errors.rb +1 -0
  37. data/lib/prism/parse_result/newlines.rb +1 -0
  38. data/lib/prism/parse_result.rb +1 -0
  39. data/lib/prism/pattern.rb +1 -0
  40. data/lib/prism/polyfill/scan_byte.rb +14 -0
  41. data/lib/prism/polyfill/warn.rb +36 -0
  42. data/lib/prism/reflection.rb +3 -0
  43. data/lib/prism/relocation.rb +1 -0
  44. data/lib/prism/serialize.rb +25 -19
  45. data/lib/prism/string_query.rb +1 -0
  46. data/lib/prism/translation/parser/builder.rb +1 -0
  47. data/lib/prism/translation/parser/compiler.rb +47 -25
  48. data/lib/prism/translation/parser/lexer.rb +29 -21
  49. data/lib/prism/translation/parser.rb +21 -2
  50. data/lib/prism/translation/parser33.rb +1 -0
  51. data/lib/prism/translation/parser34.rb +1 -0
  52. data/lib/prism/translation/parser35.rb +1 -0
  53. data/lib/prism/translation/parser_current.rb +24 -0
  54. data/lib/prism/translation/ripper/sexp.rb +1 -0
  55. data/lib/prism/translation/ripper.rb +17 -1
  56. data/lib/prism/translation/ruby_parser.rb +287 -4
  57. data/lib/prism/translation.rb +2 -0
  58. data/lib/prism/visitor.rb +457 -152
  59. data/lib/prism.rb +23 -0
  60. data/prism.gemspec +5 -1
  61. data/rbi/prism/dsl.rbi +3 -3
  62. data/rbi/prism/node.rbi +21 -9
  63. data/sig/prism/dispatcher.rbs +3 -0
  64. data/sig/prism/dsl.rbs +3 -3
  65. data/sig/prism/node.rbs +444 -30
  66. data/sig/prism/node_ext.rbs +84 -17
  67. data/sig/prism/parse_result/comments.rbs +38 -0
  68. data/sig/prism/parse_result.rbs +4 -0
  69. data/sig/prism/reflection.rbs +1 -1
  70. data/sig/prism.rbs +4 -0
  71. data/src/diagnostic.c +9 -1
  72. data/src/node.c +2 -0
  73. data/src/options.c +2 -2
  74. data/src/prettyprint.c +2 -0
  75. data/src/prism.c +324 -147
  76. data/src/serialize.c +2 -0
  77. data/src/token_type.c +36 -34
  78. data/src/util/pm_string.c +6 -8
  79. metadata +7 -3
data/include/prism/ast.h CHANGED
@@ -1,3 +1,5 @@
1
+ /* :markup: markdown */
2
+
1
3
  /*----------------------------------------------------------------------------*/
2
4
  /* This file is generated by the templates/template.rb script and should not */
3
5
  /* be modified manually. See */
@@ -10,6 +12,8 @@
10
12
  * @file ast.h
11
13
  *
12
14
  * The abstract syntax tree.
15
+ *
16
+ * --
13
17
  */
14
18
  #ifndef PRISM_AST_H
15
19
  #define PRISM_AST_H
@@ -30,11 +34,50 @@ typedef enum pm_token_type {
30
34
  /** final token in the file */
31
35
  PM_TOKEN_EOF = 1,
32
36
 
33
- /** a token that was expected but not found */
34
- PM_TOKEN_MISSING,
37
+ /** } */
38
+ PM_TOKEN_BRACE_RIGHT,
35
39
 
36
- /** a token that was not present but it is okay */
37
- PM_TOKEN_NOT_PROVIDED,
40
+ /** , */
41
+ PM_TOKEN_COMMA,
42
+
43
+ /** } */
44
+ PM_TOKEN_EMBEXPR_END,
45
+
46
+ /** do */
47
+ PM_TOKEN_KEYWORD_DO,
48
+
49
+ /** else */
50
+ PM_TOKEN_KEYWORD_ELSE,
51
+
52
+ /** elsif */
53
+ PM_TOKEN_KEYWORD_ELSIF,
54
+
55
+ /** end */
56
+ PM_TOKEN_KEYWORD_END,
57
+
58
+ /** ensure */
59
+ PM_TOKEN_KEYWORD_ENSURE,
60
+
61
+ /** in */
62
+ PM_TOKEN_KEYWORD_IN,
63
+
64
+ /** rescue */
65
+ PM_TOKEN_KEYWORD_RESCUE,
66
+
67
+ /** then */
68
+ PM_TOKEN_KEYWORD_THEN,
69
+
70
+ /** when */
71
+ PM_TOKEN_KEYWORD_WHEN,
72
+
73
+ /** a newline character outside of other tokens */
74
+ PM_TOKEN_NEWLINE,
75
+
76
+ /** ) */
77
+ PM_TOKEN_PARENTHESIS_RIGHT,
78
+
79
+ /** ; */
80
+ PM_TOKEN_SEMICOLON,
38
81
 
39
82
  /** & */
40
83
  PM_TOKEN_AMPERSAND,
@@ -69,9 +112,6 @@ typedef enum pm_token_type {
69
112
  /** { */
70
113
  PM_TOKEN_BRACE_LEFT,
71
114
 
72
- /** } */
73
- PM_TOKEN_BRACE_RIGHT,
74
-
75
115
  /** [ */
76
116
  PM_TOKEN_BRACKET_LEFT,
77
117
 
@@ -105,9 +145,6 @@ typedef enum pm_token_type {
105
145
  /** :: */
106
146
  PM_TOKEN_COLON_COLON,
107
147
 
108
- /** , */
109
- PM_TOKEN_COMMA,
110
-
111
148
  /** a comment */
112
149
  PM_TOKEN_COMMENT,
113
150
 
@@ -135,9 +172,6 @@ typedef enum pm_token_type {
135
172
  /** #{ */
136
173
  PM_TOKEN_EMBEXPR_BEGIN,
137
174
 
138
- /** } */
139
- PM_TOKEN_EMBEXPR_END,
140
-
141
175
  /** # */
142
176
  PM_TOKEN_EMBVAR,
143
177
 
@@ -237,27 +271,12 @@ typedef enum pm_token_type {
237
271
  /** defined? */
238
272
  PM_TOKEN_KEYWORD_DEFINED,
239
273
 
240
- /** do */
241
- PM_TOKEN_KEYWORD_DO,
242
-
243
274
  /** do keyword for a predicate in a while, until, or for loop */
244
275
  PM_TOKEN_KEYWORD_DO_LOOP,
245
276
 
246
- /** else */
247
- PM_TOKEN_KEYWORD_ELSE,
248
-
249
- /** elsif */
250
- PM_TOKEN_KEYWORD_ELSIF,
251
-
252
- /** end */
253
- PM_TOKEN_KEYWORD_END,
254
-
255
277
  /** END */
256
278
  PM_TOKEN_KEYWORD_END_UPCASE,
257
279
 
258
- /** ensure */
259
- PM_TOKEN_KEYWORD_ENSURE,
260
-
261
280
  /** false */
262
281
  PM_TOKEN_KEYWORD_FALSE,
263
282
 
@@ -270,9 +289,6 @@ typedef enum pm_token_type {
270
289
  /** if in the modifier form */
271
290
  PM_TOKEN_KEYWORD_IF_MODIFIER,
272
291
 
273
- /** in */
274
- PM_TOKEN_KEYWORD_IN,
275
-
276
292
  /** module */
277
293
  PM_TOKEN_KEYWORD_MODULE,
278
294
 
@@ -291,9 +307,6 @@ typedef enum pm_token_type {
291
307
  /** redo */
292
308
  PM_TOKEN_KEYWORD_REDO,
293
309
 
294
- /** rescue */
295
- PM_TOKEN_KEYWORD_RESCUE,
296
-
297
310
  /** rescue in the modifier form */
298
311
  PM_TOKEN_KEYWORD_RESCUE_MODIFIER,
299
312
 
@@ -309,9 +322,6 @@ typedef enum pm_token_type {
309
322
  /** super */
310
323
  PM_TOKEN_KEYWORD_SUPER,
311
324
 
312
- /** then */
313
- PM_TOKEN_KEYWORD_THEN,
314
-
315
325
  /** true */
316
326
  PM_TOKEN_KEYWORD_TRUE,
317
327
 
@@ -330,9 +340,6 @@ typedef enum pm_token_type {
330
340
  /** until in the modifier form */
331
341
  PM_TOKEN_KEYWORD_UNTIL_MODIFIER,
332
342
 
333
- /** when */
334
- PM_TOKEN_KEYWORD_WHEN,
335
-
336
343
  /** while */
337
344
  PM_TOKEN_KEYWORD_WHILE,
338
345
 
@@ -387,9 +394,6 @@ typedef enum pm_token_type {
387
394
  /** -> */
388
395
  PM_TOKEN_MINUS_GREATER,
389
396
 
390
- /** a newline character outside of other tokens */
391
- PM_TOKEN_NEWLINE,
392
-
393
397
  /** a numbered reference to a capture group in the previous regular expression match */
394
398
  PM_TOKEN_NUMBERED_REFERENCE,
395
399
 
@@ -399,9 +403,6 @@ typedef enum pm_token_type {
399
403
  /** ( for a parentheses node */
400
404
  PM_TOKEN_PARENTHESIS_LEFT_PARENTHESES,
401
405
 
402
- /** ) */
403
- PM_TOKEN_PARENTHESIS_RIGHT,
404
-
405
406
  /** % */
406
407
  PM_TOKEN_PERCENT,
407
408
 
@@ -450,9 +451,6 @@ typedef enum pm_token_type {
450
451
  /** the end of a regular expression */
451
452
  PM_TOKEN_REGEXP_END,
452
453
 
453
- /** ; */
454
- PM_TOKEN_SEMICOLON,
455
-
456
454
  /** / */
457
455
  PM_TOKEN_SLASH,
458
456
 
@@ -519,6 +517,12 @@ typedef enum pm_token_type {
519
517
  /** marker for the point in the file at which the parser should stop */
520
518
  PM_TOKEN___END__,
521
519
 
520
+ /** a token that was expected but not found */
521
+ PM_TOKEN_MISSING,
522
+
523
+ /** a token that was not present but it is okay */
524
+ PM_TOKEN_NOT_PROVIDED,
525
+
522
526
  /** The maximum token value. */
523
527
  PM_TOKEN_MAXIMUM,
524
528
  } pm_token_type_t;
@@ -1420,6 +1424,17 @@ typedef struct pm_array_pattern_node {
1420
1424
 
1421
1425
  /**
1422
1426
  * ArrayPatternNode#constant
1427
+ *
1428
+ * Represents the optional constant preceding the Array
1429
+ *
1430
+ * foo in Bar[]
1431
+ * ^^^
1432
+ *
1433
+ * foo in Bar[1, 2, 3]
1434
+ * ^^^
1435
+ *
1436
+ * foo in Bar::Baz[1, 2, 3]
1437
+ * ^^^^^^^^
1423
1438
  */
1424
1439
  struct pm_node *constant;
1425
1440
 
@@ -2623,7 +2638,7 @@ typedef struct pm_case_node {
2623
2638
  * Represents the predicate of the case statement. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
2624
2639
  *
2625
2640
  * case true; when false; end
2626
- * ^^^^
2641
+ * ^^^^
2627
2642
  */
2628
2643
  struct pm_node *predicate;
2629
2644
 
@@ -2692,6 +2707,11 @@ typedef struct pm_class_node {
2692
2707
 
2693
2708
  /**
2694
2709
  * ClassNode#class_keyword_loc
2710
+ *
2711
+ * Represents the location of the `class` keyword.
2712
+ *
2713
+ * class Foo end
2714
+ * ^^^^^
2695
2715
  */
2696
2716
  pm_location_t class_keyword_loc;
2697
2717
 
@@ -2702,26 +2722,51 @@ typedef struct pm_class_node {
2702
2722
 
2703
2723
  /**
2704
2724
  * ClassNode#inheritance_operator_loc
2725
+ *
2726
+ * Represents the location of the `<` operator.
2727
+ *
2728
+ * class Foo < Bar
2729
+ * ^
2705
2730
  */
2706
2731
  pm_location_t inheritance_operator_loc;
2707
2732
 
2708
2733
  /**
2709
2734
  * ClassNode#superclass
2735
+ *
2736
+ * Represents the superclass of the class.
2737
+ *
2738
+ * class Foo < Bar
2739
+ * ^^^
2710
2740
  */
2711
2741
  struct pm_node *superclass;
2712
2742
 
2713
2743
  /**
2714
2744
  * ClassNode#body
2745
+ *
2746
+ * Represents the body of the class.
2747
+ *
2748
+ * class Foo
2749
+ * foo
2750
+ * ^^^
2715
2751
  */
2716
2752
  struct pm_node *body;
2717
2753
 
2718
2754
  /**
2719
2755
  * ClassNode#end_keyword_loc
2756
+ *
2757
+ * Represents the location of the `end` keyword.
2758
+ *
2759
+ * class Foo end
2760
+ * ^^^
2720
2761
  */
2721
2762
  pm_location_t end_keyword_loc;
2722
2763
 
2723
2764
  /**
2724
2765
  * ClassNode#name
2766
+ *
2767
+ * The name of the class.
2768
+ *
2769
+ * class Foo end # name `:Foo`
2725
2770
  */
2726
2771
  pm_constant_id_t name;
2727
2772
  } pm_class_node_t;
@@ -3758,6 +3803,9 @@ typedef struct pm_false_node {
3758
3803
  * foo in Foo(*bar, baz, *qux)
3759
3804
  * ^^^^^^^^^^^^^^^^^^^^
3760
3805
  *
3806
+ * foo => *bar, baz, *qux
3807
+ * ^^^^^^^^^^^^^^^
3808
+ *
3761
3809
  * Type: ::PM_FIND_PATTERN_NODE
3762
3810
  *
3763
3811
  * @extends pm_node_t
@@ -3769,31 +3817,76 @@ typedef struct pm_find_pattern_node {
3769
3817
 
3770
3818
  /**
3771
3819
  * FindPatternNode#constant
3820
+ *
3821
+ * Represents the optional constant preceding the pattern
3822
+ *
3823
+ * foo in Foo(*bar, baz, *qux)
3824
+ * ^^^
3772
3825
  */
3773
3826
  struct pm_node *constant;
3774
3827
 
3775
3828
  /**
3776
3829
  * FindPatternNode#left
3830
+ *
3831
+ * Represents the first wildcard node in the pattern.
3832
+ *
3833
+ * foo in *bar, baz, *qux
3834
+ * ^^^^
3835
+ *
3836
+ * foo in Foo(*bar, baz, *qux)
3837
+ * ^^^^
3777
3838
  */
3778
3839
  struct pm_splat_node *left;
3779
3840
 
3780
3841
  /**
3781
3842
  * FindPatternNode#requireds
3843
+ *
3844
+ * Represents the nodes in between the wildcards.
3845
+ *
3846
+ * foo in *bar, baz, *qux
3847
+ * ^^^
3848
+ *
3849
+ * foo in Foo(*bar, baz, 1, *qux)
3850
+ * ^^^^^^
3782
3851
  */
3783
3852
  struct pm_node_list requireds;
3784
3853
 
3785
3854
  /**
3786
3855
  * FindPatternNode#right
3856
+ *
3857
+ * Represents the second wildcard node in the pattern.
3858
+ *
3859
+ * foo in *bar, baz, *qux
3860
+ * ^^^^
3861
+ *
3862
+ * foo in Foo(*bar, baz, *qux)
3863
+ * ^^^^
3787
3864
  */
3788
3865
  struct pm_node *right;
3789
3866
 
3790
3867
  /**
3791
3868
  * FindPatternNode#opening_loc
3869
+ *
3870
+ * The location of the opening brace.
3871
+ *
3872
+ * foo in [*bar, baz, *qux]
3873
+ * ^
3874
+ *
3875
+ * foo in Foo(*bar, baz, *qux)
3876
+ * ^
3792
3877
  */
3793
3878
  pm_location_t opening_loc;
3794
3879
 
3795
3880
  /**
3796
3881
  * FindPatternNode#closing_loc
3882
+ *
3883
+ * The location of the closing brace.
3884
+ *
3885
+ * foo in [*bar, baz, *qux]
3886
+ * ^
3887
+ *
3888
+ * foo in Foo(*bar, baz, *qux)
3889
+ * ^
3797
3890
  */
3798
3891
  pm_location_t closing_loc;
3799
3892
  } pm_find_pattern_node_t;
@@ -4306,6 +4399,12 @@ typedef struct pm_hash_node {
4306
4399
  * foo => { a: 1, b: 2, **c }
4307
4400
  * ^^^^^^^^^^^^^^^^^^^
4308
4401
  *
4402
+ * foo => Bar[a: 1, b: 2]
4403
+ * ^^^^^^^^^^^^^^^
4404
+ *
4405
+ * foo in { a: 1, b: 2 }
4406
+ * ^^^^^^^^^^^^^^
4407
+ *
4309
4408
  * Type: ::PM_HASH_PATTERN_NODE
4310
4409
  *
4311
4410
  * @extends pm_node_t
@@ -4317,26 +4416,66 @@ typedef struct pm_hash_pattern_node {
4317
4416
 
4318
4417
  /**
4319
4418
  * HashPatternNode#constant
4419
+ *
4420
+ * Represents the optional constant preceding the Hash.
4421
+ *
4422
+ * foo => Bar[a: 1, b: 2]
4423
+ * ^^^
4424
+ *
4425
+ * foo => Bar::Baz[a: 1, b: 2]
4426
+ * ^^^^^^^^
4320
4427
  */
4321
4428
  struct pm_node *constant;
4322
4429
 
4323
4430
  /**
4324
4431
  * HashPatternNode#elements
4432
+ *
4433
+ * Represents the explicit named hash keys and values.
4434
+ *
4435
+ * foo => { a: 1, b:, ** }
4436
+ * ^^^^^^^^
4325
4437
  */
4326
4438
  struct pm_node_list elements;
4327
4439
 
4328
4440
  /**
4329
4441
  * HashPatternNode#rest
4442
+ *
4443
+ * Represents the rest of the Hash keys and values. This can be named, unnamed, or explicitly forbidden via `**nil`, this last one results in a `NoKeywordsParameterNode`.
4444
+ *
4445
+ * foo => { a: 1, b:, **c }
4446
+ * ^^^
4447
+ *
4448
+ * foo => { a: 1, b:, ** }
4449
+ * ^^
4450
+ *
4451
+ * foo => { a: 1, b:, **nil }
4452
+ * ^^^^^
4330
4453
  */
4331
4454
  struct pm_node *rest;
4332
4455
 
4333
4456
  /**
4334
4457
  * HashPatternNode#opening_loc
4458
+ *
4459
+ * The location of the opening brace.
4460
+ *
4461
+ * foo => { a: 1 }
4462
+ * ^
4463
+ *
4464
+ * foo => Bar[a: 1]
4465
+ * ^
4335
4466
  */
4336
4467
  pm_location_t opening_loc;
4337
4468
 
4338
4469
  /**
4339
4470
  * HashPatternNode#closing_loc
4471
+ *
4472
+ * The location of the closing brace.
4473
+ *
4474
+ * foo => { a: 1 }
4475
+ * ^
4476
+ *
4477
+ * foo => Bar[a: 1]
4478
+ * ^
4340
4479
  */
4341
4480
  pm_location_t closing_loc;
4342
4481
  } pm_hash_pattern_node_t;
@@ -5618,6 +5757,9 @@ typedef struct pm_local_variable_read_node {
5618
5757
  * foo, bar = baz
5619
5758
  * ^^^ ^^^
5620
5759
  *
5760
+ * foo => baz
5761
+ * ^^^
5762
+ *
5621
5763
  * Type: ::PM_LOCAL_VARIABLE_TARGET_NODE
5622
5764
  *
5623
5765
  * @extends pm_node_t
@@ -5820,16 +5962,70 @@ typedef struct pm_match_required_node {
5820
5962
 
5821
5963
  /**
5822
5964
  * MatchRequiredNode#value
5965
+ *
5966
+ * Represents the left-hand side of the operator.
5967
+ *
5968
+ * foo => bar
5969
+ * ^^^
5823
5970
  */
5824
5971
  struct pm_node *value;
5825
5972
 
5826
5973
  /**
5827
5974
  * MatchRequiredNode#pattern
5975
+ *
5976
+ * Represents the right-hand side of the operator. The type of the node depends on the expression.
5977
+ *
5978
+ * Anything that looks like a local variable name (including `_`) will result in a `LocalVariableTargetNode`.
5979
+ *
5980
+ * foo => a # This is equivalent to writing `a = foo`
5981
+ * ^
5982
+ *
5983
+ * Using an explicit `Array` or combining expressions with `,` will result in a `ArrayPatternNode`. This can be preceded by a constant.
5984
+ *
5985
+ * foo => [a]
5986
+ * ^^^
5987
+ *
5988
+ * foo => a, b
5989
+ * ^^^^
5990
+ *
5991
+ * foo => Bar[a, b]
5992
+ * ^^^^^^^^^
5993
+ *
5994
+ * If the array pattern contains at least two wildcard matches, a `FindPatternNode` is created instead.
5995
+ *
5996
+ * foo => *, 1, *a
5997
+ * ^^^^^
5998
+ *
5999
+ * Using an explicit `Hash` or a constant with square brackets and hash keys in the square brackets will result in a `HashPatternNode`.
6000
+ *
6001
+ * foo => { a: 1, b: }
6002
+ *
6003
+ * foo => Bar[a: 1, b:]
6004
+ *
6005
+ * foo => Bar[**]
6006
+ *
6007
+ * To use any variable that needs run time evaluation, pinning is required. This results in a `PinnedVariableNode`
6008
+ *
6009
+ * foo => ^a
6010
+ * ^^
6011
+ *
6012
+ * Similar, any expression can be used with pinning. This results in a `PinnedExpressionNode`.
6013
+ *
6014
+ * foo => ^(a + 1)
6015
+ *
6016
+ * Anything else will result in the regular node for that expression, for example a `ConstantReadNode`.
6017
+ *
6018
+ * foo => CONST
5828
6019
  */
5829
6020
  struct pm_node *pattern;
5830
6021
 
5831
6022
  /**
5832
6023
  * MatchRequiredNode#operator_loc
6024
+ *
6025
+ * The location of the operator.
6026
+ *
6027
+ * foo => bar
6028
+ * ^^
5833
6029
  */
5834
6030
  pm_location_t operator_loc;
5835
6031
  } pm_match_required_node_t;
@@ -6487,21 +6683,41 @@ typedef struct pm_pinned_expression_node {
6487
6683
 
6488
6684
  /**
6489
6685
  * PinnedExpressionNode#expression
6686
+ *
6687
+ * The expression used in the pinned expression
6688
+ *
6689
+ * foo in ^(bar)
6690
+ * ^^^
6490
6691
  */
6491
6692
  struct pm_node *expression;
6492
6693
 
6493
6694
  /**
6494
6695
  * PinnedExpressionNode#operator_loc
6696
+ *
6697
+ * The location of the `^` operator
6698
+ *
6699
+ * foo in ^(bar)
6700
+ * ^
6495
6701
  */
6496
6702
  pm_location_t operator_loc;
6497
6703
 
6498
6704
  /**
6499
6705
  * PinnedExpressionNode#lparen_loc
6706
+ *
6707
+ * The location of the opening parenthesis.
6708
+ *
6709
+ * foo in ^(bar)
6710
+ * ^
6500
6711
  */
6501
6712
  pm_location_t lparen_loc;
6502
6713
 
6503
6714
  /**
6504
6715
  * PinnedExpressionNode#rparen_loc
6716
+ *
6717
+ * The location of the closing parenthesis.
6718
+ *
6719
+ * foo in ^(bar)
6720
+ * ^
6505
6721
  */
6506
6722
  pm_location_t rparen_loc;
6507
6723
  } pm_pinned_expression_node_t;
@@ -6525,11 +6741,21 @@ typedef struct pm_pinned_variable_node {
6525
6741
 
6526
6742
  /**
6527
6743
  * PinnedVariableNode#variable
6744
+ *
6745
+ * The variable used in the pinned expression
6746
+ *
6747
+ * foo in ^bar
6748
+ * ^^^
6528
6749
  */
6529
6750
  struct pm_node *variable;
6530
6751
 
6531
6752
  /**
6532
6753
  * PinnedVariableNode#operator_loc
6754
+ *
6755
+ * The location of the `^` operator
6756
+ *
6757
+ * foo in ^bar
6758
+ * ^
6533
6759
  */
6534
6760
  pm_location_t operator_loc;
6535
6761
  } pm_pinned_variable_node_t;
@@ -7764,6 +7990,8 @@ typedef enum pm_arguments_node_flags {
7764
7990
 
7765
7991
  /** if the arguments contain multiple splats */
7766
7992
  PM_ARGUMENTS_NODE_FLAGS_CONTAINS_MULTIPLE_SPLATS = 64,
7993
+
7994
+ PM_ARGUMENTS_NODE_FLAGS_LAST,
7767
7995
  } pm_arguments_node_flags_t;
7768
7996
 
7769
7997
  /**
@@ -7772,6 +8000,8 @@ typedef enum pm_arguments_node_flags {
7772
8000
  typedef enum pm_array_node_flags {
7773
8001
  /** if array contains splat nodes */
7774
8002
  PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT = 4,
8003
+
8004
+ PM_ARRAY_NODE_FLAGS_LAST,
7775
8005
  } pm_array_node_flags_t;
7776
8006
 
7777
8007
  /**
@@ -7789,6 +8019,8 @@ typedef enum pm_call_node_flags {
7789
8019
 
7790
8020
  /** a call that ignores method visibility */
7791
8021
  PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY = 32,
8022
+
8023
+ PM_CALL_NODE_FLAGS_LAST,
7792
8024
  } pm_call_node_flags_t;
7793
8025
 
7794
8026
  /**
@@ -7800,6 +8032,8 @@ typedef enum pm_encoding_flags {
7800
8032
 
7801
8033
  /** internal bytes forced the encoding to binary */
7802
8034
  PM_ENCODING_FLAGS_FORCED_BINARY_ENCODING = 8,
8035
+
8036
+ PM_ENCODING_FLAGS_LAST,
7803
8037
  } pm_encoding_flags_t;
7804
8038
 
7805
8039
  /**
@@ -7817,6 +8051,8 @@ typedef enum pm_integer_base_flags {
7817
8051
 
7818
8052
  /** 0x prefix */
7819
8053
  PM_INTEGER_BASE_FLAGS_HEXADECIMAL = 32,
8054
+
8055
+ PM_INTEGER_BASE_FLAGS_LAST,
7820
8056
  } pm_integer_base_flags_t;
7821
8057
 
7822
8058
  /**
@@ -7828,6 +8064,8 @@ typedef enum pm_interpolated_string_node_flags {
7828
8064
 
7829
8065
  /** mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'` */
7830
8066
  PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE = 8,
8067
+
8068
+ PM_INTERPOLATED_STRING_NODE_FLAGS_LAST,
7831
8069
  } pm_interpolated_string_node_flags_t;
7832
8070
 
7833
8071
  /**
@@ -7836,6 +8074,8 @@ typedef enum pm_interpolated_string_node_flags {
7836
8074
  typedef enum pm_keyword_hash_node_flags {
7837
8075
  /** a keyword hash which only has `AssocNode` elements all with symbol keys, which means the elements can be treated as keyword arguments */
7838
8076
  PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS = 4,
8077
+
8078
+ PM_KEYWORD_HASH_NODE_FLAGS_LAST,
7839
8079
  } pm_keyword_hash_node_flags_t;
7840
8080
 
7841
8081
  /**
@@ -7844,6 +8084,8 @@ typedef enum pm_keyword_hash_node_flags {
7844
8084
  typedef enum pm_loop_flags {
7845
8085
  /** a loop after a begin statement, so the body is executed first before the condition */
7846
8086
  PM_LOOP_FLAGS_BEGIN_MODIFIER = 4,
8087
+
8088
+ PM_LOOP_FLAGS_LAST,
7847
8089
  } pm_loop_flags_t;
7848
8090
 
7849
8091
  /**
@@ -7852,6 +8094,8 @@ typedef enum pm_loop_flags {
7852
8094
  typedef enum pm_parameter_flags {
7853
8095
  /** a parameter name that has been repeated in the method signature */
7854
8096
  PM_PARAMETER_FLAGS_REPEATED_PARAMETER = 4,
8097
+
8098
+ PM_PARAMETER_FLAGS_LAST,
7855
8099
  } pm_parameter_flags_t;
7856
8100
 
7857
8101
  /**
@@ -7860,6 +8104,8 @@ typedef enum pm_parameter_flags {
7860
8104
  typedef enum pm_parentheses_node_flags {
7861
8105
  /** parentheses that contain multiple potentially void statements */
7862
8106
  PM_PARENTHESES_NODE_FLAGS_MULTIPLE_STATEMENTS = 4,
8107
+
8108
+ PM_PARENTHESES_NODE_FLAGS_LAST,
7863
8109
  } pm_parentheses_node_flags_t;
7864
8110
 
7865
8111
  /**
@@ -7868,6 +8114,8 @@ typedef enum pm_parentheses_node_flags {
7868
8114
  typedef enum pm_range_flags {
7869
8115
  /** ... operator */
7870
8116
  PM_RANGE_FLAGS_EXCLUDE_END = 4,
8117
+
8118
+ PM_RANGE_FLAGS_LAST,
7871
8119
  } pm_range_flags_t;
7872
8120
 
7873
8121
  /**
@@ -7906,6 +8154,8 @@ typedef enum pm_regular_expression_flags {
7906
8154
 
7907
8155
  /** internal bytes forced the encoding to US-ASCII */
7908
8156
  PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING = 4096,
8157
+
8158
+ PM_REGULAR_EXPRESSION_FLAGS_LAST,
7909
8159
  } pm_regular_expression_flags_t;
7910
8160
 
7911
8161
  /**
@@ -7920,6 +8170,8 @@ typedef enum pm_shareable_constant_node_flags {
7920
8170
 
7921
8171
  /** constant writes that should be modified with shareable constant value experimental copy */
7922
8172
  PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_COPY = 16,
8173
+
8174
+ PM_SHAREABLE_CONSTANT_NODE_FLAGS_LAST,
7923
8175
  } pm_shareable_constant_node_flags_t;
7924
8176
 
7925
8177
  /**
@@ -7937,6 +8189,8 @@ typedef enum pm_string_flags {
7937
8189
 
7938
8190
  /** mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal` */
7939
8191
  PM_STRING_FLAGS_MUTABLE = 32,
8192
+
8193
+ PM_STRING_FLAGS_LAST,
7940
8194
  } pm_string_flags_t;
7941
8195
 
7942
8196
  /**
@@ -7951,6 +8205,8 @@ typedef enum pm_symbol_flags {
7951
8205
 
7952
8206
  /** internal bytes forced the encoding to US-ASCII */
7953
8207
  PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING = 16,
8208
+
8209
+ PM_SYMBOL_FLAGS_LAST,
7954
8210
  } pm_symbol_flags_t;
7955
8211
 
7956
8212
  /**