prism 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +172 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +62 -0
- data/LICENSE.md +7 -0
- data/Makefile +84 -0
- data/README.md +89 -0
- data/config.yml +2481 -0
- data/docs/build_system.md +74 -0
- data/docs/building.md +22 -0
- data/docs/configuration.md +60 -0
- data/docs/design.md +53 -0
- data/docs/encoding.md +117 -0
- data/docs/fuzzing.md +93 -0
- data/docs/heredocs.md +36 -0
- data/docs/mapping.md +117 -0
- data/docs/ripper.md +36 -0
- data/docs/ruby_api.md +25 -0
- data/docs/serialization.md +181 -0
- data/docs/testing.md +55 -0
- data/ext/prism/api_node.c +4725 -0
- data/ext/prism/api_pack.c +256 -0
- data/ext/prism/extconf.rb +136 -0
- data/ext/prism/extension.c +626 -0
- data/ext/prism/extension.h +18 -0
- data/include/prism/ast.h +1932 -0
- data/include/prism/defines.h +45 -0
- data/include/prism/diagnostic.h +231 -0
- data/include/prism/enc/pm_encoding.h +95 -0
- data/include/prism/node.h +41 -0
- data/include/prism/pack.h +141 -0
- data/include/prism/parser.h +418 -0
- data/include/prism/regexp.h +19 -0
- data/include/prism/unescape.h +48 -0
- data/include/prism/util/pm_buffer.h +51 -0
- data/include/prism/util/pm_char.h +91 -0
- data/include/prism/util/pm_constant_pool.h +78 -0
- data/include/prism/util/pm_list.h +67 -0
- data/include/prism/util/pm_memchr.h +14 -0
- data/include/prism/util/pm_newline_list.h +61 -0
- data/include/prism/util/pm_state_stack.h +24 -0
- data/include/prism/util/pm_string.h +61 -0
- data/include/prism/util/pm_string_list.h +25 -0
- data/include/prism/util/pm_strpbrk.h +29 -0
- data/include/prism/version.h +4 -0
- data/include/prism.h +82 -0
- data/lib/prism/compiler.rb +465 -0
- data/lib/prism/debug.rb +157 -0
- data/lib/prism/desugar_compiler.rb +206 -0
- data/lib/prism/dispatcher.rb +2051 -0
- data/lib/prism/dsl.rb +750 -0
- data/lib/prism/ffi.rb +251 -0
- data/lib/prism/lex_compat.rb +838 -0
- data/lib/prism/mutation_compiler.rb +718 -0
- data/lib/prism/node.rb +14540 -0
- data/lib/prism/node_ext.rb +55 -0
- data/lib/prism/node_inspector.rb +68 -0
- data/lib/prism/pack.rb +185 -0
- data/lib/prism/parse_result/comments.rb +172 -0
- data/lib/prism/parse_result/newlines.rb +60 -0
- data/lib/prism/parse_result.rb +266 -0
- data/lib/prism/pattern.rb +239 -0
- data/lib/prism/ripper_compat.rb +174 -0
- data/lib/prism/serialize.rb +662 -0
- data/lib/prism/visitor.rb +470 -0
- data/lib/prism.rb +64 -0
- data/prism.gemspec +113 -0
- data/src/diagnostic.c +287 -0
- data/src/enc/pm_big5.c +52 -0
- data/src/enc/pm_euc_jp.c +58 -0
- data/src/enc/pm_gbk.c +61 -0
- data/src/enc/pm_shift_jis.c +56 -0
- data/src/enc/pm_tables.c +507 -0
- data/src/enc/pm_unicode.c +2324 -0
- data/src/enc/pm_windows_31j.c +56 -0
- data/src/node.c +2633 -0
- data/src/pack.c +493 -0
- data/src/prettyprint.c +2136 -0
- data/src/prism.c +14587 -0
- data/src/regexp.c +580 -0
- data/src/serialize.c +1899 -0
- data/src/token_type.c +349 -0
- data/src/unescape.c +637 -0
- data/src/util/pm_buffer.c +103 -0
- data/src/util/pm_char.c +272 -0
- data/src/util/pm_constant_pool.c +252 -0
- data/src/util/pm_list.c +41 -0
- data/src/util/pm_memchr.c +33 -0
- data/src/util/pm_newline_list.c +134 -0
- data/src/util/pm_state_stack.c +19 -0
- data/src/util/pm_string.c +200 -0
- data/src/util/pm_string_list.c +29 -0
- data/src/util/pm_strncasecmp.c +17 -0
- data/src/util/pm_strpbrk.c +66 -0
- metadata +138 -0
data/lib/prism/dsl.rb
ADDED
@@ -0,0 +1,750 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
=begin
|
3
|
+
This file is generated by the templates/template.rb script and should not be
|
4
|
+
modified manually. See templates/lib/prism/dsl.rb.erb
|
5
|
+
if you are looking to modify the template
|
6
|
+
=end
|
7
|
+
|
8
|
+
module Prism
|
9
|
+
# The DSL module provides a set of methods that can be used to create prism
|
10
|
+
# nodes in a more concise manner. For example, instead of writing:
|
11
|
+
#
|
12
|
+
# source = Prism::Source.new("[1]")
|
13
|
+
#
|
14
|
+
# Prism::ArrayNode.new(
|
15
|
+
# [
|
16
|
+
# Prism::IntegerNode.new(
|
17
|
+
# Prism::IntegerBaseFlags::DECIMAL,
|
18
|
+
# Prism::Location.new(source, 1, 1),
|
19
|
+
# )
|
20
|
+
# ],
|
21
|
+
# Prism::Location.new(source, 0, 1),
|
22
|
+
# Prism::Location.new(source, 2, 1)
|
23
|
+
# )
|
24
|
+
#
|
25
|
+
# you could instead write:
|
26
|
+
#
|
27
|
+
# source = Prism::Source.new("[1]")
|
28
|
+
#
|
29
|
+
# ArrayNode(
|
30
|
+
# IntegerNode(Prism::IntegerBaseFlags::DECIMAL, Location(source, 1, 1))),
|
31
|
+
# Location(source, 0, 1),
|
32
|
+
# Location(source, 2, 1)
|
33
|
+
# )
|
34
|
+
#
|
35
|
+
# This is mostly helpful in the context of writing tests, but can also be used
|
36
|
+
# to generate trees programmatically.
|
37
|
+
module DSL
|
38
|
+
private
|
39
|
+
|
40
|
+
# Create a new Location object
|
41
|
+
def Location(source = nil, start_offset = 0, length = 0)
|
42
|
+
Location.new(source, start_offset, length)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Create a new AliasGlobalVariableNode node
|
46
|
+
def AliasGlobalVariableNode(new_name, old_name, keyword_loc, location = Location())
|
47
|
+
AliasGlobalVariableNode.new(new_name, old_name, keyword_loc, location)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Create a new AliasMethodNode node
|
51
|
+
def AliasMethodNode(new_name, old_name, keyword_loc, location = Location())
|
52
|
+
AliasMethodNode.new(new_name, old_name, keyword_loc, location)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Create a new AlternationPatternNode node
|
56
|
+
def AlternationPatternNode(left, right, operator_loc, location = Location())
|
57
|
+
AlternationPatternNode.new(left, right, operator_loc, location)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Create a new AndNode node
|
61
|
+
def AndNode(left, right, operator_loc, location = Location())
|
62
|
+
AndNode.new(left, right, operator_loc, location)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Create a new ArgumentsNode node
|
66
|
+
def ArgumentsNode(arguments, location = Location())
|
67
|
+
ArgumentsNode.new(arguments, location)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Create a new ArrayNode node
|
71
|
+
def ArrayNode(elements, opening_loc, closing_loc, location = Location())
|
72
|
+
ArrayNode.new(elements, opening_loc, closing_loc, location)
|
73
|
+
end
|
74
|
+
|
75
|
+
# Create a new ArrayPatternNode node
|
76
|
+
def ArrayPatternNode(constant, requireds, rest, posts, opening_loc, closing_loc, location = Location())
|
77
|
+
ArrayPatternNode.new(constant, requireds, rest, posts, opening_loc, closing_loc, location)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Create a new AssocNode node
|
81
|
+
def AssocNode(key, value, operator_loc, location = Location())
|
82
|
+
AssocNode.new(key, value, operator_loc, location)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Create a new AssocSplatNode node
|
86
|
+
def AssocSplatNode(value, operator_loc, location = Location())
|
87
|
+
AssocSplatNode.new(value, operator_loc, location)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Create a new BackReferenceReadNode node
|
91
|
+
def BackReferenceReadNode(location = Location())
|
92
|
+
BackReferenceReadNode.new(location)
|
93
|
+
end
|
94
|
+
|
95
|
+
# Create a new BeginNode node
|
96
|
+
def BeginNode(begin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc, location = Location())
|
97
|
+
BeginNode.new(begin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc, location)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Create a new BlockArgumentNode node
|
101
|
+
def BlockArgumentNode(expression, operator_loc, location = Location())
|
102
|
+
BlockArgumentNode.new(expression, operator_loc, location)
|
103
|
+
end
|
104
|
+
|
105
|
+
# Create a new BlockLocalVariableNode node
|
106
|
+
def BlockLocalVariableNode(name, location = Location())
|
107
|
+
BlockLocalVariableNode.new(name, location)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Create a new BlockNode node
|
111
|
+
def BlockNode(locals, parameters, body, opening_loc, closing_loc, location = Location())
|
112
|
+
BlockNode.new(locals, parameters, body, opening_loc, closing_loc, location)
|
113
|
+
end
|
114
|
+
|
115
|
+
# Create a new BlockParameterNode node
|
116
|
+
def BlockParameterNode(name, name_loc, operator_loc, location = Location())
|
117
|
+
BlockParameterNode.new(name, name_loc, operator_loc, location)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Create a new BlockParametersNode node
|
121
|
+
def BlockParametersNode(parameters, locals, opening_loc, closing_loc, location = Location())
|
122
|
+
BlockParametersNode.new(parameters, locals, opening_loc, closing_loc, location)
|
123
|
+
end
|
124
|
+
|
125
|
+
# Create a new BreakNode node
|
126
|
+
def BreakNode(arguments, keyword_loc, location = Location())
|
127
|
+
BreakNode.new(arguments, keyword_loc, location)
|
128
|
+
end
|
129
|
+
|
130
|
+
# Create a new CallAndWriteNode node
|
131
|
+
def CallAndWriteNode(receiver, call_operator_loc, message_loc, opening_loc, arguments, closing_loc, flags, read_name, write_name, operator_loc, value, location = Location())
|
132
|
+
CallAndWriteNode.new(receiver, call_operator_loc, message_loc, opening_loc, arguments, closing_loc, flags, read_name, write_name, operator_loc, value, location)
|
133
|
+
end
|
134
|
+
|
135
|
+
# Create a new CallNode node
|
136
|
+
def CallNode(receiver, call_operator_loc, message_loc, opening_loc, arguments, closing_loc, block, flags, name, location = Location())
|
137
|
+
CallNode.new(receiver, call_operator_loc, message_loc, opening_loc, arguments, closing_loc, block, flags, name, location)
|
138
|
+
end
|
139
|
+
|
140
|
+
# Create a new CallOperatorWriteNode node
|
141
|
+
def CallOperatorWriteNode(receiver, call_operator_loc, message_loc, opening_loc, arguments, closing_loc, flags, read_name, write_name, operator, operator_loc, value, location = Location())
|
142
|
+
CallOperatorWriteNode.new(receiver, call_operator_loc, message_loc, opening_loc, arguments, closing_loc, flags, read_name, write_name, operator, operator_loc, value, location)
|
143
|
+
end
|
144
|
+
|
145
|
+
# Create a new CallOrWriteNode node
|
146
|
+
def CallOrWriteNode(receiver, call_operator_loc, message_loc, opening_loc, arguments, closing_loc, flags, read_name, write_name, operator_loc, value, location = Location())
|
147
|
+
CallOrWriteNode.new(receiver, call_operator_loc, message_loc, opening_loc, arguments, closing_loc, flags, read_name, write_name, operator_loc, value, location)
|
148
|
+
end
|
149
|
+
|
150
|
+
# Create a new CapturePatternNode node
|
151
|
+
def CapturePatternNode(value, target, operator_loc, location = Location())
|
152
|
+
CapturePatternNode.new(value, target, operator_loc, location)
|
153
|
+
end
|
154
|
+
|
155
|
+
# Create a new CaseNode node
|
156
|
+
def CaseNode(predicate, conditions, consequent, case_keyword_loc, end_keyword_loc, location = Location())
|
157
|
+
CaseNode.new(predicate, conditions, consequent, case_keyword_loc, end_keyword_loc, location)
|
158
|
+
end
|
159
|
+
|
160
|
+
# Create a new ClassNode node
|
161
|
+
def ClassNode(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name, location = Location())
|
162
|
+
ClassNode.new(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name, location)
|
163
|
+
end
|
164
|
+
|
165
|
+
# Create a new ClassVariableAndWriteNode node
|
166
|
+
def ClassVariableAndWriteNode(name, name_loc, operator_loc, value, location = Location())
|
167
|
+
ClassVariableAndWriteNode.new(name, name_loc, operator_loc, value, location)
|
168
|
+
end
|
169
|
+
|
170
|
+
# Create a new ClassVariableOperatorWriteNode node
|
171
|
+
def ClassVariableOperatorWriteNode(name, name_loc, operator_loc, value, operator, location = Location())
|
172
|
+
ClassVariableOperatorWriteNode.new(name, name_loc, operator_loc, value, operator, location)
|
173
|
+
end
|
174
|
+
|
175
|
+
# Create a new ClassVariableOrWriteNode node
|
176
|
+
def ClassVariableOrWriteNode(name, name_loc, operator_loc, value, location = Location())
|
177
|
+
ClassVariableOrWriteNode.new(name, name_loc, operator_loc, value, location)
|
178
|
+
end
|
179
|
+
|
180
|
+
# Create a new ClassVariableReadNode node
|
181
|
+
def ClassVariableReadNode(name, location = Location())
|
182
|
+
ClassVariableReadNode.new(name, location)
|
183
|
+
end
|
184
|
+
|
185
|
+
# Create a new ClassVariableTargetNode node
|
186
|
+
def ClassVariableTargetNode(name, location = Location())
|
187
|
+
ClassVariableTargetNode.new(name, location)
|
188
|
+
end
|
189
|
+
|
190
|
+
# Create a new ClassVariableWriteNode node
|
191
|
+
def ClassVariableWriteNode(name, name_loc, value, operator_loc, location = Location())
|
192
|
+
ClassVariableWriteNode.new(name, name_loc, value, operator_loc, location)
|
193
|
+
end
|
194
|
+
|
195
|
+
# Create a new ConstantAndWriteNode node
|
196
|
+
def ConstantAndWriteNode(name, name_loc, operator_loc, value, location = Location())
|
197
|
+
ConstantAndWriteNode.new(name, name_loc, operator_loc, value, location)
|
198
|
+
end
|
199
|
+
|
200
|
+
# Create a new ConstantOperatorWriteNode node
|
201
|
+
def ConstantOperatorWriteNode(name, name_loc, operator_loc, value, operator, location = Location())
|
202
|
+
ConstantOperatorWriteNode.new(name, name_loc, operator_loc, value, operator, location)
|
203
|
+
end
|
204
|
+
|
205
|
+
# Create a new ConstantOrWriteNode node
|
206
|
+
def ConstantOrWriteNode(name, name_loc, operator_loc, value, location = Location())
|
207
|
+
ConstantOrWriteNode.new(name, name_loc, operator_loc, value, location)
|
208
|
+
end
|
209
|
+
|
210
|
+
# Create a new ConstantPathAndWriteNode node
|
211
|
+
def ConstantPathAndWriteNode(target, operator_loc, value, location = Location())
|
212
|
+
ConstantPathAndWriteNode.new(target, operator_loc, value, location)
|
213
|
+
end
|
214
|
+
|
215
|
+
# Create a new ConstantPathNode node
|
216
|
+
def ConstantPathNode(parent, child, delimiter_loc, location = Location())
|
217
|
+
ConstantPathNode.new(parent, child, delimiter_loc, location)
|
218
|
+
end
|
219
|
+
|
220
|
+
# Create a new ConstantPathOperatorWriteNode node
|
221
|
+
def ConstantPathOperatorWriteNode(target, operator_loc, value, operator, location = Location())
|
222
|
+
ConstantPathOperatorWriteNode.new(target, operator_loc, value, operator, location)
|
223
|
+
end
|
224
|
+
|
225
|
+
# Create a new ConstantPathOrWriteNode node
|
226
|
+
def ConstantPathOrWriteNode(target, operator_loc, value, location = Location())
|
227
|
+
ConstantPathOrWriteNode.new(target, operator_loc, value, location)
|
228
|
+
end
|
229
|
+
|
230
|
+
# Create a new ConstantPathTargetNode node
|
231
|
+
def ConstantPathTargetNode(parent, child, delimiter_loc, location = Location())
|
232
|
+
ConstantPathTargetNode.new(parent, child, delimiter_loc, location)
|
233
|
+
end
|
234
|
+
|
235
|
+
# Create a new ConstantPathWriteNode node
|
236
|
+
def ConstantPathWriteNode(target, operator_loc, value, location = Location())
|
237
|
+
ConstantPathWriteNode.new(target, operator_loc, value, location)
|
238
|
+
end
|
239
|
+
|
240
|
+
# Create a new ConstantReadNode node
|
241
|
+
def ConstantReadNode(name, location = Location())
|
242
|
+
ConstantReadNode.new(name, location)
|
243
|
+
end
|
244
|
+
|
245
|
+
# Create a new ConstantTargetNode node
|
246
|
+
def ConstantTargetNode(name, location = Location())
|
247
|
+
ConstantTargetNode.new(name, location)
|
248
|
+
end
|
249
|
+
|
250
|
+
# Create a new ConstantWriteNode node
|
251
|
+
def ConstantWriteNode(name, name_loc, value, operator_loc, location = Location())
|
252
|
+
ConstantWriteNode.new(name, name_loc, value, operator_loc, location)
|
253
|
+
end
|
254
|
+
|
255
|
+
# Create a new DefNode node
|
256
|
+
def DefNode(name, name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location = Location())
|
257
|
+
DefNode.new(name, name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location)
|
258
|
+
end
|
259
|
+
|
260
|
+
# Create a new DefinedNode node
|
261
|
+
def DefinedNode(lparen_loc, value, rparen_loc, keyword_loc, location = Location())
|
262
|
+
DefinedNode.new(lparen_loc, value, rparen_loc, keyword_loc, location)
|
263
|
+
end
|
264
|
+
|
265
|
+
# Create a new ElseNode node
|
266
|
+
def ElseNode(else_keyword_loc, statements, end_keyword_loc, location = Location())
|
267
|
+
ElseNode.new(else_keyword_loc, statements, end_keyword_loc, location)
|
268
|
+
end
|
269
|
+
|
270
|
+
# Create a new EmbeddedStatementsNode node
|
271
|
+
def EmbeddedStatementsNode(opening_loc, statements, closing_loc, location = Location())
|
272
|
+
EmbeddedStatementsNode.new(opening_loc, statements, closing_loc, location)
|
273
|
+
end
|
274
|
+
|
275
|
+
# Create a new EmbeddedVariableNode node
|
276
|
+
def EmbeddedVariableNode(operator_loc, variable, location = Location())
|
277
|
+
EmbeddedVariableNode.new(operator_loc, variable, location)
|
278
|
+
end
|
279
|
+
|
280
|
+
# Create a new EnsureNode node
|
281
|
+
def EnsureNode(ensure_keyword_loc, statements, end_keyword_loc, location = Location())
|
282
|
+
EnsureNode.new(ensure_keyword_loc, statements, end_keyword_loc, location)
|
283
|
+
end
|
284
|
+
|
285
|
+
# Create a new FalseNode node
|
286
|
+
def FalseNode(location = Location())
|
287
|
+
FalseNode.new(location)
|
288
|
+
end
|
289
|
+
|
290
|
+
# Create a new FindPatternNode node
|
291
|
+
def FindPatternNode(constant, left, requireds, right, opening_loc, closing_loc, location = Location())
|
292
|
+
FindPatternNode.new(constant, left, requireds, right, opening_loc, closing_loc, location)
|
293
|
+
end
|
294
|
+
|
295
|
+
# Create a new FlipFlopNode node
|
296
|
+
def FlipFlopNode(left, right, operator_loc, flags, location = Location())
|
297
|
+
FlipFlopNode.new(left, right, operator_loc, flags, location)
|
298
|
+
end
|
299
|
+
|
300
|
+
# Create a new FloatNode node
|
301
|
+
def FloatNode(location = Location())
|
302
|
+
FloatNode.new(location)
|
303
|
+
end
|
304
|
+
|
305
|
+
# Create a new ForNode node
|
306
|
+
def ForNode(index, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc, location = Location())
|
307
|
+
ForNode.new(index, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc, location)
|
308
|
+
end
|
309
|
+
|
310
|
+
# Create a new ForwardingArgumentsNode node
|
311
|
+
def ForwardingArgumentsNode(location = Location())
|
312
|
+
ForwardingArgumentsNode.new(location)
|
313
|
+
end
|
314
|
+
|
315
|
+
# Create a new ForwardingParameterNode node
|
316
|
+
def ForwardingParameterNode(location = Location())
|
317
|
+
ForwardingParameterNode.new(location)
|
318
|
+
end
|
319
|
+
|
320
|
+
# Create a new ForwardingSuperNode node
|
321
|
+
def ForwardingSuperNode(block, location = Location())
|
322
|
+
ForwardingSuperNode.new(block, location)
|
323
|
+
end
|
324
|
+
|
325
|
+
# Create a new GlobalVariableAndWriteNode node
|
326
|
+
def GlobalVariableAndWriteNode(name, name_loc, operator_loc, value, location = Location())
|
327
|
+
GlobalVariableAndWriteNode.new(name, name_loc, operator_loc, value, location)
|
328
|
+
end
|
329
|
+
|
330
|
+
# Create a new GlobalVariableOperatorWriteNode node
|
331
|
+
def GlobalVariableOperatorWriteNode(name, name_loc, operator_loc, value, operator, location = Location())
|
332
|
+
GlobalVariableOperatorWriteNode.new(name, name_loc, operator_loc, value, operator, location)
|
333
|
+
end
|
334
|
+
|
335
|
+
# Create a new GlobalVariableOrWriteNode node
|
336
|
+
def GlobalVariableOrWriteNode(name, name_loc, operator_loc, value, location = Location())
|
337
|
+
GlobalVariableOrWriteNode.new(name, name_loc, operator_loc, value, location)
|
338
|
+
end
|
339
|
+
|
340
|
+
# Create a new GlobalVariableReadNode node
|
341
|
+
def GlobalVariableReadNode(name, location = Location())
|
342
|
+
GlobalVariableReadNode.new(name, location)
|
343
|
+
end
|
344
|
+
|
345
|
+
# Create a new GlobalVariableTargetNode node
|
346
|
+
def GlobalVariableTargetNode(name, location = Location())
|
347
|
+
GlobalVariableTargetNode.new(name, location)
|
348
|
+
end
|
349
|
+
|
350
|
+
# Create a new GlobalVariableWriteNode node
|
351
|
+
def GlobalVariableWriteNode(name, name_loc, value, operator_loc, location = Location())
|
352
|
+
GlobalVariableWriteNode.new(name, name_loc, value, operator_loc, location)
|
353
|
+
end
|
354
|
+
|
355
|
+
# Create a new HashNode node
|
356
|
+
def HashNode(opening_loc, elements, closing_loc, location = Location())
|
357
|
+
HashNode.new(opening_loc, elements, closing_loc, location)
|
358
|
+
end
|
359
|
+
|
360
|
+
# Create a new HashPatternNode node
|
361
|
+
def HashPatternNode(constant, assocs, kwrest, opening_loc, closing_loc, location = Location())
|
362
|
+
HashPatternNode.new(constant, assocs, kwrest, opening_loc, closing_loc, location)
|
363
|
+
end
|
364
|
+
|
365
|
+
# Create a new IfNode node
|
366
|
+
def IfNode(if_keyword_loc, predicate, statements, consequent, end_keyword_loc, location = Location())
|
367
|
+
IfNode.new(if_keyword_loc, predicate, statements, consequent, end_keyword_loc, location)
|
368
|
+
end
|
369
|
+
|
370
|
+
# Create a new ImaginaryNode node
|
371
|
+
def ImaginaryNode(numeric, location = Location())
|
372
|
+
ImaginaryNode.new(numeric, location)
|
373
|
+
end
|
374
|
+
|
375
|
+
# Create a new ImplicitNode node
|
376
|
+
def ImplicitNode(value, location = Location())
|
377
|
+
ImplicitNode.new(value, location)
|
378
|
+
end
|
379
|
+
|
380
|
+
# Create a new InNode node
|
381
|
+
def InNode(pattern, statements, in_loc, then_loc, location = Location())
|
382
|
+
InNode.new(pattern, statements, in_loc, then_loc, location)
|
383
|
+
end
|
384
|
+
|
385
|
+
# Create a new InstanceVariableAndWriteNode node
|
386
|
+
def InstanceVariableAndWriteNode(name, name_loc, operator_loc, value, location = Location())
|
387
|
+
InstanceVariableAndWriteNode.new(name, name_loc, operator_loc, value, location)
|
388
|
+
end
|
389
|
+
|
390
|
+
# Create a new InstanceVariableOperatorWriteNode node
|
391
|
+
def InstanceVariableOperatorWriteNode(name, name_loc, operator_loc, value, operator, location = Location())
|
392
|
+
InstanceVariableOperatorWriteNode.new(name, name_loc, operator_loc, value, operator, location)
|
393
|
+
end
|
394
|
+
|
395
|
+
# Create a new InstanceVariableOrWriteNode node
|
396
|
+
def InstanceVariableOrWriteNode(name, name_loc, operator_loc, value, location = Location())
|
397
|
+
InstanceVariableOrWriteNode.new(name, name_loc, operator_loc, value, location)
|
398
|
+
end
|
399
|
+
|
400
|
+
# Create a new InstanceVariableReadNode node
|
401
|
+
def InstanceVariableReadNode(name, location = Location())
|
402
|
+
InstanceVariableReadNode.new(name, location)
|
403
|
+
end
|
404
|
+
|
405
|
+
# Create a new InstanceVariableTargetNode node
|
406
|
+
def InstanceVariableTargetNode(name, location = Location())
|
407
|
+
InstanceVariableTargetNode.new(name, location)
|
408
|
+
end
|
409
|
+
|
410
|
+
# Create a new InstanceVariableWriteNode node
|
411
|
+
def InstanceVariableWriteNode(name, name_loc, value, operator_loc, location = Location())
|
412
|
+
InstanceVariableWriteNode.new(name, name_loc, value, operator_loc, location)
|
413
|
+
end
|
414
|
+
|
415
|
+
# Create a new IntegerNode node
|
416
|
+
def IntegerNode(flags, location = Location())
|
417
|
+
IntegerNode.new(flags, location)
|
418
|
+
end
|
419
|
+
|
420
|
+
# Create a new InterpolatedMatchLastLineNode node
|
421
|
+
def InterpolatedMatchLastLineNode(opening_loc, parts, closing_loc, flags, location = Location())
|
422
|
+
InterpolatedMatchLastLineNode.new(opening_loc, parts, closing_loc, flags, location)
|
423
|
+
end
|
424
|
+
|
425
|
+
# Create a new InterpolatedRegularExpressionNode node
|
426
|
+
def InterpolatedRegularExpressionNode(opening_loc, parts, closing_loc, flags, location = Location())
|
427
|
+
InterpolatedRegularExpressionNode.new(opening_loc, parts, closing_loc, flags, location)
|
428
|
+
end
|
429
|
+
|
430
|
+
# Create a new InterpolatedStringNode node
|
431
|
+
def InterpolatedStringNode(opening_loc, parts, closing_loc, location = Location())
|
432
|
+
InterpolatedStringNode.new(opening_loc, parts, closing_loc, location)
|
433
|
+
end
|
434
|
+
|
435
|
+
# Create a new InterpolatedSymbolNode node
|
436
|
+
def InterpolatedSymbolNode(opening_loc, parts, closing_loc, location = Location())
|
437
|
+
InterpolatedSymbolNode.new(opening_loc, parts, closing_loc, location)
|
438
|
+
end
|
439
|
+
|
440
|
+
# Create a new InterpolatedXStringNode node
|
441
|
+
def InterpolatedXStringNode(opening_loc, parts, closing_loc, location = Location())
|
442
|
+
InterpolatedXStringNode.new(opening_loc, parts, closing_loc, location)
|
443
|
+
end
|
444
|
+
|
445
|
+
# Create a new KeywordHashNode node
|
446
|
+
def KeywordHashNode(elements, location = Location())
|
447
|
+
KeywordHashNode.new(elements, location)
|
448
|
+
end
|
449
|
+
|
450
|
+
# Create a new KeywordParameterNode node
|
451
|
+
def KeywordParameterNode(name, name_loc, value, location = Location())
|
452
|
+
KeywordParameterNode.new(name, name_loc, value, location)
|
453
|
+
end
|
454
|
+
|
455
|
+
# Create a new KeywordRestParameterNode node
|
456
|
+
def KeywordRestParameterNode(name, name_loc, operator_loc, location = Location())
|
457
|
+
KeywordRestParameterNode.new(name, name_loc, operator_loc, location)
|
458
|
+
end
|
459
|
+
|
460
|
+
# Create a new LambdaNode node
|
461
|
+
def LambdaNode(locals, operator_loc, opening_loc, closing_loc, parameters, body, location = Location())
|
462
|
+
LambdaNode.new(locals, operator_loc, opening_loc, closing_loc, parameters, body, location)
|
463
|
+
end
|
464
|
+
|
465
|
+
# Create a new LocalVariableAndWriteNode node
|
466
|
+
def LocalVariableAndWriteNode(name_loc, operator_loc, value, name, depth, location = Location())
|
467
|
+
LocalVariableAndWriteNode.new(name_loc, operator_loc, value, name, depth, location)
|
468
|
+
end
|
469
|
+
|
470
|
+
# Create a new LocalVariableOperatorWriteNode node
|
471
|
+
def LocalVariableOperatorWriteNode(name_loc, operator_loc, value, name, operator, depth, location = Location())
|
472
|
+
LocalVariableOperatorWriteNode.new(name_loc, operator_loc, value, name, operator, depth, location)
|
473
|
+
end
|
474
|
+
|
475
|
+
# Create a new LocalVariableOrWriteNode node
|
476
|
+
def LocalVariableOrWriteNode(name_loc, operator_loc, value, name, depth, location = Location())
|
477
|
+
LocalVariableOrWriteNode.new(name_loc, operator_loc, value, name, depth, location)
|
478
|
+
end
|
479
|
+
|
480
|
+
# Create a new LocalVariableReadNode node
|
481
|
+
def LocalVariableReadNode(name, depth, location = Location())
|
482
|
+
LocalVariableReadNode.new(name, depth, location)
|
483
|
+
end
|
484
|
+
|
485
|
+
# Create a new LocalVariableTargetNode node
|
486
|
+
def LocalVariableTargetNode(name, depth, location = Location())
|
487
|
+
LocalVariableTargetNode.new(name, depth, location)
|
488
|
+
end
|
489
|
+
|
490
|
+
# Create a new LocalVariableWriteNode node
|
491
|
+
def LocalVariableWriteNode(name, depth, name_loc, value, operator_loc, location = Location())
|
492
|
+
LocalVariableWriteNode.new(name, depth, name_loc, value, operator_loc, location)
|
493
|
+
end
|
494
|
+
|
495
|
+
# Create a new MatchLastLineNode node
|
496
|
+
def MatchLastLineNode(opening_loc, content_loc, closing_loc, unescaped, flags, location = Location())
|
497
|
+
MatchLastLineNode.new(opening_loc, content_loc, closing_loc, unescaped, flags, location)
|
498
|
+
end
|
499
|
+
|
500
|
+
# Create a new MatchPredicateNode node
|
501
|
+
def MatchPredicateNode(value, pattern, operator_loc, location = Location())
|
502
|
+
MatchPredicateNode.new(value, pattern, operator_loc, location)
|
503
|
+
end
|
504
|
+
|
505
|
+
# Create a new MatchRequiredNode node
|
506
|
+
def MatchRequiredNode(value, pattern, operator_loc, location = Location())
|
507
|
+
MatchRequiredNode.new(value, pattern, operator_loc, location)
|
508
|
+
end
|
509
|
+
|
510
|
+
# Create a new MatchWriteNode node
|
511
|
+
def MatchWriteNode(call, locals, location = Location())
|
512
|
+
MatchWriteNode.new(call, locals, location)
|
513
|
+
end
|
514
|
+
|
515
|
+
# Create a new MissingNode node
|
516
|
+
def MissingNode(location = Location())
|
517
|
+
MissingNode.new(location)
|
518
|
+
end
|
519
|
+
|
520
|
+
# Create a new ModuleNode node
|
521
|
+
def ModuleNode(locals, module_keyword_loc, constant_path, body, end_keyword_loc, name, location = Location())
|
522
|
+
ModuleNode.new(locals, module_keyword_loc, constant_path, body, end_keyword_loc, name, location)
|
523
|
+
end
|
524
|
+
|
525
|
+
# Create a new MultiTargetNode node
|
526
|
+
def MultiTargetNode(targets, lparen_loc, rparen_loc, location = Location())
|
527
|
+
MultiTargetNode.new(targets, lparen_loc, rparen_loc, location)
|
528
|
+
end
|
529
|
+
|
530
|
+
# Create a new MultiWriteNode node
|
531
|
+
def MultiWriteNode(targets, lparen_loc, rparen_loc, operator_loc, value, location = Location())
|
532
|
+
MultiWriteNode.new(targets, lparen_loc, rparen_loc, operator_loc, value, location)
|
533
|
+
end
|
534
|
+
|
535
|
+
# Create a new NextNode node
|
536
|
+
def NextNode(arguments, keyword_loc, location = Location())
|
537
|
+
NextNode.new(arguments, keyword_loc, location)
|
538
|
+
end
|
539
|
+
|
540
|
+
# Create a new NilNode node
|
541
|
+
def NilNode(location = Location())
|
542
|
+
NilNode.new(location)
|
543
|
+
end
|
544
|
+
|
545
|
+
# Create a new NoKeywordsParameterNode node
|
546
|
+
def NoKeywordsParameterNode(operator_loc, keyword_loc, location = Location())
|
547
|
+
NoKeywordsParameterNode.new(operator_loc, keyword_loc, location)
|
548
|
+
end
|
549
|
+
|
550
|
+
# Create a new NumberedReferenceReadNode node
|
551
|
+
def NumberedReferenceReadNode(number, location = Location())
|
552
|
+
NumberedReferenceReadNode.new(number, location)
|
553
|
+
end
|
554
|
+
|
555
|
+
# Create a new OptionalParameterNode node
|
556
|
+
def OptionalParameterNode(name, name_loc, operator_loc, value, location = Location())
|
557
|
+
OptionalParameterNode.new(name, name_loc, operator_loc, value, location)
|
558
|
+
end
|
559
|
+
|
560
|
+
# Create a new OrNode node
|
561
|
+
def OrNode(left, right, operator_loc, location = Location())
|
562
|
+
OrNode.new(left, right, operator_loc, location)
|
563
|
+
end
|
564
|
+
|
565
|
+
# Create a new ParametersNode node
|
566
|
+
def ParametersNode(requireds, optionals, rest, posts, keywords, keyword_rest, block, location = Location())
|
567
|
+
ParametersNode.new(requireds, optionals, rest, posts, keywords, keyword_rest, block, location)
|
568
|
+
end
|
569
|
+
|
570
|
+
# Create a new ParenthesesNode node
|
571
|
+
def ParenthesesNode(body, opening_loc, closing_loc, location = Location())
|
572
|
+
ParenthesesNode.new(body, opening_loc, closing_loc, location)
|
573
|
+
end
|
574
|
+
|
575
|
+
# Create a new PinnedExpressionNode node
|
576
|
+
def PinnedExpressionNode(expression, operator_loc, lparen_loc, rparen_loc, location = Location())
|
577
|
+
PinnedExpressionNode.new(expression, operator_loc, lparen_loc, rparen_loc, location)
|
578
|
+
end
|
579
|
+
|
580
|
+
# Create a new PinnedVariableNode node
|
581
|
+
def PinnedVariableNode(variable, operator_loc, location = Location())
|
582
|
+
PinnedVariableNode.new(variable, operator_loc, location)
|
583
|
+
end
|
584
|
+
|
585
|
+
# Create a new PostExecutionNode node
|
586
|
+
def PostExecutionNode(statements, keyword_loc, opening_loc, closing_loc, location = Location())
|
587
|
+
PostExecutionNode.new(statements, keyword_loc, opening_loc, closing_loc, location)
|
588
|
+
end
|
589
|
+
|
590
|
+
# Create a new PreExecutionNode node
|
591
|
+
def PreExecutionNode(statements, keyword_loc, opening_loc, closing_loc, location = Location())
|
592
|
+
PreExecutionNode.new(statements, keyword_loc, opening_loc, closing_loc, location)
|
593
|
+
end
|
594
|
+
|
595
|
+
# Create a new ProgramNode node
|
596
|
+
def ProgramNode(locals, statements, location = Location())
|
597
|
+
ProgramNode.new(locals, statements, location)
|
598
|
+
end
|
599
|
+
|
600
|
+
# Create a new RangeNode node
|
601
|
+
def RangeNode(left, right, operator_loc, flags, location = Location())
|
602
|
+
RangeNode.new(left, right, operator_loc, flags, location)
|
603
|
+
end
|
604
|
+
|
605
|
+
# Create a new RationalNode node
|
606
|
+
def RationalNode(numeric, location = Location())
|
607
|
+
RationalNode.new(numeric, location)
|
608
|
+
end
|
609
|
+
|
610
|
+
# Create a new RedoNode node
|
611
|
+
def RedoNode(location = Location())
|
612
|
+
RedoNode.new(location)
|
613
|
+
end
|
614
|
+
|
615
|
+
# Create a new RegularExpressionNode node
|
616
|
+
def RegularExpressionNode(opening_loc, content_loc, closing_loc, unescaped, flags, location = Location())
|
617
|
+
RegularExpressionNode.new(opening_loc, content_loc, closing_loc, unescaped, flags, location)
|
618
|
+
end
|
619
|
+
|
620
|
+
# Create a new RequiredDestructuredParameterNode node
|
621
|
+
def RequiredDestructuredParameterNode(parameters, opening_loc, closing_loc, location = Location())
|
622
|
+
RequiredDestructuredParameterNode.new(parameters, opening_loc, closing_loc, location)
|
623
|
+
end
|
624
|
+
|
625
|
+
# Create a new RequiredParameterNode node
|
626
|
+
def RequiredParameterNode(name, location = Location())
|
627
|
+
RequiredParameterNode.new(name, location)
|
628
|
+
end
|
629
|
+
|
630
|
+
# Create a new RescueModifierNode node
|
631
|
+
def RescueModifierNode(expression, keyword_loc, rescue_expression, location = Location())
|
632
|
+
RescueModifierNode.new(expression, keyword_loc, rescue_expression, location)
|
633
|
+
end
|
634
|
+
|
635
|
+
# Create a new RescueNode node
|
636
|
+
def RescueNode(keyword_loc, exceptions, operator_loc, reference, statements, consequent, location = Location())
|
637
|
+
RescueNode.new(keyword_loc, exceptions, operator_loc, reference, statements, consequent, location)
|
638
|
+
end
|
639
|
+
|
640
|
+
# Create a new RestParameterNode node
|
641
|
+
def RestParameterNode(name, name_loc, operator_loc, location = Location())
|
642
|
+
RestParameterNode.new(name, name_loc, operator_loc, location)
|
643
|
+
end
|
644
|
+
|
645
|
+
# Create a new RetryNode node
|
646
|
+
def RetryNode(location = Location())
|
647
|
+
RetryNode.new(location)
|
648
|
+
end
|
649
|
+
|
650
|
+
# Create a new ReturnNode node
|
651
|
+
def ReturnNode(keyword_loc, arguments, location = Location())
|
652
|
+
ReturnNode.new(keyword_loc, arguments, location)
|
653
|
+
end
|
654
|
+
|
655
|
+
# Create a new SelfNode node
|
656
|
+
def SelfNode(location = Location())
|
657
|
+
SelfNode.new(location)
|
658
|
+
end
|
659
|
+
|
660
|
+
# Create a new SingletonClassNode node
|
661
|
+
def SingletonClassNode(locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, location = Location())
|
662
|
+
SingletonClassNode.new(locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, location)
|
663
|
+
end
|
664
|
+
|
665
|
+
# Create a new SourceEncodingNode node
|
666
|
+
def SourceEncodingNode(location = Location())
|
667
|
+
SourceEncodingNode.new(location)
|
668
|
+
end
|
669
|
+
|
670
|
+
# Create a new SourceFileNode node
|
671
|
+
def SourceFileNode(filepath, location = Location())
|
672
|
+
SourceFileNode.new(filepath, location)
|
673
|
+
end
|
674
|
+
|
675
|
+
# Create a new SourceLineNode node
|
676
|
+
def SourceLineNode(location = Location())
|
677
|
+
SourceLineNode.new(location)
|
678
|
+
end
|
679
|
+
|
680
|
+
# Create a new SplatNode node
|
681
|
+
def SplatNode(operator_loc, expression, location = Location())
|
682
|
+
SplatNode.new(operator_loc, expression, location)
|
683
|
+
end
|
684
|
+
|
685
|
+
# Create a new StatementsNode node
|
686
|
+
def StatementsNode(body, location = Location())
|
687
|
+
StatementsNode.new(body, location)
|
688
|
+
end
|
689
|
+
|
690
|
+
# Create a new StringConcatNode node
|
691
|
+
def StringConcatNode(left, right, location = Location())
|
692
|
+
StringConcatNode.new(left, right, location)
|
693
|
+
end
|
694
|
+
|
695
|
+
# Create a new StringNode node
|
696
|
+
def StringNode(flags, opening_loc, content_loc, closing_loc, unescaped, location = Location())
|
697
|
+
StringNode.new(flags, opening_loc, content_loc, closing_loc, unescaped, location)
|
698
|
+
end
|
699
|
+
|
700
|
+
# Create a new SuperNode node
|
701
|
+
def SuperNode(keyword_loc, lparen_loc, arguments, rparen_loc, block, location = Location())
|
702
|
+
SuperNode.new(keyword_loc, lparen_loc, arguments, rparen_loc, block, location)
|
703
|
+
end
|
704
|
+
|
705
|
+
# Create a new SymbolNode node
|
706
|
+
def SymbolNode(opening_loc, value_loc, closing_loc, unescaped, location = Location())
|
707
|
+
SymbolNode.new(opening_loc, value_loc, closing_loc, unescaped, location)
|
708
|
+
end
|
709
|
+
|
710
|
+
# Create a new TrueNode node
|
711
|
+
def TrueNode(location = Location())
|
712
|
+
TrueNode.new(location)
|
713
|
+
end
|
714
|
+
|
715
|
+
# Create a new UndefNode node
|
716
|
+
def UndefNode(names, keyword_loc, location = Location())
|
717
|
+
UndefNode.new(names, keyword_loc, location)
|
718
|
+
end
|
719
|
+
|
720
|
+
# Create a new UnlessNode node
|
721
|
+
def UnlessNode(keyword_loc, predicate, statements, consequent, end_keyword_loc, location = Location())
|
722
|
+
UnlessNode.new(keyword_loc, predicate, statements, consequent, end_keyword_loc, location)
|
723
|
+
end
|
724
|
+
|
725
|
+
# Create a new UntilNode node
|
726
|
+
def UntilNode(keyword_loc, closing_loc, predicate, statements, flags, location = Location())
|
727
|
+
UntilNode.new(keyword_loc, closing_loc, predicate, statements, flags, location)
|
728
|
+
end
|
729
|
+
|
730
|
+
# Create a new WhenNode node
|
731
|
+
def WhenNode(keyword_loc, conditions, statements, location = Location())
|
732
|
+
WhenNode.new(keyword_loc, conditions, statements, location)
|
733
|
+
end
|
734
|
+
|
735
|
+
# Create a new WhileNode node
|
736
|
+
def WhileNode(keyword_loc, closing_loc, predicate, statements, flags, location = Location())
|
737
|
+
WhileNode.new(keyword_loc, closing_loc, predicate, statements, flags, location)
|
738
|
+
end
|
739
|
+
|
740
|
+
# Create a new XStringNode node
|
741
|
+
def XStringNode(opening_loc, content_loc, closing_loc, unescaped, location = Location())
|
742
|
+
XStringNode.new(opening_loc, content_loc, closing_loc, unescaped, location)
|
743
|
+
end
|
744
|
+
|
745
|
+
# Create a new YieldNode node
|
746
|
+
def YieldNode(keyword_loc, lparen_loc, arguments, rparen_loc, location = Location())
|
747
|
+
YieldNode.new(keyword_loc, lparen_loc, arguments, rparen_loc, location)
|
748
|
+
end
|
749
|
+
end
|
750
|
+
end
|