yarp 0.10.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -1
- data/CONTRIBUTING.md +7 -0
- data/config.yml +259 -49
- data/docs/configuration.md +0 -1
- data/docs/mapping.md +91 -91
- data/docs/serialization.md +23 -20
- data/ext/yarp/api_node.c +1268 -419
- data/ext/yarp/extension.c +9 -2
- data/ext/yarp/extension.h +2 -2
- data/include/yarp/ast.h +471 -318
- data/include/yarp/diagnostic.h +203 -1
- data/include/yarp/enc/yp_encoding.h +1 -1
- data/include/yarp/node.h +0 -4
- data/include/yarp/parser.h +44 -16
- data/include/yarp/util/yp_char.h +22 -6
- data/include/yarp/util/yp_constant_pool.h +11 -4
- data/include/yarp/version.h +2 -2
- data/lib/yarp/desugar_visitor.rb +19 -19
- data/lib/yarp/mutation_visitor.rb +50 -15
- data/lib/yarp/node.rb +6455 -443
- data/lib/yarp/parse_result/comments.rb +172 -0
- data/lib/yarp/parse_result/newlines.rb +60 -0
- data/lib/yarp/pattern.rb +239 -0
- data/lib/yarp/serialize.rb +173 -140
- data/lib/yarp.rb +151 -76
- data/src/diagnostic.c +259 -2
- data/src/enc/yp_unicode.c +5 -5
- data/src/node.c +984 -872
- data/src/prettyprint.c +461 -203
- data/src/serialize.c +380 -185
- data/src/unescape.c +20 -20
- data/src/util/yp_char.c +59 -16
- data/src/util/yp_constant_pool.c +97 -13
- data/src/util/yp_newline_list.c +5 -1
- data/src/util/yp_string_list.c +4 -1
- data/src/yarp.c +2313 -1675
- data/yarp.gemspec +4 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9afbc3b5f4c070c404f0421f1814d5a1200cb849ef9bf38b2ae23f50ba738fdf
|
4
|
+
data.tar.gz: bed121fb1ac414cf5918a2bcf7df2a9b1318df2f46dff9863cc5b4427ce79409
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fd5831ab86ca1ca299e86ca5f2ca184164fa56de353cfa0d9b51d2ece522c2f5bebfadd1896222e4b7e1e984604be414ee8900b1a5bbc0b8eb3b6ee7bb738dc
|
7
|
+
data.tar.gz: 6fa02c77777391a1c4b5dc47445d905fee835213c7c02687cac432a4b566bbae8ead26467609066e83bf030ce19e09f46cf553fc0acdd8f7ef977074568b7061
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,53 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [0.12.0] - 2023-09-15
|
10
|
+
|
11
|
+
### Added
|
12
|
+
|
13
|
+
- `RegularExpressionNode#options` and `InterpolatedRegularExpressionNode#options` are now provided. These return integers that match up to the `Regexp#options` API.
|
14
|
+
- Greatly improved `Node#inspect` and `Node#pretty_print` APIs.
|
15
|
+
- `MatchLastLineNode` and `InterpolatedMatchLastLineNode` are introduced to represent using a regular expression as the predicate of an `if` or `unless` statement.
|
16
|
+
- `IntegerNode` now has a base flag on it.
|
17
|
+
- Heredocs that were previously `InterpolatedStringNode` and `InterpolatedXStringNode` nodes without any actual interpolation are now `StringNode` and `XStringNode`, respectively.
|
18
|
+
- `StringNode` now has a `frozen?` flag on it, which respects the `frozen_string_literal` magic comment.
|
19
|
+
- Numbered parameters are now supported, and are properly represented using `LocalVariableReadNode` nodes.
|
20
|
+
- `ImplicitNode` is introduced, which wraps implicit calls, local variable reads, or constant reads in omitted hash values.
|
21
|
+
- `YARP::Dispatcher` is introduced, which provides a way for multiple objects to listen for certain events on the AST while it is being walked. This is effectively a way to implement a more efficient visitor pattern when you have many different uses for the AST.
|
22
|
+
|
23
|
+
### Changed
|
24
|
+
|
25
|
+
- **BREAKING**: Flags fields are now marked as private, to ensure we can change their implementation under the hood. Actually querying should be through the accessor methods.
|
26
|
+
- **BREAKING**: `AliasNode` is now split into `AliasMethodNode` and `AliasGlobalVariableNode`.
|
27
|
+
- Method definitions on local variables is now correctly handled.
|
28
|
+
- Unary minus precedence has been fixed.
|
29
|
+
- Concatenating character literals with string literals is now fixed.
|
30
|
+
- Many more invalid syntaxes are now properly rejected.
|
31
|
+
- **BREAKING**: Comments now no longer include their trailing newline.
|
32
|
+
|
33
|
+
## [0.11.0] - 2023-09-08
|
34
|
+
|
35
|
+
### Added
|
36
|
+
|
37
|
+
- `Node#inspect` is much improved.
|
38
|
+
- `YARP::Pattern` is introduced, which can construct procs to match against nodes.
|
39
|
+
- `BlockLocalVariableNode` is introduced to take the place of the locations array on `BlockParametersNode`.
|
40
|
+
- `ParseResult#attach_comments!` is now provided to attach comments to locations in the tree.
|
41
|
+
- `MultiTargetNode` is introduced as the target of multi writes and for loops.
|
42
|
+
- `Node#comment_targets` is introduced to return the list of objects that can have attached comments.
|
43
|
+
|
44
|
+
### Changed
|
45
|
+
|
46
|
+
- **BREAKING**: `GlobalVariable*Node#name` now returns a symbol.
|
47
|
+
- **BREAKING**: `Constant*Node#name` now returns a symbol.
|
48
|
+
- **BREAKING**: `BlockParameterNode`, `KeywordParameterNode`, `KeywordRestParameterNode`, `RestParameterNode`, `DefNode` all have their `name` methods returning symbols now.
|
49
|
+
- **BREAKING**: `ClassNode#name` and `ModuleNode#name` now return symbols.
|
50
|
+
- **BREAKING**: `Location#end_column` is now exclusive instead of inclusive.
|
51
|
+
- `Location#slice` now returns a properly encoded string.
|
52
|
+
- `CallNode#operator_loc` is now `CallNode#call_operator_loc`.
|
53
|
+
- `CallOperatorAndWriteNode` is renamed to `CallAndWriteNode` and its structure has changed.
|
54
|
+
- `CallOperatorOrWriteNode` is renamed to `CallOrWriteNode` and its structure has changed.
|
55
|
+
|
9
56
|
## [0.10.0] - 2023-09-01
|
10
57
|
|
11
58
|
### Added
|
@@ -94,7 +141,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
94
141
|
|
95
142
|
- 🎉 Initial release! 🎉
|
96
143
|
|
97
|
-
[unreleased]: https://github.com/ruby/yarp/compare/v0.
|
144
|
+
[unreleased]: https://github.com/ruby/yarp/compare/v0.12.0...HEAD
|
145
|
+
[0.12.0]: https://github.com/ruby/yarp/compare/v0.11.0...v0.12.0
|
146
|
+
[0.11.0]: https://github.com/ruby/yarp/compare/v0.10.0...v0.11.0
|
98
147
|
[0.10.0]: https://github.com/ruby/yarp/compare/v0.9.0...v0.10.0
|
99
148
|
[0.9.0]: https://github.com/ruby/yarp/compare/v0.8.0...v0.9.0
|
100
149
|
[0.8.0]: https://github.com/ruby/yarp/compare/v0.7.0...v0.8.0
|
data/CONTRIBUTING.md
CHANGED
@@ -32,6 +32,13 @@ bundle exec rake compile test
|
|
32
32
|
bundle exec rake compile:yarp test
|
33
33
|
```
|
34
34
|
|
35
|
+
To test the rust bindings (with caveats about setting up your Rust environment properly first):
|
36
|
+
|
37
|
+
``` sh
|
38
|
+
bundle exec rake compile test:rust
|
39
|
+
```
|
40
|
+
|
41
|
+
|
35
42
|
## Documentation
|
36
43
|
|
37
44
|
We could always use more documentation! If you want to contribute documentation, feel free to open a pull request. These will get merged in as soon as possible. Documenting functions or methods is always useful, but we also need more guides and tutorials. If you have an idea for a guide or tutorial, feel free to open an issue and we can discuss it.
|
data/config.yml
CHANGED
@@ -333,6 +333,16 @@ flags:
|
|
333
333
|
comment: "&. operator"
|
334
334
|
- name: VARIABLE_CALL
|
335
335
|
comment: "a call that could have been a local variable"
|
336
|
+
- name: IntegerBaseFlags
|
337
|
+
values:
|
338
|
+
- name: BINARY
|
339
|
+
comment: "0b prefix"
|
340
|
+
- name: OCTAL
|
341
|
+
comment: "0o or 0 prefix"
|
342
|
+
- name: DECIMAL
|
343
|
+
comment: "0d or no prefix"
|
344
|
+
- name: HEXADECIMAL
|
345
|
+
comment: "0x prefix"
|
336
346
|
- name: LoopFlags
|
337
347
|
values:
|
338
348
|
- name: BEGIN_MODIFIER
|
@@ -345,10 +355,10 @@ flags:
|
|
345
355
|
values:
|
346
356
|
- name: IGNORE_CASE
|
347
357
|
comment: "i - ignores the case of characters when matching"
|
348
|
-
- name: MULTI_LINE
|
349
|
-
comment: "m - allows $ to match the end of lines within strings"
|
350
358
|
- name: EXTENDED
|
351
359
|
comment: "x - ignores whitespace and allows comments in regular expressions"
|
360
|
+
- name: MULTI_LINE
|
361
|
+
comment: "m - allows $ to match the end of lines within strings"
|
352
362
|
- name: EUC_JP
|
353
363
|
comment: "e - forces the EUC-JP encoding"
|
354
364
|
- name: ASCII_8BIT
|
@@ -359,8 +369,25 @@ flags:
|
|
359
369
|
comment: "u - forces the UTF-8 encoding"
|
360
370
|
- name: ONCE
|
361
371
|
comment: "o - only interpolates values into the regular expression once"
|
372
|
+
- name: StringFlags
|
373
|
+
values:
|
374
|
+
- name: FROZEN
|
375
|
+
comment: "frozen by virtue of a frozen_string_literal comment"
|
362
376
|
nodes:
|
363
|
-
- name:
|
377
|
+
- name: AliasGlobalVariableNode
|
378
|
+
fields:
|
379
|
+
- name: new_name
|
380
|
+
type: node
|
381
|
+
- name: old_name
|
382
|
+
type: node
|
383
|
+
- name: keyword_loc
|
384
|
+
type: location
|
385
|
+
comment: |
|
386
|
+
Represents the use of the `alias` keyword to alias a global variable.
|
387
|
+
|
388
|
+
alias $foo $bar
|
389
|
+
^^^^^^^^^^^^^^^
|
390
|
+
- name: AliasMethodNode
|
364
391
|
fields:
|
365
392
|
- name: new_name
|
366
393
|
type: node
|
@@ -369,7 +396,7 @@ nodes:
|
|
369
396
|
- name: keyword_loc
|
370
397
|
type: location
|
371
398
|
comment: |
|
372
|
-
Represents the use of the `alias` keyword.
|
399
|
+
Represents the use of the `alias` keyword to alias a method.
|
373
400
|
|
374
401
|
alias foo bar
|
375
402
|
^^^^^^^^^^^^^
|
@@ -520,6 +547,15 @@ nodes:
|
|
520
547
|
|
521
548
|
bar(&args)
|
522
549
|
^^^^^^^^^^
|
550
|
+
- name: BlockLocalVariableNode
|
551
|
+
fields:
|
552
|
+
- name: name
|
553
|
+
type: constant
|
554
|
+
comment: |
|
555
|
+
Represents a block local variable.
|
556
|
+
|
557
|
+
a { |; b| }
|
558
|
+
^
|
523
559
|
- name: BlockNode
|
524
560
|
fields:
|
525
561
|
- name: locals
|
@@ -540,6 +576,8 @@ nodes:
|
|
540
576
|
^^^^^^^^^^^^^^
|
541
577
|
- name: BlockParameterNode
|
542
578
|
fields:
|
579
|
+
- name: name
|
580
|
+
type: constant?
|
543
581
|
- name: name_loc
|
544
582
|
type: location?
|
545
583
|
- name: operator_loc
|
@@ -556,7 +594,7 @@ nodes:
|
|
556
594
|
type: node?
|
557
595
|
kind: ParametersNode
|
558
596
|
- name: locals
|
559
|
-
type:
|
597
|
+
type: node[]
|
560
598
|
- name: opening_loc
|
561
599
|
type: location?
|
562
600
|
- name: closing_loc
|
@@ -582,11 +620,42 @@ nodes:
|
|
582
620
|
|
583
621
|
break foo
|
584
622
|
^^^^^^^^^
|
585
|
-
- name:
|
623
|
+
- name: CallAndWriteNode
|
586
624
|
fields:
|
587
625
|
- name: receiver
|
588
626
|
type: node?
|
627
|
+
- name: call_operator_loc
|
628
|
+
type: location?
|
629
|
+
- name: message_loc
|
630
|
+
type: location?
|
631
|
+
- name: opening_loc
|
632
|
+
type: location?
|
633
|
+
- name: arguments
|
634
|
+
type: node?
|
635
|
+
kind: ArgumentsNode
|
636
|
+
- name: closing_loc
|
637
|
+
type: location?
|
638
|
+
- name: flags
|
639
|
+
type: flags
|
640
|
+
kind: CallNodeFlags
|
641
|
+
- name: read_name
|
642
|
+
type: string
|
643
|
+
- name: write_name
|
644
|
+
type: string
|
589
645
|
- name: operator_loc
|
646
|
+
type: location
|
647
|
+
- name: value
|
648
|
+
type: node
|
649
|
+
comment: |
|
650
|
+
Represents the use of the `&&=` operator on a call.
|
651
|
+
|
652
|
+
foo.bar &&= value
|
653
|
+
^^^^^^^^^^^^^^^^^
|
654
|
+
- name: CallNode
|
655
|
+
fields:
|
656
|
+
- name: receiver
|
657
|
+
type: node?
|
658
|
+
- name: call_operator_loc
|
590
659
|
type: location?
|
591
660
|
- name: message_loc
|
592
661
|
type: location?
|
@@ -625,50 +694,70 @@ nodes:
|
|
625
694
|
|
626
695
|
foo&.bar
|
627
696
|
^^^^^^^^
|
628
|
-
- name:
|
697
|
+
- name: CallOperatorWriteNode
|
629
698
|
fields:
|
630
|
-
- name:
|
631
|
-
type: node
|
632
|
-
|
699
|
+
- name: receiver
|
700
|
+
type: node?
|
701
|
+
- name: call_operator_loc
|
702
|
+
type: location?
|
703
|
+
- name: message_loc
|
704
|
+
type: location?
|
705
|
+
- name: opening_loc
|
706
|
+
type: location?
|
707
|
+
- name: arguments
|
708
|
+
type: node?
|
709
|
+
kind: ArgumentsNode
|
710
|
+
- name: closing_loc
|
711
|
+
type: location?
|
712
|
+
- name: flags
|
713
|
+
type: flags
|
714
|
+
kind: CallNodeFlags
|
715
|
+
- name: read_name
|
716
|
+
type: string
|
717
|
+
- name: write_name
|
718
|
+
type: string
|
719
|
+
- name: operator
|
720
|
+
type: constant
|
633
721
|
- name: operator_loc
|
634
722
|
type: location
|
635
723
|
- name: value
|
636
724
|
type: node
|
637
725
|
comment: |
|
638
|
-
Represents the use of
|
726
|
+
Represents the use of an assignment operator on a call.
|
639
727
|
|
640
|
-
foo.bar
|
641
|
-
|
642
|
-
- name:
|
728
|
+
foo.bar += baz
|
729
|
+
^^^^^^^^^^^^^^
|
730
|
+
- name: CallOrWriteNode
|
643
731
|
fields:
|
644
|
-
- name:
|
645
|
-
type: node
|
646
|
-
|
647
|
-
|
648
|
-
|
732
|
+
- name: receiver
|
733
|
+
type: node?
|
734
|
+
- name: call_operator_loc
|
735
|
+
type: location?
|
736
|
+
- name: message_loc
|
737
|
+
type: location?
|
738
|
+
- name: opening_loc
|
739
|
+
type: location?
|
740
|
+
- name: arguments
|
741
|
+
type: node?
|
742
|
+
kind: ArgumentsNode
|
743
|
+
- name: closing_loc
|
744
|
+
type: location?
|
745
|
+
- name: flags
|
746
|
+
type: flags
|
747
|
+
kind: CallNodeFlags
|
748
|
+
- name: read_name
|
749
|
+
type: string
|
750
|
+
- name: write_name
|
751
|
+
type: string
|
649
752
|
- name: operator_loc
|
650
753
|
type: location
|
754
|
+
- name: value
|
755
|
+
type: node
|
651
756
|
comment: |
|
652
757
|
Represents the use of the `||=` operator on a call.
|
653
758
|
|
654
759
|
foo.bar ||= value
|
655
760
|
^^^^^^^^^^^^^^^^^
|
656
|
-
- name: CallOperatorWriteNode
|
657
|
-
fields:
|
658
|
-
- name: target
|
659
|
-
type: node
|
660
|
-
kind: CallNode
|
661
|
-
- name: operator_loc
|
662
|
-
type: location
|
663
|
-
- name: value
|
664
|
-
type: node
|
665
|
-
- name: operator
|
666
|
-
type: constant
|
667
|
-
comment: |
|
668
|
-
Represents the use of an assignment operator on a call.
|
669
|
-
|
670
|
-
foo.bar += baz
|
671
|
-
^^^^^^^^^^^^^^
|
672
761
|
- name: CapturePatternNode
|
673
762
|
fields:
|
674
763
|
- name: value
|
@@ -719,7 +808,7 @@ nodes:
|
|
719
808
|
- name: end_keyword_loc
|
720
809
|
type: location
|
721
810
|
- name: name
|
722
|
-
type:
|
811
|
+
type: constant
|
723
812
|
comment: |
|
724
813
|
Represents a class declaration involving the `class` keyword.
|
725
814
|
|
@@ -797,7 +886,7 @@ nodes:
|
|
797
886
|
- name: name_loc
|
798
887
|
type: location
|
799
888
|
- name: value
|
800
|
-
type: node
|
889
|
+
type: node
|
801
890
|
- name: operator_loc
|
802
891
|
type: location?
|
803
892
|
comment: |
|
@@ -807,6 +896,8 @@ nodes:
|
|
807
896
|
^^^^^^^^^
|
808
897
|
- name: ConstantAndWriteNode
|
809
898
|
fields:
|
899
|
+
- name: name
|
900
|
+
type: constant
|
810
901
|
- name: name_loc
|
811
902
|
type: location
|
812
903
|
- name: operator_loc
|
@@ -820,6 +911,8 @@ nodes:
|
|
820
911
|
^^^^^^^^^^^^^^^^
|
821
912
|
- name: ConstantOperatorWriteNode
|
822
913
|
fields:
|
914
|
+
- name: name
|
915
|
+
type: constant
|
823
916
|
- name: name_loc
|
824
917
|
type: location
|
825
918
|
- name: operator_loc
|
@@ -835,6 +928,8 @@ nodes:
|
|
835
928
|
^^^^^^^^^^^^^^^
|
836
929
|
- name: ConstantOrWriteNode
|
837
930
|
fields:
|
931
|
+
- name: name
|
932
|
+
type: constant
|
838
933
|
- name: name_loc
|
839
934
|
type: location
|
840
935
|
- name: operator_loc
|
@@ -937,12 +1032,18 @@ nodes:
|
|
937
1032
|
::Foo::Bar = 1
|
938
1033
|
^^^^^^^^^^^^^^
|
939
1034
|
- name: ConstantReadNode
|
1035
|
+
fields:
|
1036
|
+
- name: name
|
1037
|
+
type: constant
|
940
1038
|
comment: |
|
941
1039
|
Represents referencing a constant.
|
942
1040
|
|
943
1041
|
Foo
|
944
1042
|
^^^
|
945
1043
|
- name: ConstantTargetNode
|
1044
|
+
fields:
|
1045
|
+
- name: name
|
1046
|
+
type: constant
|
946
1047
|
comment: |
|
947
1048
|
Represents writing to a constant in a context that doesn't have an explicit value.
|
948
1049
|
|
@@ -950,6 +1051,8 @@ nodes:
|
|
950
1051
|
^^^ ^^^
|
951
1052
|
- name: ConstantWriteNode
|
952
1053
|
fields:
|
1054
|
+
- name: name
|
1055
|
+
type: constant
|
953
1056
|
- name: name_loc
|
954
1057
|
type: location
|
955
1058
|
- name: value
|
@@ -963,6 +1066,8 @@ nodes:
|
|
963
1066
|
^^^^^^^
|
964
1067
|
- name: DefNode
|
965
1068
|
fields:
|
1069
|
+
- name: name
|
1070
|
+
type: constant
|
966
1071
|
- name: name_loc
|
967
1072
|
type: location
|
968
1073
|
- name: receiver
|
@@ -1166,6 +1271,8 @@ nodes:
|
|
1166
1271
|
^^^^^
|
1167
1272
|
- name: GlobalVariableAndWriteNode
|
1168
1273
|
fields:
|
1274
|
+
- name: name
|
1275
|
+
type: constant
|
1169
1276
|
- name: name_loc
|
1170
1277
|
type: location
|
1171
1278
|
- name: operator_loc
|
@@ -1179,6 +1286,8 @@ nodes:
|
|
1179
1286
|
^^^^^^^^^^^^^^^^^
|
1180
1287
|
- name: GlobalVariableOperatorWriteNode
|
1181
1288
|
fields:
|
1289
|
+
- name: name
|
1290
|
+
type: constant
|
1182
1291
|
- name: name_loc
|
1183
1292
|
type: location
|
1184
1293
|
- name: operator_loc
|
@@ -1194,6 +1303,8 @@ nodes:
|
|
1194
1303
|
^^^^^^^^^^^^^^^^
|
1195
1304
|
- name: GlobalVariableOrWriteNode
|
1196
1305
|
fields:
|
1306
|
+
- name: name
|
1307
|
+
type: constant
|
1197
1308
|
- name: name_loc
|
1198
1309
|
type: location
|
1199
1310
|
- name: operator_loc
|
@@ -1206,12 +1317,18 @@ nodes:
|
|
1206
1317
|
$target ||= value
|
1207
1318
|
^^^^^^^^^^^^^^^^^
|
1208
1319
|
- name: GlobalVariableReadNode
|
1320
|
+
fields:
|
1321
|
+
- name: name
|
1322
|
+
type: constant
|
1209
1323
|
comment: |
|
1210
1324
|
Represents referencing a global variable.
|
1211
1325
|
|
1212
1326
|
$foo
|
1213
1327
|
^^^^
|
1214
1328
|
- name: GlobalVariableTargetNode
|
1329
|
+
fields:
|
1330
|
+
- name: name
|
1331
|
+
type: constant
|
1215
1332
|
comment: |
|
1216
1333
|
Represents writing to a global variable in a context that doesn't have an explicit value.
|
1217
1334
|
|
@@ -1219,6 +1336,8 @@ nodes:
|
|
1219
1336
|
^^^^ ^^^^
|
1220
1337
|
- name: GlobalVariableWriteNode
|
1221
1338
|
fields:
|
1339
|
+
- name: name
|
1340
|
+
type: constant
|
1222
1341
|
- name: name_loc
|
1223
1342
|
type: location
|
1224
1343
|
- name: value
|
@@ -1294,6 +1413,19 @@ nodes:
|
|
1294
1413
|
|
1295
1414
|
1.0i
|
1296
1415
|
^^^^
|
1416
|
+
- name: ImplicitNode
|
1417
|
+
fields:
|
1418
|
+
- name: value
|
1419
|
+
type: node
|
1420
|
+
comment: |
|
1421
|
+
Represents a node that is implicitly being added to the tree but doesn't
|
1422
|
+
correspond directly to a node in the source.
|
1423
|
+
|
1424
|
+
{ foo: }
|
1425
|
+
^^^^
|
1426
|
+
|
1427
|
+
{ Foo: }
|
1428
|
+
^^^^
|
1297
1429
|
- name: InNode
|
1298
1430
|
fields:
|
1299
1431
|
- name: pattern
|
@@ -1391,11 +1523,34 @@ nodes:
|
|
1391
1523
|
@foo = 1
|
1392
1524
|
^^^^^^^^
|
1393
1525
|
- name: IntegerNode
|
1526
|
+
fields:
|
1527
|
+
- name: flags
|
1528
|
+
type: flags
|
1529
|
+
kind: IntegerBaseFlags
|
1394
1530
|
comment: |
|
1395
1531
|
Represents an integer number literal.
|
1396
1532
|
|
1397
1533
|
1
|
1398
1534
|
^
|
1535
|
+
- name: InterpolatedMatchLastLineNode
|
1536
|
+
fields:
|
1537
|
+
- name: opening_loc
|
1538
|
+
type: location
|
1539
|
+
- name: parts
|
1540
|
+
type: node[]
|
1541
|
+
- name: closing_loc
|
1542
|
+
type: location
|
1543
|
+
- name: flags
|
1544
|
+
type: flags
|
1545
|
+
kind: RegularExpressionFlags
|
1546
|
+
newline: parts
|
1547
|
+
comment: |
|
1548
|
+
Represents a regular expression literal that contains interpolation that
|
1549
|
+
is being used in the predicate of a conditional to implicitly match
|
1550
|
+
against the last line read by an IO object.
|
1551
|
+
|
1552
|
+
if /foo #{bar} baz/ then end
|
1553
|
+
^^^^^^^^^^^^^^^^
|
1399
1554
|
- name: InterpolatedRegularExpressionNode
|
1400
1555
|
fields:
|
1401
1556
|
- name: opening_loc
|
@@ -1466,6 +1621,8 @@ nodes:
|
|
1466
1621
|
^^^^
|
1467
1622
|
- name: KeywordParameterNode
|
1468
1623
|
fields:
|
1624
|
+
- name: name
|
1625
|
+
type: constant
|
1469
1626
|
- name: name_loc
|
1470
1627
|
type: location
|
1471
1628
|
- name: value
|
@@ -1482,10 +1639,12 @@ nodes:
|
|
1482
1639
|
end
|
1483
1640
|
- name: KeywordRestParameterNode
|
1484
1641
|
fields:
|
1485
|
-
- name:
|
1486
|
-
type:
|
1642
|
+
- name: name
|
1643
|
+
type: constant?
|
1487
1644
|
- name: name_loc
|
1488
1645
|
type: location?
|
1646
|
+
- name: operator_loc
|
1647
|
+
type: location
|
1489
1648
|
comment: |
|
1490
1649
|
Represents a keyword rest parameter to a method, block, or lambda definition.
|
1491
1650
|
|
@@ -1606,6 +1765,26 @@ nodes:
|
|
1606
1765
|
|
1607
1766
|
foo = 1
|
1608
1767
|
^^^^^^^
|
1768
|
+
- name: MatchLastLineNode
|
1769
|
+
fields:
|
1770
|
+
- name: opening_loc
|
1771
|
+
type: location
|
1772
|
+
- name: content_loc
|
1773
|
+
type: location
|
1774
|
+
- name: closing_loc
|
1775
|
+
type: location
|
1776
|
+
- name: unescaped
|
1777
|
+
type: string
|
1778
|
+
- name: flags
|
1779
|
+
type: flags
|
1780
|
+
kind: RegularExpressionFlags
|
1781
|
+
comment: |
|
1782
|
+
Represents a regular expression literal used in the predicate of a
|
1783
|
+
conditional to implicitly match against the last line read by an IO
|
1784
|
+
object.
|
1785
|
+
|
1786
|
+
if /foo/i then end
|
1787
|
+
^^^^^^
|
1609
1788
|
- name: MatchPredicateNode
|
1610
1789
|
fields:
|
1611
1790
|
- name: value
|
@@ -1632,6 +1811,19 @@ nodes:
|
|
1632
1811
|
|
1633
1812
|
foo => bar
|
1634
1813
|
^^^^^^^^^^
|
1814
|
+
- name: MatchWriteNode
|
1815
|
+
fields:
|
1816
|
+
- name: call
|
1817
|
+
type: node
|
1818
|
+
kind: CallNode
|
1819
|
+
- name: locals
|
1820
|
+
type: constant[]
|
1821
|
+
comment: |
|
1822
|
+
Represents writing local variables using a regular expression match with
|
1823
|
+
named capture groups.
|
1824
|
+
|
1825
|
+
/(?<foo>bar)/ =~ baz
|
1826
|
+
^^^^^^^^^^^^^^^^^^^^
|
1635
1827
|
- name: MissingNode
|
1636
1828
|
comment: |
|
1637
1829
|
Represents a node that is missing from the source and results in a syntax
|
@@ -1649,20 +1841,16 @@ nodes:
|
|
1649
1841
|
- name: end_keyword_loc
|
1650
1842
|
type: location
|
1651
1843
|
- name: name
|
1652
|
-
type:
|
1844
|
+
type: constant
|
1653
1845
|
comment: |
|
1654
1846
|
Represents a module declaration involving the `module` keyword.
|
1655
1847
|
|
1656
1848
|
module Foo end
|
1657
1849
|
^^^^^^^^^^^^^^
|
1658
|
-
- name:
|
1850
|
+
- name: MultiTargetNode
|
1659
1851
|
fields:
|
1660
1852
|
- name: targets
|
1661
1853
|
type: node[]
|
1662
|
-
- name: operator_loc
|
1663
|
-
type: location?
|
1664
|
-
- name: value
|
1665
|
-
type: node?
|
1666
1854
|
- name: lparen_loc
|
1667
1855
|
type: location?
|
1668
1856
|
- name: rparen_loc
|
@@ -1670,6 +1858,23 @@ nodes:
|
|
1670
1858
|
comment: |
|
1671
1859
|
Represents a multi-target expression.
|
1672
1860
|
|
1861
|
+
a, b, c = 1, 2, 3
|
1862
|
+
^^^^^^^
|
1863
|
+
- name: MultiWriteNode
|
1864
|
+
fields:
|
1865
|
+
- name: targets
|
1866
|
+
type: node[]
|
1867
|
+
- name: lparen_loc
|
1868
|
+
type: location?
|
1869
|
+
- name: rparen_loc
|
1870
|
+
type: location?
|
1871
|
+
- name: operator_loc
|
1872
|
+
type: location
|
1873
|
+
- name: value
|
1874
|
+
type: node
|
1875
|
+
comment: |
|
1876
|
+
Represents a write to a multi-target expression.
|
1877
|
+
|
1673
1878
|
a, b, c = 1, 2, 3
|
1674
1879
|
^^^^^^^^^^^^^^^^^
|
1675
1880
|
- name: NextNode
|
@@ -1746,11 +1951,11 @@ nodes:
|
|
1746
1951
|
type: node[]
|
1747
1952
|
- name: optionals
|
1748
1953
|
type: node[]
|
1749
|
-
- name: posts
|
1750
|
-
type: node[]
|
1751
1954
|
- name: rest
|
1752
1955
|
type: node?
|
1753
1956
|
kind: RestParameterNode
|
1957
|
+
- name: posts
|
1958
|
+
type: node[]
|
1754
1959
|
- name: keywords
|
1755
1960
|
type: node[]
|
1756
1961
|
- name: keyword_rest
|
@@ -1965,10 +2170,12 @@ nodes:
|
|
1965
2170
|
`ex` is in the `exception` field.
|
1966
2171
|
- name: RestParameterNode
|
1967
2172
|
fields:
|
1968
|
-
- name:
|
1969
|
-
type:
|
2173
|
+
- name: name
|
2174
|
+
type: constant?
|
1970
2175
|
- name: name_loc
|
1971
2176
|
type: location?
|
2177
|
+
- name: operator_loc
|
2178
|
+
type: location
|
1972
2179
|
comment: |
|
1973
2180
|
Represents a rest parameter to a method, block, or lambda definition.
|
1974
2181
|
|
@@ -2072,6 +2279,9 @@ nodes:
|
|
2072
2279
|
^^^^^^^^^^^
|
2073
2280
|
- name: StringNode
|
2074
2281
|
fields:
|
2282
|
+
- name: flags
|
2283
|
+
type: flags
|
2284
|
+
kind: StringFlags
|
2075
2285
|
- name: opening_loc
|
2076
2286
|
type: location?
|
2077
2287
|
- name: content_loc
|
data/docs/configuration.md
CHANGED
@@ -51,7 +51,6 @@ The available values for `type` are:
|
|
51
51
|
* `constant[]` - A child node that is an array of constants. This is a `yp_constant_id_list_t` in C.
|
52
52
|
* `location` - A child node that is a location. This is a `yp_location_t` in C.
|
53
53
|
* `location?` - A child node that is a location that is optionally present. This is a `yp_location_t` in C, but if the value is not present then the `start` and `end` fields will be `NULL`.
|
54
|
-
* `location[]` - A child node that is an array of locations. This is a `yp_location_list_t` in C.
|
55
54
|
* `uint32` - A child node that is a 32-bit unsigned integer. This is a `uint32_t` in C.
|
56
55
|
|
57
56
|
If the type is `node` or `node?` then the value also accepts an optional `kind` key (a string). This key is expected to match to the name of another node type within `config.yml`. This changes a couple of places where code is templated out to use the more specific struct name instead of the generic `yp_node_t`. For example, with `kind: StatementsNode` the `yp_node_t *` in C becomes a `yp_statements_node_t *`.
|