prism 0.30.0 → 1.0.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 +31 -1
- data/README.md +3 -1
- data/config.yml +185 -126
- data/docs/serialization.md +3 -0
- data/ext/prism/api_node.c +2843 -2085
- data/ext/prism/extconf.rb +1 -1
- data/ext/prism/extension.c +35 -25
- data/ext/prism/extension.h +2 -2
- data/include/prism/ast.h +1048 -69
- data/include/prism/defines.h +9 -0
- data/include/prism/diagnostic.h +11 -3
- data/include/prism/options.h +55 -1
- data/include/prism/parser.h +27 -3
- data/include/prism/regexp.h +2 -1
- data/include/prism/util/pm_integer.h +6 -6
- data/include/prism/util/pm_newline_list.h +11 -0
- data/include/prism/util/pm_string.h +1 -0
- data/include/prism/version.h +3 -3
- data/lib/prism/desugar_compiler.rb +111 -74
- data/lib/prism/dispatcher.rb +2 -1
- data/lib/prism/dot_visitor.rb +21 -31
- data/lib/prism/dsl.rb +656 -471
- data/lib/prism/ffi.rb +3 -0
- data/lib/prism/inspect_visitor.rb +285 -57
- data/lib/prism/mutation_compiler.rb +5 -5
- data/lib/prism/node.rb +2282 -4754
- data/lib/prism/node_ext.rb +72 -11
- data/lib/prism/parse_result/errors.rb +65 -0
- data/lib/prism/parse_result/newlines.rb +28 -28
- data/lib/prism/parse_result.rb +25 -2
- data/lib/prism/reflection.rb +7 -7
- data/lib/prism/serialize.rb +468 -610
- data/lib/prism/translation/parser/compiler.rb +18 -18
- data/lib/prism/translation/parser/lexer.rb +1 -1
- data/lib/prism/translation/parser.rb +3 -3
- data/lib/prism/translation/ripper.rb +14 -14
- data/lib/prism/translation/ruby_parser.rb +43 -7
- data/prism.gemspec +3 -1
- data/rbi/prism/dsl.rbi +521 -0
- data/rbi/prism/node.rbi +1456 -5616
- data/rbi/prism.rbi +16 -16
- data/sig/prism/dsl.rbs +189 -305
- data/sig/prism/node.rbs +702 -603
- data/sig/prism/parse_result.rbs +2 -0
- data/src/diagnostic.c +22 -6
- data/src/node.c +277 -284
- data/src/options.c +18 -0
- data/src/prettyprint.c +99 -108
- data/src/prism.c +1282 -760
- data/src/regexp.c +72 -4
- data/src/serialize.c +165 -50
- data/src/token_type.c +2 -2
- data/src/util/pm_integer.c +14 -14
- data/src/util/pm_newline_list.c +29 -0
- data/src/util/pm_string.c +9 -5
- metadata +4 -2
data/lib/prism/dot_visitor.rb
CHANGED
@@ -909,10 +909,10 @@ module Prism
|
|
909
909
|
table.field("conditions", "[]")
|
910
910
|
end
|
911
911
|
|
912
|
-
#
|
913
|
-
unless (
|
914
|
-
table.field("
|
915
|
-
digraph.edge("#{id}:
|
912
|
+
# else_clause
|
913
|
+
unless (else_clause = node.else_clause).nil?
|
914
|
+
table.field("else_clause", port: true)
|
915
|
+
digraph.edge("#{id}:else_clause -> #{node_id(else_clause)};")
|
916
916
|
end
|
917
917
|
|
918
918
|
# case_keyword_loc
|
@@ -954,10 +954,10 @@ module Prism
|
|
954
954
|
table.field("conditions", "[]")
|
955
955
|
end
|
956
956
|
|
957
|
-
#
|
958
|
-
unless (
|
959
|
-
table.field("
|
960
|
-
digraph.edge("#{id}:
|
957
|
+
# else_clause
|
958
|
+
unless (else_clause = node.else_clause).nil?
|
959
|
+
table.field("else_clause", port: true)
|
960
|
+
digraph.edge("#{id}:else_clause -> #{node_id(else_clause)};")
|
961
961
|
end
|
962
962
|
|
963
963
|
# case_keyword_loc
|
@@ -2130,10 +2130,10 @@ module Prism
|
|
2130
2130
|
digraph.edge("#{id}:statements -> #{node_id(statements)};")
|
2131
2131
|
end
|
2132
2132
|
|
2133
|
-
#
|
2134
|
-
unless (
|
2135
|
-
table.field("
|
2136
|
-
digraph.edge("#{id}:
|
2133
|
+
# subsequent
|
2134
|
+
unless (subsequent = node.subsequent).nil?
|
2135
|
+
table.field("subsequent", port: true)
|
2136
|
+
digraph.edge("#{id}:subsequent -> #{node_id(subsequent)};")
|
2137
2137
|
end
|
2138
2138
|
|
2139
2139
|
# end_keyword_loc
|
@@ -3960,10 +3960,10 @@ module Prism
|
|
3960
3960
|
digraph.edge("#{id}:statements -> #{node_id(statements)};")
|
3961
3961
|
end
|
3962
3962
|
|
3963
|
-
#
|
3964
|
-
unless (
|
3965
|
-
table.field("
|
3966
|
-
digraph.edge("#{id}:
|
3963
|
+
# subsequent
|
3964
|
+
unless (subsequent = node.subsequent).nil?
|
3965
|
+
table.field("subsequent", port: true)
|
3966
|
+
digraph.edge("#{id}:subsequent -> #{node_id(subsequent)};")
|
3967
3967
|
end
|
3968
3968
|
|
3969
3969
|
digraph.nodes << <<~DOT
|
@@ -4022,9 +4022,6 @@ module Prism
|
|
4022
4022
|
table = Table.new("ReturnNode")
|
4023
4023
|
id = node_id(node)
|
4024
4024
|
|
4025
|
-
# flags
|
4026
|
-
table.field("flags", return_node_flags_inspect(node))
|
4027
|
-
|
4028
4025
|
# keyword_loc
|
4029
4026
|
table.field("keyword_loc", location_inspect(node.keyword_loc))
|
4030
4027
|
|
@@ -4386,10 +4383,10 @@ module Prism
|
|
4386
4383
|
digraph.edge("#{id}:statements -> #{node_id(statements)};")
|
4387
4384
|
end
|
4388
4385
|
|
4389
|
-
#
|
4390
|
-
unless (
|
4391
|
-
table.field("
|
4392
|
-
digraph.edge("#{id}:
|
4386
|
+
# else_clause
|
4387
|
+
unless (else_clause = node.else_clause).nil?
|
4388
|
+
table.field("else_clause", port: true)
|
4389
|
+
digraph.edge("#{id}:else_clause -> #{node_id(else_clause)};")
|
4393
4390
|
end
|
4394
4391
|
|
4395
4392
|
# end_keyword_loc
|
@@ -4597,6 +4594,7 @@ module Prism
|
|
4597
4594
|
flags = [] #: Array[String]
|
4598
4595
|
flags << "contains_keywords" if node.contains_keywords?
|
4599
4596
|
flags << "contains_keyword_splat" if node.contains_keyword_splat?
|
4597
|
+
flags << "contains_splat" if node.contains_splat?
|
4600
4598
|
flags.join(", ")
|
4601
4599
|
end
|
4602
4600
|
|
@@ -4698,14 +4696,6 @@ module Prism
|
|
4698
4696
|
flags.join(", ")
|
4699
4697
|
end
|
4700
4698
|
|
4701
|
-
# Inspect a node that has return_node_flags flags to display the flags as a
|
4702
|
-
# comma-separated list.
|
4703
|
-
def return_node_flags_inspect(node)
|
4704
|
-
flags = [] #: Array[String]
|
4705
|
-
flags << "redundant" if node.redundant?
|
4706
|
-
flags.join(", ")
|
4707
|
-
end
|
4708
|
-
|
4709
4699
|
# Inspect a node that has shareable_constant_node_flags flags to display the flags as a
|
4710
4700
|
# comma-separated list.
|
4711
4701
|
def shareable_constant_node_flags_inspect(node)
|