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/dsl.rb
CHANGED
@@ -13,793 +13,978 @@ module Prism
|
|
13
13
|
# source = Prism::Source.for("[1]")
|
14
14
|
#
|
15
15
|
# Prism::ArrayNode.new(
|
16
|
+
# source,
|
17
|
+
# 0,
|
18
|
+
# Prism::Location.new(source, 0, 3),
|
19
|
+
# 0,
|
16
20
|
# [
|
17
21
|
# Prism::IntegerNode.new(
|
18
|
-
#
|
19
|
-
#
|
22
|
+
# source,
|
23
|
+
# 0,
|
20
24
|
# Prism::Location.new(source, 1, 1),
|
21
|
-
#
|
25
|
+
# Prism::IntegerBaseFlags::DECIMAL,
|
26
|
+
# 1
|
22
27
|
# )
|
23
28
|
# ],
|
24
29
|
# Prism::Location.new(source, 0, 1),
|
25
|
-
# Prism::Location.new(source, 2, 1)
|
26
|
-
# source
|
30
|
+
# Prism::Location.new(source, 2, 1)
|
27
31
|
# )
|
28
32
|
#
|
29
33
|
# you could instead write:
|
30
34
|
#
|
31
|
-
#
|
35
|
+
# class Builder
|
36
|
+
# include Prism::DSL
|
32
37
|
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
# )
|
38
|
+
# attr_reader :default_source
|
39
|
+
#
|
40
|
+
# def initialize
|
41
|
+
# @default_source = source("[1]")
|
42
|
+
# end
|
39
43
|
#
|
40
|
-
#
|
41
|
-
#
|
44
|
+
# def build
|
45
|
+
# array_node(
|
46
|
+
# location: location(start_offset: 0, length: 3),
|
47
|
+
# elements: [
|
48
|
+
# integer_node(
|
49
|
+
# location: location(start_offset: 1, length: 1),
|
50
|
+
# flags: integer_base_flag(:decimal),
|
51
|
+
# value: 1
|
52
|
+
# )
|
53
|
+
# ],
|
54
|
+
# opening_loc: location(start_offset: 0, length: 1),
|
55
|
+
# closing_loc: location(start_offset: 2, length: 1)
|
56
|
+
# )
|
57
|
+
# end
|
58
|
+
# end
|
59
|
+
#
|
60
|
+
# This is mostly helpful in the context of generating trees programmatically.
|
42
61
|
module DSL
|
43
|
-
|
62
|
+
# Provide all of these methods as module methods as well, to allow for
|
63
|
+
# building nodes like Prism::DSL.nil_node.
|
64
|
+
extend self
|
44
65
|
|
45
|
-
# Create a new
|
46
|
-
def
|
47
|
-
|
66
|
+
# Create a new Source object.
|
67
|
+
def source(string)
|
68
|
+
Source.for(string)
|
48
69
|
end
|
49
70
|
|
50
|
-
# Create a new
|
51
|
-
def
|
52
|
-
|
71
|
+
# Create a new Location object.
|
72
|
+
def location(source: default_source, start_offset: 0, length: 0)
|
73
|
+
Location.new(source, start_offset, length)
|
53
74
|
end
|
54
75
|
|
55
|
-
# Create a new
|
56
|
-
def
|
57
|
-
|
76
|
+
# Create a new AliasGlobalVariableNode node.
|
77
|
+
def alias_global_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, new_name: global_variable_read_node(source: source), old_name: global_variable_read_node(source: source), keyword_loc: location)
|
78
|
+
AliasGlobalVariableNode.new(source, node_id, location, flags, new_name, old_name, keyword_loc)
|
58
79
|
end
|
59
80
|
|
60
|
-
# Create a new
|
61
|
-
def
|
62
|
-
|
81
|
+
# Create a new AliasMethodNode node.
|
82
|
+
def alias_method_node(source: default_source, node_id: 0, location: default_location, flags: 0, new_name: symbol_node(source: source), old_name: symbol_node(source: source), keyword_loc: location)
|
83
|
+
AliasMethodNode.new(source, node_id, location, flags, new_name, old_name, keyword_loc)
|
63
84
|
end
|
64
85
|
|
65
|
-
# Create a new
|
66
|
-
def
|
67
|
-
|
86
|
+
# Create a new AlternationPatternNode node.
|
87
|
+
def alternation_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location)
|
88
|
+
AlternationPatternNode.new(source, node_id, location, flags, left, right, operator_loc)
|
68
89
|
end
|
69
90
|
|
70
|
-
# Create a new
|
71
|
-
def
|
72
|
-
|
91
|
+
# Create a new AndNode node.
|
92
|
+
def and_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location)
|
93
|
+
AndNode.new(source, node_id, location, flags, left, right, operator_loc)
|
73
94
|
end
|
74
95
|
|
75
|
-
# Create a new
|
76
|
-
def
|
77
|
-
|
96
|
+
# Create a new ArgumentsNode node.
|
97
|
+
def arguments_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: [])
|
98
|
+
ArgumentsNode.new(source, node_id, location, flags, arguments)
|
78
99
|
end
|
79
100
|
|
80
|
-
# Create a new
|
81
|
-
def
|
82
|
-
|
101
|
+
# Create a new ArrayNode node.
|
102
|
+
def array_node(source: default_source, node_id: 0, location: default_location, flags: 0, elements: [], opening_loc: nil, closing_loc: nil)
|
103
|
+
ArrayNode.new(source, node_id, location, flags, elements, opening_loc, closing_loc)
|
83
104
|
end
|
84
105
|
|
85
|
-
# Create a new
|
86
|
-
def
|
87
|
-
|
106
|
+
# Create a new ArrayPatternNode node.
|
107
|
+
def array_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, requireds: [], rest: nil, posts: [], opening_loc: nil, closing_loc: nil)
|
108
|
+
ArrayPatternNode.new(source, node_id, location, flags, constant, requireds, rest, posts, opening_loc, closing_loc)
|
88
109
|
end
|
89
110
|
|
90
|
-
# Create a new
|
91
|
-
def
|
92
|
-
|
111
|
+
# Create a new AssocNode node.
|
112
|
+
def assoc_node(source: default_source, node_id: 0, location: default_location, flags: 0, key: default_node(source, location), value: default_node(source, location), operator_loc: nil)
|
113
|
+
AssocNode.new(source, node_id, location, flags, key, value, operator_loc)
|
93
114
|
end
|
94
115
|
|
95
|
-
# Create a new
|
96
|
-
def
|
97
|
-
|
116
|
+
# Create a new AssocSplatNode node.
|
117
|
+
def assoc_splat_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: nil, operator_loc: location)
|
118
|
+
AssocSplatNode.new(source, node_id, location, flags, value, operator_loc)
|
98
119
|
end
|
99
120
|
|
100
|
-
# Create a new
|
101
|
-
def
|
102
|
-
|
121
|
+
# Create a new BackReferenceReadNode node.
|
122
|
+
def back_reference_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
|
123
|
+
BackReferenceReadNode.new(source, node_id, location, flags, name)
|
103
124
|
end
|
104
125
|
|
105
|
-
# Create a new
|
106
|
-
def
|
107
|
-
|
126
|
+
# Create a new BeginNode node.
|
127
|
+
def begin_node(source: default_source, node_id: 0, location: default_location, flags: 0, begin_keyword_loc: nil, statements: nil, rescue_clause: nil, else_clause: nil, ensure_clause: nil, end_keyword_loc: nil)
|
128
|
+
BeginNode.new(source, node_id, location, flags, begin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc)
|
108
129
|
end
|
109
130
|
|
110
|
-
# Create a new
|
111
|
-
def
|
112
|
-
|
131
|
+
# Create a new BlockArgumentNode node.
|
132
|
+
def block_argument_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: nil, operator_loc: location)
|
133
|
+
BlockArgumentNode.new(source, node_id, location, flags, expression, operator_loc)
|
113
134
|
end
|
114
135
|
|
115
|
-
# Create a new
|
116
|
-
def
|
117
|
-
|
136
|
+
# Create a new BlockLocalVariableNode node.
|
137
|
+
def block_local_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
|
138
|
+
BlockLocalVariableNode.new(source, node_id, location, flags, name)
|
118
139
|
end
|
119
140
|
|
120
|
-
# Create a new
|
121
|
-
def
|
122
|
-
|
141
|
+
# Create a new BlockNode node.
|
142
|
+
def block_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], parameters: nil, body: nil, opening_loc: location, closing_loc: location)
|
143
|
+
BlockNode.new(source, node_id, location, flags, locals, parameters, body, opening_loc, closing_loc)
|
123
144
|
end
|
124
145
|
|
125
|
-
# Create a new
|
126
|
-
def
|
127
|
-
|
146
|
+
# Create a new BlockParameterNode node.
|
147
|
+
def block_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location)
|
148
|
+
BlockParameterNode.new(source, node_id, location, flags, name, name_loc, operator_loc)
|
128
149
|
end
|
129
150
|
|
130
|
-
# Create a new
|
131
|
-
def
|
132
|
-
|
151
|
+
# Create a new BlockParametersNode node.
|
152
|
+
def block_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, parameters: nil, locals: [], opening_loc: nil, closing_loc: nil)
|
153
|
+
BlockParametersNode.new(source, node_id, location, flags, parameters, locals, opening_loc, closing_loc)
|
133
154
|
end
|
134
155
|
|
135
|
-
# Create a new
|
136
|
-
def
|
137
|
-
|
156
|
+
# Create a new BreakNode node.
|
157
|
+
def break_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: nil, keyword_loc: location)
|
158
|
+
BreakNode.new(source, node_id, location, flags, arguments, keyword_loc)
|
138
159
|
end
|
139
160
|
|
140
|
-
# Create a new
|
141
|
-
def
|
142
|
-
|
161
|
+
# Create a new CallAndWriteNode node.
|
162
|
+
def call_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", operator_loc: location, value: default_node(source, location))
|
163
|
+
CallAndWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value)
|
143
164
|
end
|
144
165
|
|
145
|
-
# Create a new
|
146
|
-
def
|
147
|
-
|
166
|
+
# Create a new CallNode node.
|
167
|
+
def call_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, name: :"", message_loc: nil, opening_loc: nil, arguments: nil, closing_loc: nil, block: nil)
|
168
|
+
CallNode.new(source, node_id, location, flags, receiver, call_operator_loc, name, message_loc, opening_loc, arguments, closing_loc, block)
|
148
169
|
end
|
149
170
|
|
150
|
-
# Create a new
|
151
|
-
def
|
152
|
-
|
171
|
+
# Create a new CallOperatorWriteNode node.
|
172
|
+
def call_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", binary_operator: :"", binary_operator_loc: location, value: default_node(source, location))
|
173
|
+
CallOperatorWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, message_loc, read_name, write_name, binary_operator, binary_operator_loc, value)
|
153
174
|
end
|
154
175
|
|
155
|
-
# Create a new
|
156
|
-
def
|
157
|
-
|
176
|
+
# Create a new CallOrWriteNode node.
|
177
|
+
def call_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", operator_loc: location, value: default_node(source, location))
|
178
|
+
CallOrWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value)
|
158
179
|
end
|
159
180
|
|
160
|
-
# Create a new
|
161
|
-
def
|
162
|
-
|
181
|
+
# Create a new CallTargetNode node.
|
182
|
+
def call_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: default_node(source, location), call_operator_loc: location, name: :"", message_loc: location)
|
183
|
+
CallTargetNode.new(source, node_id, location, flags, receiver, call_operator_loc, name, message_loc)
|
163
184
|
end
|
164
185
|
|
165
|
-
# Create a new
|
166
|
-
def
|
167
|
-
|
186
|
+
# Create a new CapturePatternNode node.
|
187
|
+
def capture_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), target: default_node(source, location), operator_loc: location)
|
188
|
+
CapturePatternNode.new(source, node_id, location, flags, value, target, operator_loc)
|
168
189
|
end
|
169
190
|
|
170
|
-
# Create a new
|
171
|
-
def
|
172
|
-
|
191
|
+
# Create a new CaseMatchNode node.
|
192
|
+
def case_match_node(source: default_source, node_id: 0, location: default_location, flags: 0, predicate: nil, conditions: [], else_clause: nil, case_keyword_loc: location, end_keyword_loc: location)
|
193
|
+
CaseMatchNode.new(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc)
|
173
194
|
end
|
174
195
|
|
175
|
-
# Create a new
|
176
|
-
def
|
177
|
-
|
196
|
+
# Create a new CaseNode node.
|
197
|
+
def case_node(source: default_source, node_id: 0, location: default_location, flags: 0, predicate: nil, conditions: [], else_clause: nil, case_keyword_loc: location, end_keyword_loc: location)
|
198
|
+
CaseNode.new(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc)
|
178
199
|
end
|
179
200
|
|
180
|
-
# Create a new
|
181
|
-
def
|
182
|
-
|
201
|
+
# Create a new ClassNode node.
|
202
|
+
def class_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], class_keyword_loc: location, constant_path: default_node(source, location), inheritance_operator_loc: nil, superclass: nil, body: nil, end_keyword_loc: location, name: :"")
|
203
|
+
ClassNode.new(source, node_id, location, flags, locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name)
|
183
204
|
end
|
184
205
|
|
185
|
-
# Create a new
|
186
|
-
def
|
187
|
-
|
206
|
+
# Create a new ClassVariableAndWriteNode node.
|
207
|
+
def class_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
|
208
|
+
ClassVariableAndWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
|
188
209
|
end
|
189
210
|
|
190
|
-
# Create a new
|
191
|
-
def
|
192
|
-
|
211
|
+
# Create a new ClassVariableOperatorWriteNode node.
|
212
|
+
def class_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"")
|
213
|
+
ClassVariableOperatorWriteNode.new(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator)
|
193
214
|
end
|
194
215
|
|
195
|
-
# Create a new
|
196
|
-
def
|
197
|
-
|
216
|
+
# Create a new ClassVariableOrWriteNode node.
|
217
|
+
def class_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
|
218
|
+
ClassVariableOrWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
|
198
219
|
end
|
199
220
|
|
200
|
-
# Create a new
|
201
|
-
def
|
202
|
-
|
221
|
+
# Create a new ClassVariableReadNode node.
|
222
|
+
def class_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
|
223
|
+
ClassVariableReadNode.new(source, node_id, location, flags, name)
|
203
224
|
end
|
204
225
|
|
205
|
-
# Create a new
|
206
|
-
def
|
207
|
-
|
226
|
+
# Create a new ClassVariableTargetNode node.
|
227
|
+
def class_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
|
228
|
+
ClassVariableTargetNode.new(source, node_id, location, flags, name)
|
208
229
|
end
|
209
230
|
|
210
|
-
# Create a new
|
211
|
-
def
|
212
|
-
|
231
|
+
# Create a new ClassVariableWriteNode node.
|
232
|
+
def class_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location)
|
233
|
+
ClassVariableWriteNode.new(source, node_id, location, flags, name, name_loc, value, operator_loc)
|
213
234
|
end
|
214
235
|
|
215
|
-
# Create a new
|
216
|
-
def
|
217
|
-
|
236
|
+
# Create a new ConstantAndWriteNode node.
|
237
|
+
def constant_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
|
238
|
+
ConstantAndWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
|
218
239
|
end
|
219
240
|
|
220
|
-
# Create a new
|
221
|
-
def
|
222
|
-
|
241
|
+
# Create a new ConstantOperatorWriteNode node.
|
242
|
+
def constant_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"")
|
243
|
+
ConstantOperatorWriteNode.new(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator)
|
223
244
|
end
|
224
245
|
|
225
|
-
# Create a new
|
226
|
-
def
|
227
|
-
|
246
|
+
# Create a new ConstantOrWriteNode node.
|
247
|
+
def constant_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
|
248
|
+
ConstantOrWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
|
228
249
|
end
|
229
250
|
|
230
|
-
# Create a new
|
231
|
-
def
|
232
|
-
|
251
|
+
# Create a new ConstantPathAndWriteNode node.
|
252
|
+
def constant_path_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location))
|
253
|
+
ConstantPathAndWriteNode.new(source, node_id, location, flags, target, operator_loc, value)
|
233
254
|
end
|
234
255
|
|
235
|
-
# Create a new
|
236
|
-
def
|
237
|
-
|
256
|
+
# Create a new ConstantPathNode node.
|
257
|
+
def constant_path_node(source: default_source, node_id: 0, location: default_location, flags: 0, parent: nil, name: nil, delimiter_loc: location, name_loc: location)
|
258
|
+
ConstantPathNode.new(source, node_id, location, flags, parent, name, delimiter_loc, name_loc)
|
238
259
|
end
|
239
260
|
|
240
|
-
# Create a new
|
241
|
-
def
|
242
|
-
|
261
|
+
# Create a new ConstantPathOperatorWriteNode node.
|
262
|
+
def constant_path_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), binary_operator_loc: location, value: default_node(source, location), binary_operator: :"")
|
263
|
+
ConstantPathOperatorWriteNode.new(source, node_id, location, flags, target, binary_operator_loc, value, binary_operator)
|
243
264
|
end
|
244
265
|
|
245
|
-
# Create a new
|
246
|
-
def
|
247
|
-
|
266
|
+
# Create a new ConstantPathOrWriteNode node.
|
267
|
+
def constant_path_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location))
|
268
|
+
ConstantPathOrWriteNode.new(source, node_id, location, flags, target, operator_loc, value)
|
248
269
|
end
|
249
270
|
|
250
|
-
# Create a new
|
251
|
-
def
|
252
|
-
|
271
|
+
# Create a new ConstantPathTargetNode node.
|
272
|
+
def constant_path_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, parent: nil, name: nil, delimiter_loc: location, name_loc: location)
|
273
|
+
ConstantPathTargetNode.new(source, node_id, location, flags, parent, name, delimiter_loc, name_loc)
|
253
274
|
end
|
254
275
|
|
255
|
-
# Create a new
|
256
|
-
def
|
257
|
-
|
276
|
+
# Create a new ConstantPathWriteNode node.
|
277
|
+
def constant_path_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location))
|
278
|
+
ConstantPathWriteNode.new(source, node_id, location, flags, target, operator_loc, value)
|
258
279
|
end
|
259
280
|
|
260
|
-
# Create a new
|
261
|
-
def
|
262
|
-
|
281
|
+
# Create a new ConstantReadNode node.
|
282
|
+
def constant_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
|
283
|
+
ConstantReadNode.new(source, node_id, location, flags, name)
|
263
284
|
end
|
264
285
|
|
265
|
-
# Create a new
|
266
|
-
def
|
267
|
-
|
286
|
+
# Create a new ConstantTargetNode node.
|
287
|
+
def constant_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
|
288
|
+
ConstantTargetNode.new(source, node_id, location, flags, name)
|
268
289
|
end
|
269
290
|
|
270
|
-
# Create a new
|
271
|
-
def
|
272
|
-
|
291
|
+
# Create a new ConstantWriteNode node.
|
292
|
+
def constant_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location)
|
293
|
+
ConstantWriteNode.new(source, node_id, location, flags, name, name_loc, value, operator_loc)
|
273
294
|
end
|
274
295
|
|
275
|
-
# Create a new
|
276
|
-
def
|
277
|
-
|
296
|
+
# Create a new DefNode node.
|
297
|
+
def def_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, receiver: nil, parameters: nil, body: nil, locals: [], def_keyword_loc: location, operator_loc: nil, lparen_loc: nil, rparen_loc: nil, equal_loc: nil, end_keyword_loc: nil)
|
298
|
+
DefNode.new(source, node_id, location, flags, name, name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc)
|
278
299
|
end
|
279
300
|
|
280
|
-
# Create a new
|
281
|
-
def
|
282
|
-
|
301
|
+
# Create a new DefinedNode node.
|
302
|
+
def defined_node(source: default_source, node_id: 0, location: default_location, flags: 0, lparen_loc: nil, value: default_node(source, location), rparen_loc: nil, keyword_loc: location)
|
303
|
+
DefinedNode.new(source, node_id, location, flags, lparen_loc, value, rparen_loc, keyword_loc)
|
283
304
|
end
|
284
305
|
|
285
|
-
# Create a new
|
286
|
-
def
|
287
|
-
|
306
|
+
# Create a new ElseNode node.
|
307
|
+
def else_node(source: default_source, node_id: 0, location: default_location, flags: 0, else_keyword_loc: location, statements: nil, end_keyword_loc: nil)
|
308
|
+
ElseNode.new(source, node_id, location, flags, else_keyword_loc, statements, end_keyword_loc)
|
288
309
|
end
|
289
310
|
|
290
|
-
# Create a new
|
291
|
-
def
|
292
|
-
|
311
|
+
# Create a new EmbeddedStatementsNode node.
|
312
|
+
def embedded_statements_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, statements: nil, closing_loc: location)
|
313
|
+
EmbeddedStatementsNode.new(source, node_id, location, flags, opening_loc, statements, closing_loc)
|
293
314
|
end
|
294
315
|
|
295
|
-
# Create a new
|
296
|
-
def
|
297
|
-
|
316
|
+
# Create a new EmbeddedVariableNode node.
|
317
|
+
def embedded_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, variable: default_node(source, location))
|
318
|
+
EmbeddedVariableNode.new(source, node_id, location, flags, operator_loc, variable)
|
298
319
|
end
|
299
320
|
|
300
|
-
# Create a new
|
301
|
-
def
|
302
|
-
|
321
|
+
# Create a new EnsureNode node.
|
322
|
+
def ensure_node(source: default_source, node_id: 0, location: default_location, flags: 0, ensure_keyword_loc: location, statements: nil, end_keyword_loc: location)
|
323
|
+
EnsureNode.new(source, node_id, location, flags, ensure_keyword_loc, statements, end_keyword_loc)
|
303
324
|
end
|
304
325
|
|
305
|
-
# Create a new
|
306
|
-
def
|
307
|
-
|
326
|
+
# Create a new FalseNode node.
|
327
|
+
def false_node(source: default_source, node_id: 0, location: default_location, flags: 0)
|
328
|
+
FalseNode.new(source, node_id, location, flags)
|
308
329
|
end
|
309
330
|
|
310
|
-
# Create a new
|
311
|
-
def
|
312
|
-
|
331
|
+
# Create a new FindPatternNode node.
|
332
|
+
def find_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, left: default_node(source, location), requireds: [], right: default_node(source, location), opening_loc: nil, closing_loc: nil)
|
333
|
+
FindPatternNode.new(source, node_id, location, flags, constant, left, requireds, right, opening_loc, closing_loc)
|
313
334
|
end
|
314
335
|
|
315
|
-
# Create a new
|
316
|
-
def
|
317
|
-
|
336
|
+
# Create a new FlipFlopNode node.
|
337
|
+
def flip_flop_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: nil, right: nil, operator_loc: location)
|
338
|
+
FlipFlopNode.new(source, node_id, location, flags, left, right, operator_loc)
|
318
339
|
end
|
319
340
|
|
320
|
-
# Create a new
|
321
|
-
def
|
322
|
-
|
341
|
+
# Create a new FloatNode node.
|
342
|
+
def float_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: 0.0)
|
343
|
+
FloatNode.new(source, node_id, location, flags, value)
|
323
344
|
end
|
324
345
|
|
325
|
-
# Create a new
|
326
|
-
def
|
327
|
-
|
346
|
+
# Create a new ForNode node.
|
347
|
+
def for_node(source: default_source, node_id: 0, location: default_location, flags: 0, index: default_node(source, location), collection: default_node(source, location), statements: nil, for_keyword_loc: location, in_keyword_loc: location, do_keyword_loc: nil, end_keyword_loc: location)
|
348
|
+
ForNode.new(source, node_id, location, flags, index, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc)
|
328
349
|
end
|
329
350
|
|
330
|
-
# Create a new
|
331
|
-
def
|
332
|
-
|
351
|
+
# Create a new ForwardingArgumentsNode node.
|
352
|
+
def forwarding_arguments_node(source: default_source, node_id: 0, location: default_location, flags: 0)
|
353
|
+
ForwardingArgumentsNode.new(source, node_id, location, flags)
|
333
354
|
end
|
334
355
|
|
335
|
-
# Create a new
|
336
|
-
def
|
337
|
-
|
356
|
+
# Create a new ForwardingParameterNode node.
|
357
|
+
def forwarding_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0)
|
358
|
+
ForwardingParameterNode.new(source, node_id, location, flags)
|
338
359
|
end
|
339
360
|
|
340
|
-
# Create a new
|
341
|
-
def
|
342
|
-
|
361
|
+
# Create a new ForwardingSuperNode node.
|
362
|
+
def forwarding_super_node(source: default_source, node_id: 0, location: default_location, flags: 0, block: nil)
|
363
|
+
ForwardingSuperNode.new(source, node_id, location, flags, block)
|
343
364
|
end
|
344
365
|
|
345
|
-
# Create a new
|
346
|
-
def
|
347
|
-
|
366
|
+
# Create a new GlobalVariableAndWriteNode node.
|
367
|
+
def global_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
|
368
|
+
GlobalVariableAndWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
|
348
369
|
end
|
349
370
|
|
350
|
-
# Create a new
|
351
|
-
def
|
352
|
-
|
371
|
+
# Create a new GlobalVariableOperatorWriteNode node.
|
372
|
+
def global_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"")
|
373
|
+
GlobalVariableOperatorWriteNode.new(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator)
|
353
374
|
end
|
354
375
|
|
355
|
-
# Create a new
|
356
|
-
def
|
357
|
-
|
376
|
+
# Create a new GlobalVariableOrWriteNode node.
|
377
|
+
def global_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
|
378
|
+
GlobalVariableOrWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
|
358
379
|
end
|
359
380
|
|
360
|
-
# Create a new
|
361
|
-
def
|
362
|
-
|
381
|
+
# Create a new GlobalVariableReadNode node.
|
382
|
+
def global_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
|
383
|
+
GlobalVariableReadNode.new(source, node_id, location, flags, name)
|
363
384
|
end
|
364
385
|
|
365
|
-
# Create a new
|
366
|
-
def
|
367
|
-
|
386
|
+
# Create a new GlobalVariableTargetNode node.
|
387
|
+
def global_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
|
388
|
+
GlobalVariableTargetNode.new(source, node_id, location, flags, name)
|
368
389
|
end
|
369
390
|
|
370
|
-
# Create a new
|
371
|
-
def
|
372
|
-
|
391
|
+
# Create a new GlobalVariableWriteNode node.
|
392
|
+
def global_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location)
|
393
|
+
GlobalVariableWriteNode.new(source, node_id, location, flags, name, name_loc, value, operator_loc)
|
373
394
|
end
|
374
395
|
|
375
|
-
# Create a new
|
376
|
-
def
|
377
|
-
|
396
|
+
# Create a new HashNode node.
|
397
|
+
def hash_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, elements: [], closing_loc: location)
|
398
|
+
HashNode.new(source, node_id, location, flags, opening_loc, elements, closing_loc)
|
378
399
|
end
|
379
400
|
|
380
|
-
# Create a new
|
381
|
-
def
|
382
|
-
|
401
|
+
# Create a new HashPatternNode node.
|
402
|
+
def hash_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, elements: [], rest: nil, opening_loc: nil, closing_loc: nil)
|
403
|
+
HashPatternNode.new(source, node_id, location, flags, constant, elements, rest, opening_loc, closing_loc)
|
383
404
|
end
|
384
405
|
|
385
|
-
# Create a new
|
386
|
-
def
|
387
|
-
|
406
|
+
# Create a new IfNode node.
|
407
|
+
def if_node(source: default_source, node_id: 0, location: default_location, flags: 0, if_keyword_loc: nil, predicate: default_node(source, location), then_keyword_loc: nil, statements: nil, subsequent: nil, end_keyword_loc: nil)
|
408
|
+
IfNode.new(source, node_id, location, flags, if_keyword_loc, predicate, then_keyword_loc, statements, subsequent, end_keyword_loc)
|
388
409
|
end
|
389
410
|
|
390
|
-
# Create a new
|
391
|
-
def
|
392
|
-
|
411
|
+
# Create a new ImaginaryNode node.
|
412
|
+
def imaginary_node(source: default_source, node_id: 0, location: default_location, flags: 0, numeric: float_node(source: source))
|
413
|
+
ImaginaryNode.new(source, node_id, location, flags, numeric)
|
393
414
|
end
|
394
415
|
|
395
|
-
# Create a new
|
396
|
-
def
|
397
|
-
|
416
|
+
# Create a new ImplicitNode node.
|
417
|
+
def implicit_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location))
|
418
|
+
ImplicitNode.new(source, node_id, location, flags, value)
|
398
419
|
end
|
399
420
|
|
400
|
-
# Create a new
|
401
|
-
def
|
402
|
-
|
421
|
+
# Create a new ImplicitRestNode node.
|
422
|
+
def implicit_rest_node(source: default_source, node_id: 0, location: default_location, flags: 0)
|
423
|
+
ImplicitRestNode.new(source, node_id, location, flags)
|
403
424
|
end
|
404
425
|
|
405
|
-
# Create a new
|
406
|
-
def
|
407
|
-
|
426
|
+
# Create a new InNode node.
|
427
|
+
def in_node(source: default_source, node_id: 0, location: default_location, flags: 0, pattern: default_node(source, location), statements: nil, in_loc: location, then_loc: nil)
|
428
|
+
InNode.new(source, node_id, location, flags, pattern, statements, in_loc, then_loc)
|
408
429
|
end
|
409
430
|
|
410
|
-
# Create a new
|
411
|
-
def
|
412
|
-
|
431
|
+
# Create a new IndexAndWriteNode node.
|
432
|
+
def index_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, operator_loc: location, value: default_node(source, location))
|
433
|
+
IndexAndWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value)
|
413
434
|
end
|
414
435
|
|
415
|
-
# Create a new
|
416
|
-
def
|
417
|
-
|
436
|
+
# Create a new IndexOperatorWriteNode node.
|
437
|
+
def index_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, binary_operator: :"", binary_operator_loc: location, value: default_node(source, location))
|
438
|
+
IndexOperatorWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, binary_operator, binary_operator_loc, value)
|
418
439
|
end
|
419
440
|
|
420
|
-
# Create a new
|
421
|
-
def
|
422
|
-
|
441
|
+
# Create a new IndexOrWriteNode node.
|
442
|
+
def index_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, operator_loc: location, value: default_node(source, location))
|
443
|
+
IndexOrWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value)
|
423
444
|
end
|
424
445
|
|
425
|
-
# Create a new
|
426
|
-
def
|
427
|
-
|
446
|
+
# Create a new IndexTargetNode node.
|
447
|
+
def index_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: default_node(source, location), opening_loc: location, arguments: nil, closing_loc: location, block: nil)
|
448
|
+
IndexTargetNode.new(source, node_id, location, flags, receiver, opening_loc, arguments, closing_loc, block)
|
428
449
|
end
|
429
450
|
|
430
|
-
# Create a new
|
431
|
-
def
|
432
|
-
|
451
|
+
# Create a new InstanceVariableAndWriteNode node.
|
452
|
+
def instance_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
|
453
|
+
InstanceVariableAndWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
|
433
454
|
end
|
434
455
|
|
435
|
-
# Create a new
|
436
|
-
def
|
437
|
-
|
456
|
+
# Create a new InstanceVariableOperatorWriteNode node.
|
457
|
+
def instance_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"")
|
458
|
+
InstanceVariableOperatorWriteNode.new(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator)
|
438
459
|
end
|
439
460
|
|
440
|
-
# Create a new
|
441
|
-
def
|
442
|
-
|
461
|
+
# Create a new InstanceVariableOrWriteNode node.
|
462
|
+
def instance_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
|
463
|
+
InstanceVariableOrWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
|
443
464
|
end
|
444
465
|
|
445
|
-
# Create a new
|
446
|
-
def
|
447
|
-
|
466
|
+
# Create a new InstanceVariableReadNode node.
|
467
|
+
def instance_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
|
468
|
+
InstanceVariableReadNode.new(source, node_id, location, flags, name)
|
448
469
|
end
|
449
470
|
|
450
|
-
# Create a new
|
451
|
-
def
|
452
|
-
|
471
|
+
# Create a new InstanceVariableTargetNode node.
|
472
|
+
def instance_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
|
473
|
+
InstanceVariableTargetNode.new(source, node_id, location, flags, name)
|
453
474
|
end
|
454
475
|
|
455
|
-
# Create a new
|
456
|
-
def
|
457
|
-
|
476
|
+
# Create a new InstanceVariableWriteNode node.
|
477
|
+
def instance_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location)
|
478
|
+
InstanceVariableWriteNode.new(source, node_id, location, flags, name, name_loc, value, operator_loc)
|
458
479
|
end
|
459
480
|
|
460
|
-
# Create a new
|
461
|
-
def
|
462
|
-
|
481
|
+
# Create a new IntegerNode node.
|
482
|
+
def integer_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: 0)
|
483
|
+
IntegerNode.new(source, node_id, location, flags, value)
|
463
484
|
end
|
464
485
|
|
465
|
-
# Create a new
|
466
|
-
def
|
467
|
-
|
486
|
+
# Create a new InterpolatedMatchLastLineNode node.
|
487
|
+
def interpolated_match_last_line_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location)
|
488
|
+
InterpolatedMatchLastLineNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc)
|
468
489
|
end
|
469
490
|
|
470
|
-
# Create a new
|
471
|
-
def
|
472
|
-
|
491
|
+
# Create a new InterpolatedRegularExpressionNode node.
|
492
|
+
def interpolated_regular_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location)
|
493
|
+
InterpolatedRegularExpressionNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc)
|
473
494
|
end
|
474
495
|
|
475
|
-
# Create a new
|
476
|
-
def
|
477
|
-
|
496
|
+
# Create a new InterpolatedStringNode node.
|
497
|
+
def interpolated_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, parts: [], closing_loc: nil)
|
498
|
+
InterpolatedStringNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc)
|
478
499
|
end
|
479
500
|
|
480
|
-
# Create a new
|
481
|
-
def
|
482
|
-
|
501
|
+
# Create a new InterpolatedSymbolNode node.
|
502
|
+
def interpolated_symbol_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, parts: [], closing_loc: nil)
|
503
|
+
InterpolatedSymbolNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc)
|
483
504
|
end
|
484
505
|
|
485
|
-
# Create a new
|
486
|
-
def
|
487
|
-
|
506
|
+
# Create a new InterpolatedXStringNode node.
|
507
|
+
def interpolated_x_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location)
|
508
|
+
InterpolatedXStringNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc)
|
488
509
|
end
|
489
510
|
|
490
|
-
# Create a new
|
491
|
-
def
|
492
|
-
|
511
|
+
# Create a new ItLocalVariableReadNode node.
|
512
|
+
def it_local_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0)
|
513
|
+
ItLocalVariableReadNode.new(source, node_id, location, flags)
|
493
514
|
end
|
494
515
|
|
495
|
-
# Create a new
|
496
|
-
def
|
497
|
-
|
516
|
+
# Create a new ItParametersNode node.
|
517
|
+
def it_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0)
|
518
|
+
ItParametersNode.new(source, node_id, location, flags)
|
498
519
|
end
|
499
520
|
|
500
|
-
# Create a new
|
501
|
-
def
|
502
|
-
|
521
|
+
# Create a new KeywordHashNode node.
|
522
|
+
def keyword_hash_node(source: default_source, node_id: 0, location: default_location, flags: 0, elements: [])
|
523
|
+
KeywordHashNode.new(source, node_id, location, flags, elements)
|
503
524
|
end
|
504
525
|
|
505
|
-
# Create a new
|
506
|
-
def
|
507
|
-
|
526
|
+
# Create a new KeywordRestParameterNode node.
|
527
|
+
def keyword_rest_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location)
|
528
|
+
KeywordRestParameterNode.new(source, node_id, location, flags, name, name_loc, operator_loc)
|
508
529
|
end
|
509
530
|
|
510
|
-
# Create a new
|
511
|
-
def
|
512
|
-
|
531
|
+
# Create a new LambdaNode node.
|
532
|
+
def lambda_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], operator_loc: location, opening_loc: location, closing_loc: location, parameters: nil, body: nil)
|
533
|
+
LambdaNode.new(source, node_id, location, flags, locals, operator_loc, opening_loc, closing_loc, parameters, body)
|
513
534
|
end
|
514
535
|
|
515
|
-
# Create a new
|
516
|
-
def
|
517
|
-
|
536
|
+
# Create a new LocalVariableAndWriteNode node.
|
537
|
+
def local_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, operator_loc: location, value: default_node(source, location), name: :"", depth: 0)
|
538
|
+
LocalVariableAndWriteNode.new(source, node_id, location, flags, name_loc, operator_loc, value, name, depth)
|
518
539
|
end
|
519
540
|
|
520
|
-
# Create a new
|
521
|
-
def
|
522
|
-
|
541
|
+
# Create a new LocalVariableOperatorWriteNode node.
|
542
|
+
def local_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, binary_operator_loc: location, value: default_node(source, location), name: :"", binary_operator: :"", depth: 0)
|
543
|
+
LocalVariableOperatorWriteNode.new(source, node_id, location, flags, name_loc, binary_operator_loc, value, name, binary_operator, depth)
|
523
544
|
end
|
524
545
|
|
525
|
-
# Create a new
|
526
|
-
def
|
527
|
-
|
546
|
+
# Create a new LocalVariableOrWriteNode node.
|
547
|
+
def local_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, operator_loc: location, value: default_node(source, location), name: :"", depth: 0)
|
548
|
+
LocalVariableOrWriteNode.new(source, node_id, location, flags, name_loc, operator_loc, value, name, depth)
|
528
549
|
end
|
529
550
|
|
530
|
-
# Create a new
|
531
|
-
def
|
532
|
-
|
551
|
+
# Create a new LocalVariableReadNode node.
|
552
|
+
def local_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0)
|
553
|
+
LocalVariableReadNode.new(source, node_id, location, flags, name, depth)
|
533
554
|
end
|
534
555
|
|
535
|
-
# Create a new
|
536
|
-
def
|
537
|
-
|
556
|
+
# Create a new LocalVariableTargetNode node.
|
557
|
+
def local_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0)
|
558
|
+
LocalVariableTargetNode.new(source, node_id, location, flags, name, depth)
|
538
559
|
end
|
539
560
|
|
540
|
-
# Create a new
|
541
|
-
def
|
542
|
-
|
561
|
+
# Create a new LocalVariableWriteNode node.
|
562
|
+
def local_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0, name_loc: location, value: default_node(source, location), operator_loc: location)
|
563
|
+
LocalVariableWriteNode.new(source, node_id, location, flags, name, depth, name_loc, value, operator_loc)
|
543
564
|
end
|
544
565
|
|
545
|
-
# Create a new
|
546
|
-
def
|
547
|
-
|
566
|
+
# Create a new MatchLastLineNode node.
|
567
|
+
def match_last_line_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "")
|
568
|
+
MatchLastLineNode.new(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped)
|
548
569
|
end
|
549
570
|
|
550
|
-
# Create a new
|
551
|
-
def
|
552
|
-
|
571
|
+
# Create a new MatchPredicateNode node.
|
572
|
+
def match_predicate_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), pattern: default_node(source, location), operator_loc: location)
|
573
|
+
MatchPredicateNode.new(source, node_id, location, flags, value, pattern, operator_loc)
|
553
574
|
end
|
554
575
|
|
555
|
-
# Create a new
|
556
|
-
def
|
557
|
-
|
576
|
+
# Create a new MatchRequiredNode node.
|
577
|
+
def match_required_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), pattern: default_node(source, location), operator_loc: location)
|
578
|
+
MatchRequiredNode.new(source, node_id, location, flags, value, pattern, operator_loc)
|
558
579
|
end
|
559
580
|
|
560
|
-
# Create a new
|
561
|
-
def
|
562
|
-
|
581
|
+
# Create a new MatchWriteNode node.
|
582
|
+
def match_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, call: call_node(source: source), targets: [])
|
583
|
+
MatchWriteNode.new(source, node_id, location, flags, call, targets)
|
563
584
|
end
|
564
585
|
|
565
|
-
# Create a new
|
566
|
-
def
|
567
|
-
|
586
|
+
# Create a new MissingNode node.
|
587
|
+
def missing_node(source: default_source, node_id: 0, location: default_location, flags: 0)
|
588
|
+
MissingNode.new(source, node_id, location, flags)
|
568
589
|
end
|
569
590
|
|
570
|
-
# Create a new
|
571
|
-
def
|
572
|
-
|
591
|
+
# Create a new ModuleNode node.
|
592
|
+
def module_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], module_keyword_loc: location, constant_path: default_node(source, location), body: nil, end_keyword_loc: location, name: :"")
|
593
|
+
ModuleNode.new(source, node_id, location, flags, locals, module_keyword_loc, constant_path, body, end_keyword_loc, name)
|
573
594
|
end
|
574
595
|
|
575
|
-
# Create a new
|
576
|
-
def
|
577
|
-
|
596
|
+
# Create a new MultiTargetNode node.
|
597
|
+
def multi_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, lefts: [], rest: nil, rights: [], lparen_loc: nil, rparen_loc: nil)
|
598
|
+
MultiTargetNode.new(source, node_id, location, flags, lefts, rest, rights, lparen_loc, rparen_loc)
|
578
599
|
end
|
579
600
|
|
580
|
-
# Create a new
|
581
|
-
def
|
582
|
-
|
601
|
+
# Create a new MultiWriteNode node.
|
602
|
+
def multi_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, lefts: [], rest: nil, rights: [], lparen_loc: nil, rparen_loc: nil, operator_loc: location, value: default_node(source, location))
|
603
|
+
MultiWriteNode.new(source, node_id, location, flags, lefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value)
|
583
604
|
end
|
584
605
|
|
585
|
-
# Create a new
|
586
|
-
def
|
587
|
-
|
606
|
+
# Create a new NextNode node.
|
607
|
+
def next_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: nil, keyword_loc: location)
|
608
|
+
NextNode.new(source, node_id, location, flags, arguments, keyword_loc)
|
588
609
|
end
|
589
610
|
|
590
|
-
# Create a new
|
591
|
-
def
|
592
|
-
|
611
|
+
# Create a new NilNode node.
|
612
|
+
def nil_node(source: default_source, node_id: 0, location: default_location, flags: 0)
|
613
|
+
NilNode.new(source, node_id, location, flags)
|
593
614
|
end
|
594
615
|
|
595
|
-
# Create a new
|
596
|
-
def
|
597
|
-
|
616
|
+
# Create a new NoKeywordsParameterNode node.
|
617
|
+
def no_keywords_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, keyword_loc: location)
|
618
|
+
NoKeywordsParameterNode.new(source, node_id, location, flags, operator_loc, keyword_loc)
|
598
619
|
end
|
599
620
|
|
600
|
-
# Create a new
|
601
|
-
def
|
602
|
-
|
621
|
+
# Create a new NumberedParametersNode node.
|
622
|
+
def numbered_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, maximum: 0)
|
623
|
+
NumberedParametersNode.new(source, node_id, location, flags, maximum)
|
603
624
|
end
|
604
625
|
|
605
|
-
# Create a new
|
606
|
-
def
|
607
|
-
|
626
|
+
# Create a new NumberedReferenceReadNode node.
|
627
|
+
def numbered_reference_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, number: 0)
|
628
|
+
NumberedReferenceReadNode.new(source, node_id, location, flags, number)
|
608
629
|
end
|
609
630
|
|
610
|
-
# Create a new
|
611
|
-
def
|
612
|
-
|
631
|
+
# Create a new OptionalKeywordParameterNode node.
|
632
|
+
def optional_keyword_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location))
|
633
|
+
OptionalKeywordParameterNode.new(source, node_id, location, flags, name, name_loc, value)
|
613
634
|
end
|
614
635
|
|
615
|
-
# Create a new
|
616
|
-
def
|
617
|
-
|
636
|
+
# Create a new OptionalParameterNode node.
|
637
|
+
def optional_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
|
638
|
+
OptionalParameterNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
|
618
639
|
end
|
619
640
|
|
620
|
-
# Create a new
|
621
|
-
def
|
622
|
-
|
641
|
+
# Create a new OrNode node.
|
642
|
+
def or_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location)
|
643
|
+
OrNode.new(source, node_id, location, flags, left, right, operator_loc)
|
623
644
|
end
|
624
645
|
|
625
|
-
# Create a new
|
626
|
-
def
|
627
|
-
|
646
|
+
# Create a new ParametersNode node.
|
647
|
+
def parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, requireds: [], optionals: [], rest: nil, posts: [], keywords: [], keyword_rest: nil, block: nil)
|
648
|
+
ParametersNode.new(source, node_id, location, flags, requireds, optionals, rest, posts, keywords, keyword_rest, block)
|
628
649
|
end
|
629
650
|
|
630
|
-
# Create a new
|
631
|
-
def
|
632
|
-
|
651
|
+
# Create a new ParenthesesNode node.
|
652
|
+
def parentheses_node(source: default_source, node_id: 0, location: default_location, flags: 0, body: nil, opening_loc: location, closing_loc: location)
|
653
|
+
ParenthesesNode.new(source, node_id, location, flags, body, opening_loc, closing_loc)
|
633
654
|
end
|
634
655
|
|
635
|
-
# Create a new
|
636
|
-
def
|
637
|
-
|
656
|
+
# Create a new PinnedExpressionNode node.
|
657
|
+
def pinned_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: default_node(source, location), operator_loc: location, lparen_loc: location, rparen_loc: location)
|
658
|
+
PinnedExpressionNode.new(source, node_id, location, flags, expression, operator_loc, lparen_loc, rparen_loc)
|
638
659
|
end
|
639
660
|
|
640
|
-
# Create a new
|
641
|
-
def
|
642
|
-
|
661
|
+
# Create a new PinnedVariableNode node.
|
662
|
+
def pinned_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, variable: default_node(source, location), operator_loc: location)
|
663
|
+
PinnedVariableNode.new(source, node_id, location, flags, variable, operator_loc)
|
643
664
|
end
|
644
665
|
|
645
|
-
# Create a new
|
646
|
-
def
|
647
|
-
|
666
|
+
# Create a new PostExecutionNode node.
|
667
|
+
def post_execution_node(source: default_source, node_id: 0, location: default_location, flags: 0, statements: nil, keyword_loc: location, opening_loc: location, closing_loc: location)
|
668
|
+
PostExecutionNode.new(source, node_id, location, flags, statements, keyword_loc, opening_loc, closing_loc)
|
648
669
|
end
|
649
670
|
|
650
|
-
# Create a new
|
651
|
-
def
|
652
|
-
|
671
|
+
# Create a new PreExecutionNode node.
|
672
|
+
def pre_execution_node(source: default_source, node_id: 0, location: default_location, flags: 0, statements: nil, keyword_loc: location, opening_loc: location, closing_loc: location)
|
673
|
+
PreExecutionNode.new(source, node_id, location, flags, statements, keyword_loc, opening_loc, closing_loc)
|
653
674
|
end
|
654
675
|
|
655
|
-
# Create a new
|
656
|
-
def
|
657
|
-
|
676
|
+
# Create a new ProgramNode node.
|
677
|
+
def program_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], statements: statements_node(source: source))
|
678
|
+
ProgramNode.new(source, node_id, location, flags, locals, statements)
|
658
679
|
end
|
659
680
|
|
660
|
-
# Create a new
|
661
|
-
def
|
662
|
-
|
681
|
+
# Create a new RangeNode node.
|
682
|
+
def range_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: nil, right: nil, operator_loc: location)
|
683
|
+
RangeNode.new(source, node_id, location, flags, left, right, operator_loc)
|
663
684
|
end
|
664
685
|
|
665
|
-
# Create a new
|
666
|
-
def
|
667
|
-
|
686
|
+
# Create a new RationalNode node.
|
687
|
+
def rational_node(source: default_source, node_id: 0, location: default_location, flags: 0, numerator: 0, denominator: 0)
|
688
|
+
RationalNode.new(source, node_id, location, flags, numerator, denominator)
|
668
689
|
end
|
669
690
|
|
670
|
-
# Create a new
|
671
|
-
def
|
672
|
-
|
691
|
+
# Create a new RedoNode node.
|
692
|
+
def redo_node(source: default_source, node_id: 0, location: default_location, flags: 0)
|
693
|
+
RedoNode.new(source, node_id, location, flags)
|
673
694
|
end
|
674
695
|
|
675
|
-
# Create a new
|
676
|
-
def
|
677
|
-
|
696
|
+
# Create a new RegularExpressionNode node.
|
697
|
+
def regular_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "")
|
698
|
+
RegularExpressionNode.new(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped)
|
678
699
|
end
|
679
700
|
|
680
|
-
# Create a new
|
681
|
-
def
|
682
|
-
|
701
|
+
# Create a new RequiredKeywordParameterNode node.
|
702
|
+
def required_keyword_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location)
|
703
|
+
RequiredKeywordParameterNode.new(source, node_id, location, flags, name, name_loc)
|
683
704
|
end
|
684
705
|
|
685
|
-
# Create a new
|
686
|
-
def
|
687
|
-
|
706
|
+
# Create a new RequiredParameterNode node.
|
707
|
+
def required_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
|
708
|
+
RequiredParameterNode.new(source, node_id, location, flags, name)
|
688
709
|
end
|
689
710
|
|
690
|
-
# Create a new
|
691
|
-
def
|
692
|
-
|
711
|
+
# Create a new RescueModifierNode node.
|
712
|
+
def rescue_modifier_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: default_node(source, location), keyword_loc: location, rescue_expression: default_node(source, location))
|
713
|
+
RescueModifierNode.new(source, node_id, location, flags, expression, keyword_loc, rescue_expression)
|
693
714
|
end
|
694
715
|
|
695
|
-
# Create a new
|
696
|
-
def
|
697
|
-
|
716
|
+
# Create a new RescueNode node.
|
717
|
+
def rescue_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, exceptions: [], operator_loc: nil, reference: nil, statements: nil, subsequent: nil)
|
718
|
+
RescueNode.new(source, node_id, location, flags, keyword_loc, exceptions, operator_loc, reference, statements, subsequent)
|
698
719
|
end
|
699
720
|
|
700
|
-
# Create a new
|
701
|
-
def
|
702
|
-
|
721
|
+
# Create a new RestParameterNode node.
|
722
|
+
def rest_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location)
|
723
|
+
RestParameterNode.new(source, node_id, location, flags, name, name_loc, operator_loc)
|
703
724
|
end
|
704
725
|
|
705
|
-
# Create a new
|
706
|
-
def
|
707
|
-
|
726
|
+
# Create a new RetryNode node.
|
727
|
+
def retry_node(source: default_source, node_id: 0, location: default_location, flags: 0)
|
728
|
+
RetryNode.new(source, node_id, location, flags)
|
708
729
|
end
|
709
730
|
|
710
|
-
# Create a new
|
711
|
-
def
|
712
|
-
|
731
|
+
# Create a new ReturnNode node.
|
732
|
+
def return_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, arguments: nil)
|
733
|
+
ReturnNode.new(source, node_id, location, flags, keyword_loc, arguments)
|
713
734
|
end
|
714
735
|
|
715
|
-
# Create a new
|
716
|
-
def
|
717
|
-
|
736
|
+
# Create a new SelfNode node.
|
737
|
+
def self_node(source: default_source, node_id: 0, location: default_location, flags: 0)
|
738
|
+
SelfNode.new(source, node_id, location, flags)
|
718
739
|
end
|
719
740
|
|
720
|
-
# Create a new
|
721
|
-
def
|
722
|
-
|
741
|
+
# Create a new ShareableConstantNode node.
|
742
|
+
def shareable_constant_node(source: default_source, node_id: 0, location: default_location, flags: 0, write: constant_write_node(source: source))
|
743
|
+
ShareableConstantNode.new(source, node_id, location, flags, write)
|
723
744
|
end
|
724
745
|
|
725
|
-
# Create a new
|
726
|
-
def
|
727
|
-
|
746
|
+
# Create a new SingletonClassNode node.
|
747
|
+
def singleton_class_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], class_keyword_loc: location, operator_loc: location, expression: default_node(source, location), body: nil, end_keyword_loc: location)
|
748
|
+
SingletonClassNode.new(source, node_id, location, flags, locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc)
|
728
749
|
end
|
729
750
|
|
730
|
-
# Create a new
|
731
|
-
def
|
732
|
-
|
751
|
+
# Create a new SourceEncodingNode node.
|
752
|
+
def source_encoding_node(source: default_source, node_id: 0, location: default_location, flags: 0)
|
753
|
+
SourceEncodingNode.new(source, node_id, location, flags)
|
733
754
|
end
|
734
755
|
|
735
|
-
# Create a new
|
736
|
-
def
|
737
|
-
|
756
|
+
# Create a new SourceFileNode node.
|
757
|
+
def source_file_node(source: default_source, node_id: 0, location: default_location, flags: 0, filepath: "")
|
758
|
+
SourceFileNode.new(source, node_id, location, flags, filepath)
|
738
759
|
end
|
739
760
|
|
740
|
-
# Create a new
|
741
|
-
def
|
742
|
-
|
761
|
+
# Create a new SourceLineNode node.
|
762
|
+
def source_line_node(source: default_source, node_id: 0, location: default_location, flags: 0)
|
763
|
+
SourceLineNode.new(source, node_id, location, flags)
|
743
764
|
end
|
744
765
|
|
745
|
-
# Create a new
|
746
|
-
def
|
747
|
-
|
766
|
+
# Create a new SplatNode node.
|
767
|
+
def splat_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, expression: nil)
|
768
|
+
SplatNode.new(source, node_id, location, flags, operator_loc, expression)
|
748
769
|
end
|
749
770
|
|
750
|
-
# Create a new
|
751
|
-
def
|
752
|
-
|
771
|
+
# Create a new StatementsNode node.
|
772
|
+
def statements_node(source: default_source, node_id: 0, location: default_location, flags: 0, body: [])
|
773
|
+
StatementsNode.new(source, node_id, location, flags, body)
|
753
774
|
end
|
754
775
|
|
755
|
-
# Create a new
|
756
|
-
def
|
757
|
-
|
776
|
+
# Create a new StringNode node.
|
777
|
+
def string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, content_loc: location, closing_loc: nil, unescaped: "")
|
778
|
+
StringNode.new(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped)
|
758
779
|
end
|
759
780
|
|
760
|
-
# Create a new
|
761
|
-
def
|
762
|
-
|
781
|
+
# Create a new SuperNode node.
|
782
|
+
def super_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, lparen_loc: nil, arguments: nil, rparen_loc: nil, block: nil)
|
783
|
+
SuperNode.new(source, node_id, location, flags, keyword_loc, lparen_loc, arguments, rparen_loc, block)
|
763
784
|
end
|
764
785
|
|
765
|
-
# Create a new
|
766
|
-
def
|
767
|
-
|
786
|
+
# Create a new SymbolNode node.
|
787
|
+
def symbol_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, value_loc: nil, closing_loc: nil, unescaped: "")
|
788
|
+
SymbolNode.new(source, node_id, location, flags, opening_loc, value_loc, closing_loc, unescaped)
|
768
789
|
end
|
769
790
|
|
770
|
-
# Create a new
|
771
|
-
def
|
772
|
-
|
791
|
+
# Create a new TrueNode node.
|
792
|
+
def true_node(source: default_source, node_id: 0, location: default_location, flags: 0)
|
793
|
+
TrueNode.new(source, node_id, location, flags)
|
773
794
|
end
|
774
795
|
|
775
|
-
# Create a new
|
776
|
-
def
|
777
|
-
|
796
|
+
# Create a new UndefNode node.
|
797
|
+
def undef_node(source: default_source, node_id: 0, location: default_location, flags: 0, names: [], keyword_loc: location)
|
798
|
+
UndefNode.new(source, node_id, location, flags, names, keyword_loc)
|
778
799
|
end
|
779
800
|
|
780
|
-
# Create a new
|
781
|
-
def
|
782
|
-
|
801
|
+
# Create a new UnlessNode node.
|
802
|
+
def unless_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, predicate: default_node(source, location), then_keyword_loc: nil, statements: nil, else_clause: nil, end_keyword_loc: nil)
|
803
|
+
UnlessNode.new(source, node_id, location, flags, keyword_loc, predicate, then_keyword_loc, statements, else_clause, end_keyword_loc)
|
783
804
|
end
|
784
805
|
|
785
|
-
# Create a new
|
786
|
-
def
|
787
|
-
|
806
|
+
# Create a new UntilNode node.
|
807
|
+
def until_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, closing_loc: nil, predicate: default_node(source, location), statements: nil)
|
808
|
+
UntilNode.new(source, node_id, location, flags, keyword_loc, closing_loc, predicate, statements)
|
788
809
|
end
|
789
810
|
|
790
|
-
# Create a new
|
791
|
-
def
|
792
|
-
|
811
|
+
# Create a new WhenNode node.
|
812
|
+
def when_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, conditions: [], then_keyword_loc: nil, statements: nil)
|
813
|
+
WhenNode.new(source, node_id, location, flags, keyword_loc, conditions, then_keyword_loc, statements)
|
814
|
+
end
|
815
|
+
|
816
|
+
# Create a new WhileNode node.
|
817
|
+
def while_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, closing_loc: nil, predicate: default_node(source, location), statements: nil)
|
818
|
+
WhileNode.new(source, node_id, location, flags, keyword_loc, closing_loc, predicate, statements)
|
819
|
+
end
|
820
|
+
|
821
|
+
# Create a new XStringNode node.
|
822
|
+
def x_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "")
|
823
|
+
XStringNode.new(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped)
|
824
|
+
end
|
825
|
+
|
826
|
+
# Create a new YieldNode node.
|
827
|
+
def yield_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, lparen_loc: nil, arguments: nil, rparen_loc: nil)
|
828
|
+
YieldNode.new(source, node_id, location, flags, keyword_loc, lparen_loc, arguments, rparen_loc)
|
829
|
+
end
|
830
|
+
|
831
|
+
# Retrieve the value of one of the ArgumentsNodeFlags flags.
|
832
|
+
def arguments_node_flag(name)
|
833
|
+
case name
|
834
|
+
when :contains_keywords then ArgumentsNodeFlags::CONTAINS_KEYWORDS
|
835
|
+
when :contains_keyword_splat then ArgumentsNodeFlags::CONTAINS_KEYWORD_SPLAT
|
836
|
+
when :contains_splat then ArgumentsNodeFlags::CONTAINS_SPLAT
|
837
|
+
else Kernel.raise ArgumentError, "invalid ArgumentsNodeFlags flag: #{name.inspect}"
|
838
|
+
end
|
839
|
+
end
|
840
|
+
|
841
|
+
# Retrieve the value of one of the ArrayNodeFlags flags.
|
842
|
+
def array_node_flag(name)
|
843
|
+
case name
|
844
|
+
when :contains_splat then ArrayNodeFlags::CONTAINS_SPLAT
|
845
|
+
else Kernel.raise ArgumentError, "invalid ArrayNodeFlags flag: #{name.inspect}"
|
846
|
+
end
|
847
|
+
end
|
848
|
+
|
849
|
+
# Retrieve the value of one of the CallNodeFlags flags.
|
850
|
+
def call_node_flag(name)
|
851
|
+
case name
|
852
|
+
when :safe_navigation then CallNodeFlags::SAFE_NAVIGATION
|
853
|
+
when :variable_call then CallNodeFlags::VARIABLE_CALL
|
854
|
+
when :attribute_write then CallNodeFlags::ATTRIBUTE_WRITE
|
855
|
+
when :ignore_visibility then CallNodeFlags::IGNORE_VISIBILITY
|
856
|
+
else Kernel.raise ArgumentError, "invalid CallNodeFlags flag: #{name.inspect}"
|
857
|
+
end
|
858
|
+
end
|
859
|
+
|
860
|
+
# Retrieve the value of one of the EncodingFlags flags.
|
861
|
+
def encoding_flag(name)
|
862
|
+
case name
|
863
|
+
when :forced_utf8_encoding then EncodingFlags::FORCED_UTF8_ENCODING
|
864
|
+
when :forced_binary_encoding then EncodingFlags::FORCED_BINARY_ENCODING
|
865
|
+
else Kernel.raise ArgumentError, "invalid EncodingFlags flag: #{name.inspect}"
|
866
|
+
end
|
867
|
+
end
|
868
|
+
|
869
|
+
# Retrieve the value of one of the IntegerBaseFlags flags.
|
870
|
+
def integer_base_flag(name)
|
871
|
+
case name
|
872
|
+
when :binary then IntegerBaseFlags::BINARY
|
873
|
+
when :decimal then IntegerBaseFlags::DECIMAL
|
874
|
+
when :octal then IntegerBaseFlags::OCTAL
|
875
|
+
when :hexadecimal then IntegerBaseFlags::HEXADECIMAL
|
876
|
+
else Kernel.raise ArgumentError, "invalid IntegerBaseFlags flag: #{name.inspect}"
|
877
|
+
end
|
878
|
+
end
|
879
|
+
|
880
|
+
# Retrieve the value of one of the InterpolatedStringNodeFlags flags.
|
881
|
+
def interpolated_string_node_flag(name)
|
882
|
+
case name
|
883
|
+
when :frozen then InterpolatedStringNodeFlags::FROZEN
|
884
|
+
when :mutable then InterpolatedStringNodeFlags::MUTABLE
|
885
|
+
else Kernel.raise ArgumentError, "invalid InterpolatedStringNodeFlags flag: #{name.inspect}"
|
886
|
+
end
|
887
|
+
end
|
888
|
+
|
889
|
+
# Retrieve the value of one of the KeywordHashNodeFlags flags.
|
890
|
+
def keyword_hash_node_flag(name)
|
891
|
+
case name
|
892
|
+
when :symbol_keys then KeywordHashNodeFlags::SYMBOL_KEYS
|
893
|
+
else Kernel.raise ArgumentError, "invalid KeywordHashNodeFlags flag: #{name.inspect}"
|
894
|
+
end
|
895
|
+
end
|
896
|
+
|
897
|
+
# Retrieve the value of one of the LoopFlags flags.
|
898
|
+
def loop_flag(name)
|
899
|
+
case name
|
900
|
+
when :begin_modifier then LoopFlags::BEGIN_MODIFIER
|
901
|
+
else Kernel.raise ArgumentError, "invalid LoopFlags flag: #{name.inspect}"
|
902
|
+
end
|
903
|
+
end
|
904
|
+
|
905
|
+
# Retrieve the value of one of the ParameterFlags flags.
|
906
|
+
def parameter_flag(name)
|
907
|
+
case name
|
908
|
+
when :repeated_parameter then ParameterFlags::REPEATED_PARAMETER
|
909
|
+
else Kernel.raise ArgumentError, "invalid ParameterFlags flag: #{name.inspect}"
|
910
|
+
end
|
911
|
+
end
|
912
|
+
|
913
|
+
# Retrieve the value of one of the RangeFlags flags.
|
914
|
+
def range_flag(name)
|
915
|
+
case name
|
916
|
+
when :exclude_end then RangeFlags::EXCLUDE_END
|
917
|
+
else Kernel.raise ArgumentError, "invalid RangeFlags flag: #{name.inspect}"
|
918
|
+
end
|
919
|
+
end
|
920
|
+
|
921
|
+
# Retrieve the value of one of the RegularExpressionFlags flags.
|
922
|
+
def regular_expression_flag(name)
|
923
|
+
case name
|
924
|
+
when :ignore_case then RegularExpressionFlags::IGNORE_CASE
|
925
|
+
when :extended then RegularExpressionFlags::EXTENDED
|
926
|
+
when :multi_line then RegularExpressionFlags::MULTI_LINE
|
927
|
+
when :once then RegularExpressionFlags::ONCE
|
928
|
+
when :euc_jp then RegularExpressionFlags::EUC_JP
|
929
|
+
when :ascii_8bit then RegularExpressionFlags::ASCII_8BIT
|
930
|
+
when :windows_31j then RegularExpressionFlags::WINDOWS_31J
|
931
|
+
when :utf_8 then RegularExpressionFlags::UTF_8
|
932
|
+
when :forced_utf8_encoding then RegularExpressionFlags::FORCED_UTF8_ENCODING
|
933
|
+
when :forced_binary_encoding then RegularExpressionFlags::FORCED_BINARY_ENCODING
|
934
|
+
when :forced_us_ascii_encoding then RegularExpressionFlags::FORCED_US_ASCII_ENCODING
|
935
|
+
else Kernel.raise ArgumentError, "invalid RegularExpressionFlags flag: #{name.inspect}"
|
936
|
+
end
|
937
|
+
end
|
938
|
+
|
939
|
+
# Retrieve the value of one of the ShareableConstantNodeFlags flags.
|
940
|
+
def shareable_constant_node_flag(name)
|
941
|
+
case name
|
942
|
+
when :literal then ShareableConstantNodeFlags::LITERAL
|
943
|
+
when :experimental_everything then ShareableConstantNodeFlags::EXPERIMENTAL_EVERYTHING
|
944
|
+
when :experimental_copy then ShareableConstantNodeFlags::EXPERIMENTAL_COPY
|
945
|
+
else Kernel.raise ArgumentError, "invalid ShareableConstantNodeFlags flag: #{name.inspect}"
|
946
|
+
end
|
947
|
+
end
|
948
|
+
|
949
|
+
# Retrieve the value of one of the StringFlags flags.
|
950
|
+
def string_flag(name)
|
951
|
+
case name
|
952
|
+
when :forced_utf8_encoding then StringFlags::FORCED_UTF8_ENCODING
|
953
|
+
when :forced_binary_encoding then StringFlags::FORCED_BINARY_ENCODING
|
954
|
+
when :frozen then StringFlags::FROZEN
|
955
|
+
when :mutable then StringFlags::MUTABLE
|
956
|
+
else Kernel.raise ArgumentError, "invalid StringFlags flag: #{name.inspect}"
|
957
|
+
end
|
958
|
+
end
|
959
|
+
|
960
|
+
# Retrieve the value of one of the SymbolFlags flags.
|
961
|
+
def symbol_flag(name)
|
962
|
+
case name
|
963
|
+
when :forced_utf8_encoding then SymbolFlags::FORCED_UTF8_ENCODING
|
964
|
+
when :forced_binary_encoding then SymbolFlags::FORCED_BINARY_ENCODING
|
965
|
+
when :forced_us_ascii_encoding then SymbolFlags::FORCED_US_ASCII_ENCODING
|
966
|
+
else Kernel.raise ArgumentError, "invalid SymbolFlags flag: #{name.inspect}"
|
967
|
+
end
|
968
|
+
end
|
969
|
+
|
970
|
+
private
|
971
|
+
|
972
|
+
# The default source object that gets attached to nodes and locations if no
|
973
|
+
# source is specified.
|
974
|
+
def default_source
|
975
|
+
Source.for("")
|
793
976
|
end
|
794
977
|
|
795
|
-
#
|
796
|
-
|
797
|
-
|
978
|
+
# The default location object that gets attached to nodes if no location is
|
979
|
+
# specified, which uses the given source.
|
980
|
+
def default_location
|
981
|
+
Location.new(default_source, 0, 0)
|
798
982
|
end
|
799
983
|
|
800
|
-
#
|
801
|
-
|
802
|
-
|
984
|
+
# The default node that gets attached to nodes if no node is specified for a
|
985
|
+
# required node field.
|
986
|
+
def default_node(source, location)
|
987
|
+
MissingNode.new(source, -1, location, 0)
|
803
988
|
end
|
804
989
|
end
|
805
990
|
end
|