prism 0.27.0 → 0.29.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +45 -1
- data/config.yml +68 -44
- data/docs/configuration.md +1 -0
- data/ext/prism/api_node.c +854 -847
- data/ext/prism/extconf.rb +27 -23
- data/ext/prism/extension.c +5 -3
- data/ext/prism/extension.h +1 -1
- data/include/prism/ast.h +70 -48
- data/include/prism/diagnostic.h +23 -6
- data/include/prism/options.h +2 -2
- data/include/prism/parser.h +10 -0
- data/include/prism/static_literals.h +8 -6
- data/include/prism/version.h +2 -2
- data/lib/prism/desugar_compiler.rb +4 -4
- data/lib/prism/dot_visitor.rb +54 -38
- data/lib/prism/dsl.rb +24 -24
- data/lib/prism/ffi.rb +4 -4
- data/lib/prism/inspect_visitor.rb +2156 -0
- data/lib/prism/lex_compat.rb +1 -1
- data/lib/prism/mutation_compiler.rb +2 -2
- data/lib/prism/node.rb +737 -1863
- data/lib/prism/node_ext.rb +176 -5
- data/lib/prism/parse_result/comments.rb +1 -1
- data/lib/prism/parse_result/newlines.rb +1 -1
- data/lib/prism/parse_result.rb +78 -0
- data/lib/prism/pattern.rb +12 -6
- data/lib/prism/polyfill/byteindex.rb +13 -0
- data/lib/prism/polyfill/unpack1.rb +14 -0
- data/lib/prism/reflection.rb +20 -20
- data/lib/prism/serialize.rb +32 -15
- data/lib/prism/translation/parser/compiler.rb +156 -26
- data/lib/prism/translation/parser.rb +7 -7
- data/lib/prism/translation/ripper.rb +29 -25
- data/lib/prism/translation/ruby_parser.rb +13 -13
- data/lib/prism.rb +2 -1
- data/prism.gemspec +37 -38
- data/rbi/prism/compiler.rbi +3 -5
- data/rbi/prism/inspect_visitor.rbi +12 -0
- data/rbi/prism/node.rbi +405 -370
- data/rbi/prism/node_ext.rbi +5 -0
- data/rbi/prism/parse_result.rbi +23 -0
- data/rbi/prism/translation/ripper.rbi +1 -11
- data/sig/prism/dsl.rbs +12 -12
- data/sig/prism/inspect_visitor.rbs +22 -0
- data/sig/prism/lex_compat.rbs +10 -0
- data/sig/prism/node.rbs +108 -91
- data/sig/prism/node_ext.rbs +4 -0
- data/sig/prism/parse_result.rbs +12 -0
- data/src/diagnostic.c +66 -33
- data/src/node.c +89 -64
- data/src/options.c +2 -2
- data/src/prettyprint.c +109 -66
- data/src/prism.c +862 -317
- data/src/serialize.c +21 -18
- data/src/static_literals.c +120 -34
- data/src/token_type.c +6 -6
- metadata +8 -9
- data/lib/prism/node_inspector.rb +0 -68
- data/lib/prism/polyfill/string.rb +0 -12
- data/rbi/prism/desugar_compiler.rbi +0 -5
- data/rbi/prism/mutation_compiler.rbi +0 -5
- data/rbi/prism/translation/parser/compiler.rbi +0 -13
- data/rbi/prism/translation/ripper/ripper_compiler.rbi +0 -5
- data/rbi/prism/translation/ruby_parser.rbi +0 -11
data/sig/prism/node.rbs
CHANGED
@@ -16,9 +16,13 @@ module Prism
|
|
16
16
|
|
17
17
|
def start_offset: () -> Integer
|
18
18
|
def end_offset: () -> Integer
|
19
|
+
def source_lines: () -> Array[String]
|
20
|
+
alias script_lines source_lines
|
19
21
|
def slice: () -> String
|
22
|
+
def slice_lines: () -> String
|
20
23
|
def pretty_print: (untyped q) -> untyped
|
21
24
|
def to_dot: () -> String
|
25
|
+
def tunnel: (Integer line, Integer column) -> Array[Prism::node]
|
22
26
|
end
|
23
27
|
|
24
28
|
type node_singleton = singleton(Node) & _NodeSingleton
|
@@ -31,7 +35,7 @@ module Prism
|
|
31
35
|
def compact_child_nodes: () -> Array[Prism::node]
|
32
36
|
def comment_targets: () -> Array[Prism::node | Location]
|
33
37
|
def fields: () -> Array[Prism::Reflection::Field]
|
34
|
-
def inspect: (
|
38
|
+
def inspect: () -> String
|
35
39
|
def type: () -> Symbol
|
36
40
|
end
|
37
41
|
|
@@ -125,12 +129,13 @@ module Prism
|
|
125
129
|
class ArgumentsNode < Node
|
126
130
|
include _Node
|
127
131
|
|
128
|
-
|
132
|
+
attr_reader flags: Integer
|
129
133
|
attr_reader arguments: Array[Prism::node]
|
130
134
|
|
131
135
|
def initialize: (Source source, Integer flags, Array[Prism::node] arguments, Location location) -> void
|
132
136
|
def copy: (?flags: Integer, ?arguments: Array[Prism::node], ?location: Location) -> ArgumentsNode
|
133
137
|
def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, arguments: Array[Prism::node], location: Location }
|
138
|
+
def contains_keywords?: () -> bool
|
134
139
|
def contains_keyword_splat?: () -> bool
|
135
140
|
def type: () -> :arguments_node
|
136
141
|
| ...
|
@@ -144,7 +149,7 @@ module Prism
|
|
144
149
|
class ArrayNode < Node
|
145
150
|
include _Node
|
146
151
|
|
147
|
-
|
152
|
+
attr_reader flags: Integer
|
148
153
|
attr_reader elements: Array[Prism::node]
|
149
154
|
attr_reader opening_loc: Location?
|
150
155
|
attr_reader closing_loc: Location?
|
@@ -304,7 +309,7 @@ module Prism
|
|
304
309
|
class BlockLocalVariableNode < Node
|
305
310
|
include _Node
|
306
311
|
|
307
|
-
|
312
|
+
attr_reader flags: Integer
|
308
313
|
attr_reader name: Symbol
|
309
314
|
|
310
315
|
def initialize: (Source source, Integer flags, Symbol name, Location location) -> void
|
@@ -347,7 +352,7 @@ module Prism
|
|
347
352
|
class BlockParameterNode < Node
|
348
353
|
include _Node
|
349
354
|
|
350
|
-
|
355
|
+
attr_reader flags: Integer
|
351
356
|
attr_reader name: Symbol?
|
352
357
|
attr_reader name_loc: Location?
|
353
358
|
attr_reader operator_loc: Location
|
@@ -414,7 +419,7 @@ module Prism
|
|
414
419
|
class CallAndWriteNode < Node
|
415
420
|
include _Node
|
416
421
|
|
417
|
-
|
422
|
+
attr_reader flags: Integer
|
418
423
|
attr_reader receiver: Prism::node?
|
419
424
|
attr_reader call_operator_loc: Location?
|
420
425
|
attr_reader message_loc: Location?
|
@@ -460,7 +465,7 @@ module Prism
|
|
460
465
|
class CallNode < Node
|
461
466
|
include _Node
|
462
467
|
|
463
|
-
|
468
|
+
attr_reader flags: Integer
|
464
469
|
attr_reader receiver: Prism::node?
|
465
470
|
attr_reader call_operator_loc: Location?
|
466
471
|
attr_reader name: Symbol
|
@@ -493,19 +498,19 @@ module Prism
|
|
493
498
|
class CallOperatorWriteNode < Node
|
494
499
|
include _Node
|
495
500
|
|
496
|
-
|
501
|
+
attr_reader flags: Integer
|
497
502
|
attr_reader receiver: Prism::node?
|
498
503
|
attr_reader call_operator_loc: Location?
|
499
504
|
attr_reader message_loc: Location?
|
500
505
|
attr_reader read_name: Symbol
|
501
506
|
attr_reader write_name: Symbol
|
502
|
-
attr_reader
|
503
|
-
attr_reader
|
507
|
+
attr_reader binary_operator: Symbol
|
508
|
+
attr_reader binary_operator_loc: Location
|
504
509
|
attr_reader value: Prism::node
|
505
510
|
|
506
|
-
def initialize: (Source source, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Symbol
|
507
|
-
def copy: (?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?
|
508
|
-
def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, receiver: Prism::node?, call_operator_loc: Location?, message_loc: Location?, read_name: Symbol, write_name: Symbol,
|
511
|
+
def initialize: (Source source, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location? message_loc, Symbol read_name, Symbol write_name, Symbol binary_operator, Location binary_operator_loc, Prism::node value, Location location) -> void
|
512
|
+
def copy: (?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?binary_operator: Symbol, ?binary_operator_loc: Location, ?value: Prism::node, ?location: Location) -> CallOperatorWriteNode
|
513
|
+
def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, receiver: Prism::node?, call_operator_loc: Location?, message_loc: Location?, read_name: Symbol, write_name: Symbol, binary_operator: Symbol, binary_operator_loc: Location, value: Prism::node, location: Location }
|
509
514
|
def safe_navigation?: () -> bool
|
510
515
|
def variable_call?: () -> bool
|
511
516
|
def attribute_write?: () -> bool
|
@@ -524,7 +529,7 @@ module Prism
|
|
524
529
|
class CallOrWriteNode < Node
|
525
530
|
include _Node
|
526
531
|
|
527
|
-
|
532
|
+
attr_reader flags: Integer
|
528
533
|
attr_reader receiver: Prism::node?
|
529
534
|
attr_reader call_operator_loc: Location?
|
530
535
|
attr_reader message_loc: Location?
|
@@ -563,7 +568,7 @@ module Prism
|
|
563
568
|
class CallTargetNode < Node
|
564
569
|
include _Node
|
565
570
|
|
566
|
-
|
571
|
+
attr_reader flags: Integer
|
567
572
|
attr_reader receiver: Prism::node
|
568
573
|
attr_reader call_operator_loc: Location
|
569
574
|
attr_reader name: Symbol
|
@@ -710,13 +715,13 @@ module Prism
|
|
710
715
|
|
711
716
|
attr_reader name: Symbol
|
712
717
|
attr_reader name_loc: Location
|
713
|
-
attr_reader
|
718
|
+
attr_reader binary_operator_loc: Location
|
714
719
|
attr_reader value: Prism::node
|
715
|
-
attr_reader
|
720
|
+
attr_reader binary_operator: Symbol
|
716
721
|
|
717
|
-
def initialize: (Source source, Symbol name, Location name_loc, Location
|
718
|
-
def copy: (?name: Symbol, ?name_loc: Location, ?
|
719
|
-
def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location,
|
722
|
+
def initialize: (Source source, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator, Location location) -> void
|
723
|
+
def copy: (?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol, ?location: Location) -> ClassVariableOperatorWriteNode
|
724
|
+
def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol, location: Location }
|
720
725
|
def type: () -> :class_variable_operator_write_node
|
721
726
|
| ...
|
722
727
|
def self.type: () -> :class_variable_operator_write_node
|
@@ -828,13 +833,13 @@ module Prism
|
|
828
833
|
|
829
834
|
attr_reader name: Symbol
|
830
835
|
attr_reader name_loc: Location
|
831
|
-
attr_reader
|
836
|
+
attr_reader binary_operator_loc: Location
|
832
837
|
attr_reader value: Prism::node
|
833
|
-
attr_reader
|
838
|
+
attr_reader binary_operator: Symbol
|
834
839
|
|
835
|
-
def initialize: (Source source, Symbol name, Location name_loc, Location
|
836
|
-
def copy: (?name: Symbol, ?name_loc: Location, ?
|
837
|
-
def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location,
|
840
|
+
def initialize: (Source source, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator, Location location) -> void
|
841
|
+
def copy: (?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol, ?location: Location) -> ConstantOperatorWriteNode
|
842
|
+
def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol, location: Location }
|
838
843
|
def type: () -> :constant_operator_write_node
|
839
844
|
| ...
|
840
845
|
def self.type: () -> :constant_operator_write_node
|
@@ -889,12 +894,13 @@ module Prism
|
|
889
894
|
include _Node
|
890
895
|
|
891
896
|
attr_reader parent: Prism::node?
|
892
|
-
attr_reader
|
897
|
+
attr_reader name: Symbol?
|
893
898
|
attr_reader delimiter_loc: Location
|
899
|
+
attr_reader name_loc: Location
|
894
900
|
|
895
|
-
def initialize: (Source source, Prism::node? parent,
|
896
|
-
def copy: (?parent: Prism::node?, ?
|
897
|
-
def deconstruct_keys: (Array[Symbol] keys) -> { parent: Prism::node?,
|
901
|
+
def initialize: (Source source, Prism::node? parent, Symbol? name, Location delimiter_loc, Location name_loc, Location location) -> void
|
902
|
+
def copy: (?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location, ?location: Location) -> ConstantPathNode
|
903
|
+
def deconstruct_keys: (Array[Symbol] keys) -> { parent: Prism::node?, name: Symbol?, delimiter_loc: Location, name_loc: Location, location: Location }
|
898
904
|
def delimiter: () -> String
|
899
905
|
def type: () -> :constant_path_node
|
900
906
|
| ...
|
@@ -909,13 +915,13 @@ module Prism
|
|
909
915
|
include _Node
|
910
916
|
|
911
917
|
attr_reader target: ConstantPathNode
|
912
|
-
attr_reader
|
918
|
+
attr_reader binary_operator_loc: Location
|
913
919
|
attr_reader value: Prism::node
|
914
|
-
attr_reader
|
920
|
+
attr_reader binary_operator: Symbol
|
915
921
|
|
916
|
-
def initialize: (Source source, ConstantPathNode target, Location
|
917
|
-
def copy: (?target: ConstantPathNode, ?
|
918
|
-
def deconstruct_keys: (Array[Symbol] keys) -> { target: ConstantPathNode,
|
922
|
+
def initialize: (Source source, ConstantPathNode target, Location binary_operator_loc, Prism::node value, Symbol binary_operator, Location location) -> void
|
923
|
+
def copy: (?target: ConstantPathNode, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol, ?location: Location) -> ConstantPathOperatorWriteNode
|
924
|
+
def deconstruct_keys: (Array[Symbol] keys) -> { target: ConstantPathNode, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol, location: Location }
|
919
925
|
def type: () -> :constant_path_operator_write_node
|
920
926
|
| ...
|
921
927
|
def self.type: () -> :constant_path_operator_write_node
|
@@ -949,12 +955,13 @@ module Prism
|
|
949
955
|
include _Node
|
950
956
|
|
951
957
|
attr_reader parent: Prism::node?
|
952
|
-
attr_reader
|
958
|
+
attr_reader name: Symbol?
|
953
959
|
attr_reader delimiter_loc: Location
|
960
|
+
attr_reader name_loc: Location
|
954
961
|
|
955
|
-
def initialize: (Source source, Prism::node? parent,
|
956
|
-
def copy: (?parent: Prism::node?, ?
|
957
|
-
def deconstruct_keys: (Array[Symbol] keys) -> { parent: Prism::node?,
|
962
|
+
def initialize: (Source source, Prism::node? parent, Symbol? name, Location delimiter_loc, Location name_loc, Location location) -> void
|
963
|
+
def copy: (?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location, ?location: Location) -> ConstantPathTargetNode
|
964
|
+
def deconstruct_keys: (Array[Symbol] keys) -> { parent: Prism::node?, name: Symbol?, delimiter_loc: Location, name_loc: Location, location: Location }
|
958
965
|
def delimiter: () -> String
|
959
966
|
def type: () -> :constant_path_target_node
|
960
967
|
| ...
|
@@ -1239,7 +1246,7 @@ module Prism
|
|
1239
1246
|
class FlipFlopNode < Node
|
1240
1247
|
include _Node
|
1241
1248
|
|
1242
|
-
|
1249
|
+
attr_reader flags: Integer
|
1243
1250
|
attr_reader left: Prism::node?
|
1244
1251
|
attr_reader right: Prism::node?
|
1245
1252
|
attr_reader operator_loc: Location
|
@@ -1380,13 +1387,13 @@ module Prism
|
|
1380
1387
|
|
1381
1388
|
attr_reader name: Symbol
|
1382
1389
|
attr_reader name_loc: Location
|
1383
|
-
attr_reader
|
1390
|
+
attr_reader binary_operator_loc: Location
|
1384
1391
|
attr_reader value: Prism::node
|
1385
|
-
attr_reader
|
1392
|
+
attr_reader binary_operator: Symbol
|
1386
1393
|
|
1387
|
-
def initialize: (Source source, Symbol name, Location name_loc, Location
|
1388
|
-
def copy: (?name: Symbol, ?name_loc: Location, ?
|
1389
|
-
def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location,
|
1394
|
+
def initialize: (Source source, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator, Location location) -> void
|
1395
|
+
def copy: (?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol, ?location: Location) -> GlobalVariableOperatorWriteNode
|
1396
|
+
def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol, location: Location }
|
1390
1397
|
def type: () -> :global_variable_operator_write_node
|
1391
1398
|
| ...
|
1392
1399
|
def self.type: () -> :global_variable_operator_write_node
|
@@ -1640,7 +1647,7 @@ module Prism
|
|
1640
1647
|
class IndexAndWriteNode < Node
|
1641
1648
|
include _Node
|
1642
1649
|
|
1643
|
-
|
1650
|
+
attr_reader flags: Integer
|
1644
1651
|
attr_reader receiver: Prism::node?
|
1645
1652
|
attr_reader call_operator_loc: Location?
|
1646
1653
|
attr_reader opening_loc: Location
|
@@ -1673,20 +1680,20 @@ module Prism
|
|
1673
1680
|
class IndexOperatorWriteNode < Node
|
1674
1681
|
include _Node
|
1675
1682
|
|
1676
|
-
|
1683
|
+
attr_reader flags: Integer
|
1677
1684
|
attr_reader receiver: Prism::node?
|
1678
1685
|
attr_reader call_operator_loc: Location?
|
1679
1686
|
attr_reader opening_loc: Location
|
1680
1687
|
attr_reader arguments: ArgumentsNode?
|
1681
1688
|
attr_reader closing_loc: Location
|
1682
1689
|
attr_reader block: Prism::node?
|
1683
|
-
attr_reader
|
1684
|
-
attr_reader
|
1690
|
+
attr_reader binary_operator: Symbol
|
1691
|
+
attr_reader binary_operator_loc: Location
|
1685
1692
|
attr_reader value: Prism::node
|
1686
1693
|
|
1687
|
-
def initialize: (Source source, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, Prism::node? block, Symbol
|
1688
|
-
def copy: (?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: Prism::node?, ?
|
1689
|
-
def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, receiver: Prism::node?, call_operator_loc: Location?, opening_loc: Location, arguments: ArgumentsNode?, closing_loc: Location, block: Prism::node?,
|
1694
|
+
def initialize: (Source source, Integer flags, Prism::node? receiver, Location? call_operator_loc, Location opening_loc, ArgumentsNode? arguments, Location closing_loc, Prism::node? block, Symbol binary_operator, Location binary_operator_loc, Prism::node value, Location location) -> void
|
1695
|
+
def copy: (?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: Prism::node?, ?binary_operator: Symbol, ?binary_operator_loc: Location, ?value: Prism::node, ?location: Location) -> IndexOperatorWriteNode
|
1696
|
+
def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, receiver: Prism::node?, call_operator_loc: Location?, opening_loc: Location, arguments: ArgumentsNode?, closing_loc: Location, block: Prism::node?, binary_operator: Symbol, binary_operator_loc: Location, value: Prism::node, location: Location }
|
1690
1697
|
def safe_navigation?: () -> bool
|
1691
1698
|
def variable_call?: () -> bool
|
1692
1699
|
def attribute_write?: () -> bool
|
@@ -1706,7 +1713,7 @@ module Prism
|
|
1706
1713
|
class IndexOrWriteNode < Node
|
1707
1714
|
include _Node
|
1708
1715
|
|
1709
|
-
|
1716
|
+
attr_reader flags: Integer
|
1710
1717
|
attr_reader receiver: Prism::node?
|
1711
1718
|
attr_reader call_operator_loc: Location?
|
1712
1719
|
attr_reader opening_loc: Location
|
@@ -1747,7 +1754,7 @@ module Prism
|
|
1747
1754
|
class IndexTargetNode < Node
|
1748
1755
|
include _Node
|
1749
1756
|
|
1750
|
-
|
1757
|
+
attr_reader flags: Integer
|
1751
1758
|
attr_reader receiver: Prism::node
|
1752
1759
|
attr_reader opening_loc: Location
|
1753
1760
|
attr_reader arguments: ArgumentsNode?
|
@@ -1798,13 +1805,13 @@ module Prism
|
|
1798
1805
|
|
1799
1806
|
attr_reader name: Symbol
|
1800
1807
|
attr_reader name_loc: Location
|
1801
|
-
attr_reader
|
1808
|
+
attr_reader binary_operator_loc: Location
|
1802
1809
|
attr_reader value: Prism::node
|
1803
|
-
attr_reader
|
1810
|
+
attr_reader binary_operator: Symbol
|
1804
1811
|
|
1805
|
-
def initialize: (Source source, Symbol name, Location name_loc, Location
|
1806
|
-
def copy: (?name: Symbol, ?name_loc: Location, ?
|
1807
|
-
def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location,
|
1812
|
+
def initialize: (Source source, Symbol name, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol binary_operator, Location location) -> void
|
1813
|
+
def copy: (?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol, ?location: Location) -> InstanceVariableOperatorWriteNode
|
1814
|
+
def deconstruct_keys: (Array[Symbol] keys) -> { name: Symbol, name_loc: Location, binary_operator_loc: Location, value: Prism::node, binary_operator: Symbol, location: Location }
|
1808
1815
|
def type: () -> :instance_variable_operator_write_node
|
1809
1816
|
| ...
|
1810
1817
|
def self.type: () -> :instance_variable_operator_write_node
|
@@ -1893,7 +1900,7 @@ module Prism
|
|
1893
1900
|
class IntegerNode < Node
|
1894
1901
|
include _Node
|
1895
1902
|
|
1896
|
-
|
1903
|
+
attr_reader flags: Integer
|
1897
1904
|
attr_reader value: Integer
|
1898
1905
|
|
1899
1906
|
def initialize: (Source source, Integer flags, Integer value, Location location) -> void
|
@@ -1915,7 +1922,7 @@ module Prism
|
|
1915
1922
|
class InterpolatedMatchLastLineNode < Node
|
1916
1923
|
include _Node
|
1917
1924
|
|
1918
|
-
|
1925
|
+
attr_reader flags: Integer
|
1919
1926
|
attr_reader opening_loc: Location
|
1920
1927
|
attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode]
|
1921
1928
|
attr_reader closing_loc: Location
|
@@ -1948,7 +1955,7 @@ module Prism
|
|
1948
1955
|
class InterpolatedRegularExpressionNode < Node
|
1949
1956
|
include _Node
|
1950
1957
|
|
1951
|
-
|
1958
|
+
attr_reader flags: Integer
|
1952
1959
|
attr_reader opening_loc: Location
|
1953
1960
|
attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode]
|
1954
1961
|
attr_reader closing_loc: Location
|
@@ -1981,7 +1988,7 @@ module Prism
|
|
1981
1988
|
class InterpolatedStringNode < Node
|
1982
1989
|
include _Node
|
1983
1990
|
|
1984
|
-
|
1991
|
+
attr_reader flags: Integer
|
1985
1992
|
attr_reader opening_loc: Location?
|
1986
1993
|
attr_reader parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode]
|
1987
1994
|
attr_reader closing_loc: Location?
|
@@ -2063,7 +2070,7 @@ module Prism
|
|
2063
2070
|
class KeywordHashNode < Node
|
2064
2071
|
include _Node
|
2065
2072
|
|
2066
|
-
|
2073
|
+
attr_reader flags: Integer
|
2067
2074
|
attr_reader elements: Array[AssocNode | AssocSplatNode]
|
2068
2075
|
|
2069
2076
|
def initialize: (Source source, Integer flags, Array[AssocNode | AssocSplatNode] elements, Location location) -> void
|
@@ -2083,7 +2090,7 @@ module Prism
|
|
2083
2090
|
class KeywordRestParameterNode < Node
|
2084
2091
|
include _Node
|
2085
2092
|
|
2086
|
-
|
2093
|
+
attr_reader flags: Integer
|
2087
2094
|
attr_reader name: Symbol?
|
2088
2095
|
attr_reader name_loc: Location?
|
2089
2096
|
attr_reader operator_loc: Location
|
@@ -2153,15 +2160,15 @@ module Prism
|
|
2153
2160
|
include _Node
|
2154
2161
|
|
2155
2162
|
attr_reader name_loc: Location
|
2156
|
-
attr_reader
|
2163
|
+
attr_reader binary_operator_loc: Location
|
2157
2164
|
attr_reader value: Prism::node
|
2158
2165
|
attr_reader name: Symbol
|
2159
|
-
attr_reader
|
2166
|
+
attr_reader binary_operator: Symbol
|
2160
2167
|
attr_reader depth: Integer
|
2161
2168
|
|
2162
|
-
def initialize: (Source source, Location name_loc, Location
|
2163
|
-
def copy: (?name_loc: Location, ?
|
2164
|
-
def deconstruct_keys: (Array[Symbol] keys) -> { name_loc: Location,
|
2169
|
+
def initialize: (Source source, Location name_loc, Location binary_operator_loc, Prism::node value, Symbol name, Symbol binary_operator, Integer depth, Location location) -> void
|
2170
|
+
def copy: (?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?binary_operator: Symbol, ?depth: Integer, ?location: Location) -> LocalVariableOperatorWriteNode
|
2171
|
+
def deconstruct_keys: (Array[Symbol] keys) -> { name_loc: Location, binary_operator_loc: Location, value: Prism::node, name: Symbol, binary_operator: Symbol, depth: Integer, location: Location }
|
2165
2172
|
def type: () -> :local_variable_operator_write_node
|
2166
2173
|
| ...
|
2167
2174
|
def self.type: () -> :local_variable_operator_write_node
|
@@ -2254,7 +2261,7 @@ module Prism
|
|
2254
2261
|
class MatchLastLineNode < Node
|
2255
2262
|
include _Node
|
2256
2263
|
|
2257
|
-
|
2264
|
+
attr_reader flags: Integer
|
2258
2265
|
attr_reader opening_loc: Location
|
2259
2266
|
attr_reader content_loc: Location
|
2260
2267
|
attr_reader closing_loc: Location
|
@@ -2524,7 +2531,7 @@ module Prism
|
|
2524
2531
|
class OptionalKeywordParameterNode < Node
|
2525
2532
|
include _Node
|
2526
2533
|
|
2527
|
-
|
2534
|
+
attr_reader flags: Integer
|
2528
2535
|
attr_reader name: Symbol
|
2529
2536
|
attr_reader name_loc: Location
|
2530
2537
|
attr_reader value: Prism::node
|
@@ -2546,7 +2553,7 @@ module Prism
|
|
2546
2553
|
class OptionalParameterNode < Node
|
2547
2554
|
include _Node
|
2548
2555
|
|
2549
|
-
|
2556
|
+
attr_reader flags: Integer
|
2550
2557
|
attr_reader name: Symbol
|
2551
2558
|
attr_reader name_loc: Location
|
2552
2559
|
attr_reader operator_loc: Location
|
@@ -2593,14 +2600,14 @@ module Prism
|
|
2593
2600
|
attr_reader requireds: Array[RequiredParameterNode | MultiTargetNode]
|
2594
2601
|
attr_reader optionals: Array[OptionalParameterNode]
|
2595
2602
|
attr_reader rest: RestParameterNode | ImplicitRestNode | nil
|
2596
|
-
attr_reader posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode]
|
2603
|
+
attr_reader posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode | ForwardingParameterNode]
|
2597
2604
|
attr_reader keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode]
|
2598
2605
|
attr_reader keyword_rest: KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil
|
2599
2606
|
attr_reader block: BlockParameterNode?
|
2600
2607
|
|
2601
|
-
def initialize: (Source source, Array[RequiredParameterNode | MultiTargetNode] requireds, Array[OptionalParameterNode] optionals, RestParameterNode | ImplicitRestNode | nil rest, Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode] posts, Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode] keywords, KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil keyword_rest, BlockParameterNode? block, Location location) -> void
|
2602
|
-
def copy: (?requireds: Array[RequiredParameterNode | MultiTargetNode], ?optionals: Array[OptionalParameterNode], ?rest: RestParameterNode | ImplicitRestNode | nil, ?posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode], ?keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], ?keyword_rest: KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil, ?block: BlockParameterNode?, ?location: Location) -> ParametersNode
|
2603
|
-
def deconstruct_keys: (Array[Symbol] keys) -> { requireds: Array[RequiredParameterNode | MultiTargetNode], optionals: Array[OptionalParameterNode], rest: RestParameterNode | ImplicitRestNode | nil, posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode], keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], keyword_rest: KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil, block: BlockParameterNode?, location: Location }
|
2608
|
+
def initialize: (Source source, Array[RequiredParameterNode | MultiTargetNode] requireds, Array[OptionalParameterNode] optionals, RestParameterNode | ImplicitRestNode | nil rest, Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode | ForwardingParameterNode] posts, Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode] keywords, KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil keyword_rest, BlockParameterNode? block, Location location) -> void
|
2609
|
+
def copy: (?requireds: Array[RequiredParameterNode | MultiTargetNode], ?optionals: Array[OptionalParameterNode], ?rest: RestParameterNode | ImplicitRestNode | nil, ?posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode | ForwardingParameterNode], ?keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], ?keyword_rest: KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil, ?block: BlockParameterNode?, ?location: Location) -> ParametersNode
|
2610
|
+
def deconstruct_keys: (Array[Symbol] keys) -> { requireds: Array[RequiredParameterNode | MultiTargetNode], optionals: Array[OptionalParameterNode], rest: RestParameterNode | ImplicitRestNode | nil, posts: Array[RequiredParameterNode | MultiTargetNode | KeywordRestParameterNode | NoKeywordsParameterNode | ForwardingParameterNode], keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], keyword_rest: KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode | nil, block: BlockParameterNode?, location: Location }
|
2604
2611
|
def type: () -> :parameters_node
|
2605
2612
|
| ...
|
2606
2613
|
def self.type: () -> :parameters_node
|
@@ -2740,7 +2747,7 @@ module Prism
|
|
2740
2747
|
class RangeNode < Node
|
2741
2748
|
include _Node
|
2742
2749
|
|
2743
|
-
|
2750
|
+
attr_reader flags: Integer
|
2744
2751
|
attr_reader left: Prism::node?
|
2745
2752
|
attr_reader right: Prism::node?
|
2746
2753
|
attr_reader operator_loc: Location
|
@@ -2795,7 +2802,7 @@ module Prism
|
|
2795
2802
|
class RegularExpressionNode < Node
|
2796
2803
|
include _Node
|
2797
2804
|
|
2798
|
-
|
2805
|
+
attr_reader flags: Integer
|
2799
2806
|
attr_reader opening_loc: Location
|
2800
2807
|
attr_reader content_loc: Location
|
2801
2808
|
attr_reader closing_loc: Location
|
@@ -2831,7 +2838,7 @@ module Prism
|
|
2831
2838
|
class RequiredKeywordParameterNode < Node
|
2832
2839
|
include _Node
|
2833
2840
|
|
2834
|
-
|
2841
|
+
attr_reader flags: Integer
|
2835
2842
|
attr_reader name: Symbol
|
2836
2843
|
attr_reader name_loc: Location
|
2837
2844
|
|
@@ -2852,7 +2859,7 @@ module Prism
|
|
2852
2859
|
class RequiredParameterNode < Node
|
2853
2860
|
include _Node
|
2854
2861
|
|
2855
|
-
|
2862
|
+
attr_reader flags: Integer
|
2856
2863
|
attr_reader name: Symbol
|
2857
2864
|
|
2858
2865
|
def initialize: (Source source, Integer flags, Symbol name, Location location) -> void
|
@@ -2921,7 +2928,7 @@ module Prism
|
|
2921
2928
|
class RestParameterNode < Node
|
2922
2929
|
include _Node
|
2923
2930
|
|
2924
|
-
|
2931
|
+
attr_reader flags: Integer
|
2925
2932
|
attr_reader name: Symbol?
|
2926
2933
|
attr_reader name_loc: Location?
|
2927
2934
|
attr_reader operator_loc: Location
|
@@ -2959,12 +2966,14 @@ module Prism
|
|
2959
2966
|
class ReturnNode < Node
|
2960
2967
|
include _Node
|
2961
2968
|
|
2969
|
+
attr_reader flags: Integer
|
2962
2970
|
attr_reader keyword_loc: Location
|
2963
2971
|
attr_reader arguments: ArgumentsNode?
|
2964
2972
|
|
2965
|
-
def initialize: (Source source, Location keyword_loc, ArgumentsNode? arguments, Location location) -> void
|
2966
|
-
def copy: (?keyword_loc: Location, ?arguments: ArgumentsNode?, ?location: Location) -> ReturnNode
|
2967
|
-
def deconstruct_keys: (Array[Symbol] keys) -> { keyword_loc: Location, arguments: ArgumentsNode?, location: Location }
|
2973
|
+
def initialize: (Source source, Integer flags, Location keyword_loc, ArgumentsNode? arguments, Location location) -> void
|
2974
|
+
def copy: (?flags: Integer, ?keyword_loc: Location, ?arguments: ArgumentsNode?, ?location: Location) -> ReturnNode
|
2975
|
+
def deconstruct_keys: (Array[Symbol] keys) -> { flags: Integer, keyword_loc: Location, arguments: ArgumentsNode?, location: Location }
|
2976
|
+
def redundant?: () -> bool
|
2968
2977
|
def keyword: () -> String
|
2969
2978
|
def type: () -> :return_node
|
2970
2979
|
| ...
|
@@ -2995,7 +3004,7 @@ module Prism
|
|
2995
3004
|
class ShareableConstantNode < Node
|
2996
3005
|
include _Node
|
2997
3006
|
|
2998
|
-
|
3007
|
+
attr_reader flags: Integer
|
2999
3008
|
attr_reader write: ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode
|
3000
3009
|
|
3001
3010
|
def initialize: (Source source, Integer flags, ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode write, Location location) -> void
|
@@ -3057,7 +3066,7 @@ module Prism
|
|
3057
3066
|
class SourceFileNode < Node
|
3058
3067
|
include _Node
|
3059
3068
|
|
3060
|
-
|
3069
|
+
attr_reader flags: Integer
|
3061
3070
|
attr_reader filepath: String
|
3062
3071
|
|
3063
3072
|
def initialize: (Source source, Integer flags, String filepath, Location location) -> void
|
@@ -3137,7 +3146,7 @@ module Prism
|
|
3137
3146
|
class StringNode < Node
|
3138
3147
|
include _Node
|
3139
3148
|
|
3140
|
-
|
3149
|
+
attr_reader flags: Integer
|
3141
3150
|
attr_reader opening_loc: Location?
|
3142
3151
|
attr_reader content_loc: Location
|
3143
3152
|
attr_reader closing_loc: Location?
|
@@ -3195,7 +3204,7 @@ module Prism
|
|
3195
3204
|
class SymbolNode < Node
|
3196
3205
|
include _Node
|
3197
3206
|
|
3198
|
-
|
3207
|
+
attr_reader flags: Integer
|
3199
3208
|
attr_reader opening_loc: Location?
|
3200
3209
|
attr_reader value_loc: Location?
|
3201
3210
|
attr_reader closing_loc: Location?
|
@@ -3288,7 +3297,7 @@ module Prism
|
|
3288
3297
|
class UntilNode < Node
|
3289
3298
|
include _Node
|
3290
3299
|
|
3291
|
-
|
3300
|
+
attr_reader flags: Integer
|
3292
3301
|
attr_reader keyword_loc: Location
|
3293
3302
|
attr_reader closing_loc: Location?
|
3294
3303
|
attr_reader predicate: Prism::node
|
@@ -3339,7 +3348,7 @@ module Prism
|
|
3339
3348
|
class WhileNode < Node
|
3340
3349
|
include _Node
|
3341
3350
|
|
3342
|
-
|
3351
|
+
attr_reader flags: Integer
|
3343
3352
|
attr_reader keyword_loc: Location
|
3344
3353
|
attr_reader closing_loc: Location?
|
3345
3354
|
attr_reader predicate: Prism::node
|
@@ -3363,7 +3372,7 @@ module Prism
|
|
3363
3372
|
class XStringNode < Node
|
3364
3373
|
include _Node
|
3365
3374
|
|
3366
|
-
|
3375
|
+
attr_reader flags: Integer
|
3367
3376
|
attr_reader opening_loc: Location
|
3368
3377
|
attr_reader content_loc: Location
|
3369
3378
|
attr_reader closing_loc: Location
|
@@ -3407,6 +3416,8 @@ module Prism
|
|
3407
3416
|
|
3408
3417
|
# Flags for arguments nodes.
|
3409
3418
|
module ArgumentsNodeFlags
|
3419
|
+
# if arguments contain keywords
|
3420
|
+
CONTAINS_KEYWORDS: Integer
|
3410
3421
|
# if arguments contain keyword splat
|
3411
3422
|
CONTAINS_KEYWORD_SPLAT: Integer
|
3412
3423
|
end
|
@@ -3507,6 +3518,12 @@ module Prism
|
|
3507
3518
|
FORCED_US_ASCII_ENCODING: Integer
|
3508
3519
|
end
|
3509
3520
|
|
3521
|
+
# Flags for return nodes.
|
3522
|
+
module ReturnNodeFlags
|
3523
|
+
# a return statement that is redundant because it is the last statement in a method
|
3524
|
+
REDUNDANT: Integer
|
3525
|
+
end
|
3526
|
+
|
3510
3527
|
# Flags for shareable constant nodes.
|
3511
3528
|
module ShareableConstantNodeFlags
|
3512
3529
|
# constant writes that should be modified with shareable constant value literal
|
data/sig/prism/node_ext.rbs
CHANGED
data/sig/prism/parse_result.rbs
CHANGED
@@ -6,9 +6,11 @@ module Prism
|
|
6
6
|
|
7
7
|
def initialize: (String source, ?Integer start_line, ?Array[Integer] offsets) -> void
|
8
8
|
def encoding: () -> Encoding
|
9
|
+
def lines: () -> Array[String]
|
9
10
|
def slice: (Integer byte_offset, Integer length) -> String
|
10
11
|
def line: (Integer byte_offset) -> Integer
|
11
12
|
def line_start: (Integer byte_offset) -> Integer
|
13
|
+
def line_end: (Integer byte_offset) -> Integer
|
12
14
|
def line_offset: (Integer byte_offset) -> Integer
|
13
15
|
def column: (Integer byte_offset) -> Integer
|
14
16
|
def character_offset: (Integer byte_offset) -> Integer
|
@@ -17,6 +19,13 @@ module Prism
|
|
17
19
|
def code_units_column: (Integer byte_offset, Encoding encoding) -> Integer
|
18
20
|
end
|
19
21
|
|
22
|
+
class ASCIISource < Source
|
23
|
+
def character_offset: (Integer byte_offset) -> Integer
|
24
|
+
def character_column: (Integer byte_offset) -> Integer
|
25
|
+
def code_units_offset: (Integer byte_offset, Encoding encoding) -> Integer
|
26
|
+
def code_units_column: (Integer byte_offset, Encoding encoding) -> Integer
|
27
|
+
end
|
28
|
+
|
20
29
|
class Location
|
21
30
|
attr_reader source: Source
|
22
31
|
attr_reader start_offset: Integer
|
@@ -30,7 +39,9 @@ module Prism
|
|
30
39
|
def comments: () -> Array[comment]
|
31
40
|
def copy: (?source: Source, ?start_offset: Integer, ?length: Integer) -> Location
|
32
41
|
def chop: () -> Location
|
42
|
+
def source_lines: () -> Array[String]
|
33
43
|
def slice: () -> String
|
44
|
+
def slice_lines: () -> String
|
34
45
|
def start_character_offset: () -> Integer
|
35
46
|
def end_offset: () -> Integer
|
36
47
|
def end_character_offset: () -> Integer
|
@@ -44,6 +55,7 @@ module Prism
|
|
44
55
|
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
|
45
56
|
def pretty_print: (untyped q) -> untyped
|
46
57
|
def join: (Location other) -> Location
|
58
|
+
def adjoin: (String string) -> Location
|
47
59
|
end
|
48
60
|
|
49
61
|
class Comment
|