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