| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
module Prism |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
module DSL |
| 65 |
|
| 66 |
|
| 67 |
extend self |
| 68 |
|
| 69 |
|
| 70 |
def source(string) |
| 71 |
Source.for(string) |
| 72 |
end |
| 73 |
|
| 74 |
|
| 75 |
def location(source: default_source, start_offset: 0, length: 0) |
| 76 |
Location.new(source, start_offset, length) |
| 77 |
end |
| 78 |
|
| 79 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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, equal_loc: nil, block: nil) |
| 171 |
CallNode.new(source, node_id, location, flags, receiver, call_operator_loc, name, message_loc, opening_loc, arguments, closing_loc, equal_loc, block) |
| 172 |
end |
| 173 |
|
| 174 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 986 |
|
| 987 |
def default_source |
| 988 |
Source.for("") |
| 989 |
end |
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
def default_location |
| 994 |
Location.new(default_source, 0, 0) |
| 995 |
end |
| 996 |
|
| 997 |
|
| 998 |
|
| 999 |
def default_node(source, location) |
| 1000 |
MissingNode.new(source, -1, location, 0) |
| 1001 |
end |
| 1002 |
end |
| 1003 |
end |