prism 0.17.1 → 0.18.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 +30 -1
- data/Makefile +5 -5
- data/README.md +2 -2
- data/config.yml +26 -13
- data/docs/build_system.md +6 -6
- data/docs/building.md +1 -1
- data/docs/configuration.md +1 -0
- data/docs/encoding.md +68 -32
- data/docs/heredocs.md +1 -1
- data/docs/javascript.md +29 -1
- data/docs/ruby_api.md +14 -0
- data/ext/prism/api_node.c +74 -45
- data/ext/prism/extconf.rb +91 -127
- data/ext/prism/extension.c +1 -1
- data/ext/prism/extension.h +1 -1
- data/include/prism/ast.h +148 -133
- data/include/prism/diagnostic.h +27 -1
- data/include/prism/enc/pm_encoding.h +42 -1
- data/include/prism/parser.h +6 -0
- data/include/prism/version.h +3 -3
- data/lib/prism/compiler.rb +3 -3
- data/lib/prism/debug.rb +4 -0
- data/lib/prism/desugar_compiler.rb +1 -0
- data/lib/prism/dispatcher.rb +14 -14
- data/lib/prism/dot_visitor.rb +4334 -0
- data/lib/prism/dsl.rb +11 -11
- data/lib/prism/ffi.rb +3 -3
- data/lib/prism/mutation_compiler.rb +6 -6
- data/lib/prism/node.rb +182 -113
- data/lib/prism/node_ext.rb +61 -3
- data/lib/prism/parse_result.rb +46 -12
- data/lib/prism/serialize.rb +125 -131
- data/lib/prism/visitor.rb +3 -3
- data/lib/prism.rb +1 -0
- data/prism.gemspec +5 -1
- data/rbi/prism.rbi +83 -54
- data/sig/prism.rbs +47 -32
- data/src/diagnostic.c +61 -3
- data/src/enc/pm_big5.c +63 -0
- data/src/enc/pm_cp51932.c +57 -0
- data/src/enc/pm_euc_jp.c +10 -0
- data/src/enc/pm_gbk.c +5 -2
- data/src/enc/pm_tables.c +1478 -148
- data/src/node.c +33 -21
- data/src/prettyprint.c +1027 -925
- data/src/prism.c +925 -374
- data/src/regexp.c +12 -12
- data/src/serialize.c +36 -9
- metadata +6 -2
data/include/prism/version.h
CHANGED
@@ -14,16 +14,16 @@
|
|
14
14
|
/**
|
15
15
|
* The minor version of the Prism library as an int.
|
16
16
|
*/
|
17
|
-
#define PRISM_VERSION_MINOR
|
17
|
+
#define PRISM_VERSION_MINOR 18
|
18
18
|
|
19
19
|
/**
|
20
20
|
* The patch version of the Prism library as an int.
|
21
21
|
*/
|
22
|
-
#define PRISM_VERSION_PATCH
|
22
|
+
#define PRISM_VERSION_PATCH 0
|
23
23
|
|
24
24
|
/**
|
25
25
|
* The version of the Prism library as a constant string.
|
26
26
|
*/
|
27
|
-
#define PRISM_VERSION "0.
|
27
|
+
#define PRISM_VERSION "0.18.0"
|
28
28
|
|
29
29
|
#endif
|
data/lib/prism/compiler.rb
CHANGED
@@ -105,6 +105,9 @@ module Prism
|
|
105
105
|
# Compile a CapturePatternNode node
|
106
106
|
alias visit_capture_pattern_node visit_child_nodes
|
107
107
|
|
108
|
+
# Compile a CaseMatchNode node
|
109
|
+
alias visit_case_match_node visit_child_nodes
|
110
|
+
|
108
111
|
# Compile a CaseNode node
|
109
112
|
alias visit_case_node visit_child_nodes
|
110
113
|
|
@@ -435,9 +438,6 @@ module Prism
|
|
435
438
|
# Compile a StatementsNode node
|
436
439
|
alias visit_statements_node visit_child_nodes
|
437
440
|
|
438
|
-
# Compile a StringConcatNode node
|
439
|
-
alias visit_string_concat_node visit_child_nodes
|
440
|
-
|
441
441
|
# Compile a StringNode node
|
442
442
|
alias visit_string_node visit_child_nodes
|
443
443
|
|
data/lib/prism/debug.rb
CHANGED
@@ -133,6 +133,10 @@ module Prism
|
|
133
133
|
*params.keywords.grep(OptionalKeywordParameterNode).map(&:name),
|
134
134
|
]
|
135
135
|
|
136
|
+
if params.keyword_rest.is_a?(ForwardingParameterNode)
|
137
|
+
sorted.push(:*, :&, :"...")
|
138
|
+
end
|
139
|
+
|
136
140
|
sorted << AnonymousLocal if params.keywords.any?
|
137
141
|
|
138
142
|
# Recurse down the parameter tree to find any destructured
|
@@ -188,6 +188,7 @@ module Prism
|
|
188
188
|
IfNode.new(
|
189
189
|
node.operator_loc,
|
190
190
|
DefinedNode.new(nil, read_class.new(*arguments, node.name_loc), nil, node.operator_loc, node.name_loc),
|
191
|
+
node.operator_loc,
|
191
192
|
StatementsNode.new([read_class.new(*arguments, node.name_loc)], node.location),
|
192
193
|
ElseNode.new(
|
193
194
|
node.operator_loc,
|
data/lib/prism/dispatcher.rb
CHANGED
@@ -241,6 +241,14 @@ module Prism
|
|
241
241
|
listeners[:on_capture_pattern_node_leave]&.each { |listener| listener.on_capture_pattern_node_leave(node) }
|
242
242
|
end
|
243
243
|
|
244
|
+
# Dispatch enter and leave events for CaseMatchNode nodes and continue
|
245
|
+
# walking the tree.
|
246
|
+
def visit_case_match_node(node)
|
247
|
+
listeners[:on_case_match_node_enter]&.each { |listener| listener.on_case_match_node_enter(node) }
|
248
|
+
super
|
249
|
+
listeners[:on_case_match_node_leave]&.each { |listener| listener.on_case_match_node_leave(node) }
|
250
|
+
end
|
251
|
+
|
244
252
|
# Dispatch enter and leave events for CaseNode nodes and continue
|
245
253
|
# walking the tree.
|
246
254
|
def visit_case_node(node)
|
@@ -1121,14 +1129,6 @@ module Prism
|
|
1121
1129
|
listeners[:on_statements_node_leave]&.each { |listener| listener.on_statements_node_leave(node) }
|
1122
1130
|
end
|
1123
1131
|
|
1124
|
-
# Dispatch enter and leave events for StringConcatNode nodes and continue
|
1125
|
-
# walking the tree.
|
1126
|
-
def visit_string_concat_node(node)
|
1127
|
-
listeners[:on_string_concat_node_enter]&.each { |listener| listener.on_string_concat_node_enter(node) }
|
1128
|
-
super
|
1129
|
-
listeners[:on_string_concat_node_leave]&.each { |listener| listener.on_string_concat_node_leave(node) }
|
1130
|
-
end
|
1131
|
-
|
1132
1132
|
# Dispatch enter and leave events for StringNode nodes and continue
|
1133
1133
|
# walking the tree.
|
1134
1134
|
def visit_string_node(node)
|
@@ -1356,6 +1356,12 @@ module Prism
|
|
1356
1356
|
listeners[:on_capture_pattern_node_leave]&.each { |listener| listener.on_capture_pattern_node_leave(node) }
|
1357
1357
|
end
|
1358
1358
|
|
1359
|
+
# Dispatch enter and leave events for CaseMatchNode nodes.
|
1360
|
+
def visit_case_match_node(node)
|
1361
|
+
listeners[:on_case_match_node_enter]&.each { |listener| listener.on_case_match_node_enter(node) }
|
1362
|
+
listeners[:on_case_match_node_leave]&.each { |listener| listener.on_case_match_node_leave(node) }
|
1363
|
+
end
|
1364
|
+
|
1359
1365
|
# Dispatch enter and leave events for CaseNode nodes.
|
1360
1366
|
def visit_case_node(node)
|
1361
1367
|
listeners[:on_case_node_enter]&.each { |listener| listener.on_case_node_enter(node) }
|
@@ -2016,12 +2022,6 @@ module Prism
|
|
2016
2022
|
listeners[:on_statements_node_leave]&.each { |listener| listener.on_statements_node_leave(node) }
|
2017
2023
|
end
|
2018
2024
|
|
2019
|
-
# Dispatch enter and leave events for StringConcatNode nodes.
|
2020
|
-
def visit_string_concat_node(node)
|
2021
|
-
listeners[:on_string_concat_node_enter]&.each { |listener| listener.on_string_concat_node_enter(node) }
|
2022
|
-
listeners[:on_string_concat_node_leave]&.each { |listener| listener.on_string_concat_node_leave(node) }
|
2023
|
-
end
|
2024
|
-
|
2025
2025
|
# Dispatch enter and leave events for StringNode nodes.
|
2026
2026
|
def visit_string_node(node)
|
2027
2027
|
listeners[:on_string_node_enter]&.each { |listener| listener.on_string_node_enter(node) }
|