| 1 | /* :markup: markdown */ |
| 2 | |
| 3 | /*----------------------------------------------------------------------------*/ |
| 4 | /* This file is generated by the templates/template.rb script and should not */ |
| 5 | /* be modified manually. See */ |
| 6 | /* templates/include/prism/ast.h.erb */ |
| 7 | /* if you are looking to modify the */ |
| 8 | /* template */ |
| 9 | /*----------------------------------------------------------------------------*/ |
| 10 | |
| 11 | /** |
| 12 | * @file ast.h |
| 13 | * |
| 14 | * The abstract syntax tree. |
| 15 | * |
| 16 | * -- |
| 17 | */ |
| 18 | #ifndef PRISM_AST_H |
| 19 | #define PRISM_AST_H |
| 20 | |
| 21 | #include "prism/defines.h" |
| 22 | #include "prism/util/pm_constant_pool.h" |
| 23 | #include "prism/util/pm_integer.h" |
| 24 | #include "prism/util/pm_string.h" |
| 25 | |
| 26 | #include <assert.h> |
| 27 | #include <stddef.h> |
| 28 | #include <stdint.h> |
| 29 | |
| 30 | /** |
| 31 | * This enum represents every type of token in the Ruby source. |
| 32 | */ |
| 33 | typedef enum pm_token_type { |
| 34 | /** final token in the file */ |
| 35 | PM_TOKEN_EOF = 1, |
| 36 | |
| 37 | /** } */ |
| 38 | PM_TOKEN_BRACE_RIGHT, |
| 39 | |
| 40 | /** , */ |
| 41 | PM_TOKEN_COMMA, |
| 42 | |
| 43 | /** } */ |
| 44 | PM_TOKEN_EMBEXPR_END, |
| 45 | |
| 46 | /** do */ |
| 47 | PM_TOKEN_KEYWORD_DO, |
| 48 | |
| 49 | /** else */ |
| 50 | PM_TOKEN_KEYWORD_ELSE, |
| 51 | |
| 52 | /** elsif */ |
| 53 | PM_TOKEN_KEYWORD_ELSIF, |
| 54 | |
| 55 | /** end */ |
| 56 | PM_TOKEN_KEYWORD_END, |
| 57 | |
| 58 | /** ensure */ |
| 59 | PM_TOKEN_KEYWORD_ENSURE, |
| 60 | |
| 61 | /** in */ |
| 62 | PM_TOKEN_KEYWORD_IN, |
| 63 | |
| 64 | /** rescue */ |
| 65 | PM_TOKEN_KEYWORD_RESCUE, |
| 66 | |
| 67 | /** then */ |
| 68 | PM_TOKEN_KEYWORD_THEN, |
| 69 | |
| 70 | /** when */ |
| 71 | PM_TOKEN_KEYWORD_WHEN, |
| 72 | |
| 73 | /** a newline character outside of other tokens */ |
| 74 | PM_TOKEN_NEWLINE, |
| 75 | |
| 76 | /** ) */ |
| 77 | PM_TOKEN_PARENTHESIS_RIGHT, |
| 78 | |
| 79 | /** | */ |
| 80 | PM_TOKEN_PIPE, |
| 81 | |
| 82 | /** ; */ |
| 83 | PM_TOKEN_SEMICOLON, |
| 84 | |
| 85 | /** & */ |
| 86 | PM_TOKEN_AMPERSAND, |
| 87 | |
| 88 | /** && */ |
| 89 | PM_TOKEN_AMPERSAND_AMPERSAND, |
| 90 | |
| 91 | /** &&= */ |
| 92 | PM_TOKEN_AMPERSAND_AMPERSAND_EQUAL, |
| 93 | |
| 94 | /** &. */ |
| 95 | PM_TOKEN_AMPERSAND_DOT, |
| 96 | |
| 97 | /** &= */ |
| 98 | PM_TOKEN_AMPERSAND_EQUAL, |
| 99 | |
| 100 | /** ` */ |
| 101 | PM_TOKEN_BACKTICK, |
| 102 | |
| 103 | /** a back reference */ |
| 104 | PM_TOKEN_BACK_REFERENCE, |
| 105 | |
| 106 | /** ! or !@ */ |
| 107 | PM_TOKEN_BANG, |
| 108 | |
| 109 | /** != */ |
| 110 | PM_TOKEN_BANG_EQUAL, |
| 111 | |
| 112 | /** !~ */ |
| 113 | PM_TOKEN_BANG_TILDE, |
| 114 | |
| 115 | /** { */ |
| 116 | PM_TOKEN_BRACE_LEFT, |
| 117 | |
| 118 | /** [ */ |
| 119 | PM_TOKEN_BRACKET_LEFT, |
| 120 | |
| 121 | /** [ for the beginning of an array */ |
| 122 | PM_TOKEN_BRACKET_LEFT_ARRAY, |
| 123 | |
| 124 | /** [] */ |
| 125 | PM_TOKEN_BRACKET_LEFT_RIGHT, |
| 126 | |
| 127 | /** []= */ |
| 128 | PM_TOKEN_BRACKET_LEFT_RIGHT_EQUAL, |
| 129 | |
| 130 | /** ] */ |
| 131 | PM_TOKEN_BRACKET_RIGHT, |
| 132 | |
| 133 | /** ^ */ |
| 134 | PM_TOKEN_CARET, |
| 135 | |
| 136 | /** ^= */ |
| 137 | PM_TOKEN_CARET_EQUAL, |
| 138 | |
| 139 | /** a character literal */ |
| 140 | PM_TOKEN_CHARACTER_LITERAL, |
| 141 | |
| 142 | /** a class variable */ |
| 143 | PM_TOKEN_CLASS_VARIABLE, |
| 144 | |
| 145 | /** : */ |
| 146 | PM_TOKEN_COLON, |
| 147 | |
| 148 | /** :: */ |
| 149 | PM_TOKEN_COLON_COLON, |
| 150 | |
| 151 | /** a comment */ |
| 152 | PM_TOKEN_COMMENT, |
| 153 | |
| 154 | /** a constant */ |
| 155 | PM_TOKEN_CONSTANT, |
| 156 | |
| 157 | /** the . call operator */ |
| 158 | PM_TOKEN_DOT, |
| 159 | |
| 160 | /** the .. range operator */ |
| 161 | PM_TOKEN_DOT_DOT, |
| 162 | |
| 163 | /** the ... range operator or forwarding parameter */ |
| 164 | PM_TOKEN_DOT_DOT_DOT, |
| 165 | |
| 166 | /** =begin */ |
| 167 | PM_TOKEN_EMBDOC_BEGIN, |
| 168 | |
| 169 | /** =end */ |
| 170 | PM_TOKEN_EMBDOC_END, |
| 171 | |
| 172 | /** a line inside of embedded documentation */ |
| 173 | PM_TOKEN_EMBDOC_LINE, |
| 174 | |
| 175 | /** #{ */ |
| 176 | PM_TOKEN_EMBEXPR_BEGIN, |
| 177 | |
| 178 | /** # */ |
| 179 | PM_TOKEN_EMBVAR, |
| 180 | |
| 181 | /** = */ |
| 182 | PM_TOKEN_EQUAL, |
| 183 | |
| 184 | /** == */ |
| 185 | PM_TOKEN_EQUAL_EQUAL, |
| 186 | |
| 187 | /** === */ |
| 188 | PM_TOKEN_EQUAL_EQUAL_EQUAL, |
| 189 | |
| 190 | /** => */ |
| 191 | PM_TOKEN_EQUAL_GREATER, |
| 192 | |
| 193 | /** =~ */ |
| 194 | PM_TOKEN_EQUAL_TILDE, |
| 195 | |
| 196 | /** a floating point number */ |
| 197 | PM_TOKEN_FLOAT, |
| 198 | |
| 199 | /** a floating pointer number with an imaginary suffix */ |
| 200 | PM_TOKEN_FLOAT_IMAGINARY, |
| 201 | |
| 202 | /** a floating pointer number with a rational suffix */ |
| 203 | PM_TOKEN_FLOAT_RATIONAL, |
| 204 | |
| 205 | /** a floating pointer number with a rational and imaginary suffix */ |
| 206 | PM_TOKEN_FLOAT_RATIONAL_IMAGINARY, |
| 207 | |
| 208 | /** a global variable */ |
| 209 | PM_TOKEN_GLOBAL_VARIABLE, |
| 210 | |
| 211 | /** > */ |
| 212 | PM_TOKEN_GREATER, |
| 213 | |
| 214 | /** >= */ |
| 215 | PM_TOKEN_GREATER_EQUAL, |
| 216 | |
| 217 | /** >> */ |
| 218 | PM_TOKEN_GREATER_GREATER, |
| 219 | |
| 220 | /** >>= */ |
| 221 | PM_TOKEN_GREATER_GREATER_EQUAL, |
| 222 | |
| 223 | /** the end of a heredoc */ |
| 224 | PM_TOKEN_HEREDOC_END, |
| 225 | |
| 226 | /** the start of a heredoc */ |
| 227 | PM_TOKEN_HEREDOC_START, |
| 228 | |
| 229 | /** an identifier */ |
| 230 | PM_TOKEN_IDENTIFIER, |
| 231 | |
| 232 | /** an ignored newline */ |
| 233 | PM_TOKEN_IGNORED_NEWLINE, |
| 234 | |
| 235 | /** an instance variable */ |
| 236 | PM_TOKEN_INSTANCE_VARIABLE, |
| 237 | |
| 238 | /** an integer (any base) */ |
| 239 | PM_TOKEN_INTEGER, |
| 240 | |
| 241 | /** an integer with an imaginary suffix */ |
| 242 | PM_TOKEN_INTEGER_IMAGINARY, |
| 243 | |
| 244 | /** an integer with a rational suffix */ |
| 245 | PM_TOKEN_INTEGER_RATIONAL, |
| 246 | |
| 247 | /** an integer with a rational and imaginary suffix */ |
| 248 | PM_TOKEN_INTEGER_RATIONAL_IMAGINARY, |
| 249 | |
| 250 | /** alias */ |
| 251 | PM_TOKEN_KEYWORD_ALIAS, |
| 252 | |
| 253 | /** and */ |
| 254 | PM_TOKEN_KEYWORD_AND, |
| 255 | |
| 256 | /** begin */ |
| 257 | PM_TOKEN_KEYWORD_BEGIN, |
| 258 | |
| 259 | /** BEGIN */ |
| 260 | PM_TOKEN_KEYWORD_BEGIN_UPCASE, |
| 261 | |
| 262 | /** break */ |
| 263 | PM_TOKEN_KEYWORD_BREAK, |
| 264 | |
| 265 | /** case */ |
| 266 | PM_TOKEN_KEYWORD_CASE, |
| 267 | |
| 268 | /** class */ |
| 269 | PM_TOKEN_KEYWORD_CLASS, |
| 270 | |
| 271 | /** def */ |
| 272 | PM_TOKEN_KEYWORD_DEF, |
| 273 | |
| 274 | /** defined? */ |
| 275 | PM_TOKEN_KEYWORD_DEFINED, |
| 276 | |
| 277 | /** do keyword for a predicate in a while, until, or for loop */ |
| 278 | PM_TOKEN_KEYWORD_DO_LOOP, |
| 279 | |
| 280 | /** END */ |
| 281 | PM_TOKEN_KEYWORD_END_UPCASE, |
| 282 | |
| 283 | /** false */ |
| 284 | PM_TOKEN_KEYWORD_FALSE, |
| 285 | |
| 286 | /** for */ |
| 287 | PM_TOKEN_KEYWORD_FOR, |
| 288 | |
| 289 | /** if */ |
| 290 | PM_TOKEN_KEYWORD_IF, |
| 291 | |
| 292 | /** if in the modifier form */ |
| 293 | PM_TOKEN_KEYWORD_IF_MODIFIER, |
| 294 | |
| 295 | /** module */ |
| 296 | PM_TOKEN_KEYWORD_MODULE, |
| 297 | |
| 298 | /** next */ |
| 299 | PM_TOKEN_KEYWORD_NEXT, |
| 300 | |
| 301 | /** nil */ |
| 302 | PM_TOKEN_KEYWORD_NIL, |
| 303 | |
| 304 | /** not */ |
| 305 | PM_TOKEN_KEYWORD_NOT, |
| 306 | |
| 307 | /** or */ |
| 308 | PM_TOKEN_KEYWORD_OR, |
| 309 | |
| 310 | /** redo */ |
| 311 | PM_TOKEN_KEYWORD_REDO, |
| 312 | |
| 313 | /** rescue in the modifier form */ |
| 314 | PM_TOKEN_KEYWORD_RESCUE_MODIFIER, |
| 315 | |
| 316 | /** retry */ |
| 317 | PM_TOKEN_KEYWORD_RETRY, |
| 318 | |
| 319 | /** return */ |
| 320 | PM_TOKEN_KEYWORD_RETURN, |
| 321 | |
| 322 | /** self */ |
| 323 | PM_TOKEN_KEYWORD_SELF, |
| 324 | |
| 325 | /** super */ |
| 326 | PM_TOKEN_KEYWORD_SUPER, |
| 327 | |
| 328 | /** true */ |
| 329 | PM_TOKEN_KEYWORD_TRUE, |
| 330 | |
| 331 | /** undef */ |
| 332 | PM_TOKEN_KEYWORD_UNDEF, |
| 333 | |
| 334 | /** unless */ |
| 335 | PM_TOKEN_KEYWORD_UNLESS, |
| 336 | |
| 337 | /** unless in the modifier form */ |
| 338 | PM_TOKEN_KEYWORD_UNLESS_MODIFIER, |
| 339 | |
| 340 | /** until */ |
| 341 | PM_TOKEN_KEYWORD_UNTIL, |
| 342 | |
| 343 | /** until in the modifier form */ |
| 344 | PM_TOKEN_KEYWORD_UNTIL_MODIFIER, |
| 345 | |
| 346 | /** while */ |
| 347 | PM_TOKEN_KEYWORD_WHILE, |
| 348 | |
| 349 | /** while in the modifier form */ |
| 350 | PM_TOKEN_KEYWORD_WHILE_MODIFIER, |
| 351 | |
| 352 | /** yield */ |
| 353 | PM_TOKEN_KEYWORD_YIELD, |
| 354 | |
| 355 | /** __ENCODING__ */ |
| 356 | PM_TOKEN_KEYWORD___ENCODING__, |
| 357 | |
| 358 | /** __FILE__ */ |
| 359 | PM_TOKEN_KEYWORD___FILE__, |
| 360 | |
| 361 | /** __LINE__ */ |
| 362 | PM_TOKEN_KEYWORD___LINE__, |
| 363 | |
| 364 | /** a label */ |
| 365 | PM_TOKEN_LABEL, |
| 366 | |
| 367 | /** the end of a label */ |
| 368 | PM_TOKEN_LABEL_END, |
| 369 | |
| 370 | /** { */ |
| 371 | PM_TOKEN_LAMBDA_BEGIN, |
| 372 | |
| 373 | /** < */ |
| 374 | PM_TOKEN_LESS, |
| 375 | |
| 376 | /** <= */ |
| 377 | PM_TOKEN_LESS_EQUAL, |
| 378 | |
| 379 | /** <=> */ |
| 380 | PM_TOKEN_LESS_EQUAL_GREATER, |
| 381 | |
| 382 | /** << */ |
| 383 | PM_TOKEN_LESS_LESS, |
| 384 | |
| 385 | /** <<= */ |
| 386 | PM_TOKEN_LESS_LESS_EQUAL, |
| 387 | |
| 388 | /** a method name */ |
| 389 | PM_TOKEN_METHOD_NAME, |
| 390 | |
| 391 | /** - */ |
| 392 | PM_TOKEN_MINUS, |
| 393 | |
| 394 | /** -= */ |
| 395 | PM_TOKEN_MINUS_EQUAL, |
| 396 | |
| 397 | /** -> */ |
| 398 | PM_TOKEN_MINUS_GREATER, |
| 399 | |
| 400 | /** a numbered reference to a capture group in the previous regular expression match */ |
| 401 | PM_TOKEN_NUMBERED_REFERENCE, |
| 402 | |
| 403 | /** ( */ |
| 404 | PM_TOKEN_PARENTHESIS_LEFT, |
| 405 | |
| 406 | /** ( for a parentheses node */ |
| 407 | PM_TOKEN_PARENTHESIS_LEFT_PARENTHESES, |
| 408 | |
| 409 | /** % */ |
| 410 | PM_TOKEN_PERCENT, |
| 411 | |
| 412 | /** %= */ |
| 413 | PM_TOKEN_PERCENT_EQUAL, |
| 414 | |
| 415 | /** %i */ |
| 416 | PM_TOKEN_PERCENT_LOWER_I, |
| 417 | |
| 418 | /** %w */ |
| 419 | PM_TOKEN_PERCENT_LOWER_W, |
| 420 | |
| 421 | /** %x */ |
| 422 | PM_TOKEN_PERCENT_LOWER_X, |
| 423 | |
| 424 | /** %I */ |
| 425 | PM_TOKEN_PERCENT_UPPER_I, |
| 426 | |
| 427 | /** %W */ |
| 428 | PM_TOKEN_PERCENT_UPPER_W, |
| 429 | |
| 430 | /** |= */ |
| 431 | PM_TOKEN_PIPE_EQUAL, |
| 432 | |
| 433 | /** || */ |
| 434 | PM_TOKEN_PIPE_PIPE, |
| 435 | |
| 436 | /** ||= */ |
| 437 | PM_TOKEN_PIPE_PIPE_EQUAL, |
| 438 | |
| 439 | /** + */ |
| 440 | PM_TOKEN_PLUS, |
| 441 | |
| 442 | /** += */ |
| 443 | PM_TOKEN_PLUS_EQUAL, |
| 444 | |
| 445 | /** ? */ |
| 446 | PM_TOKEN_QUESTION_MARK, |
| 447 | |
| 448 | /** the beginning of a regular expression */ |
| 449 | PM_TOKEN_REGEXP_BEGIN, |
| 450 | |
| 451 | /** the end of a regular expression */ |
| 452 | PM_TOKEN_REGEXP_END, |
| 453 | |
| 454 | /** / */ |
| 455 | PM_TOKEN_SLASH, |
| 456 | |
| 457 | /** /= */ |
| 458 | PM_TOKEN_SLASH_EQUAL, |
| 459 | |
| 460 | /** * */ |
| 461 | PM_TOKEN_STAR, |
| 462 | |
| 463 | /** *= */ |
| 464 | PM_TOKEN_STAR_EQUAL, |
| 465 | |
| 466 | /** ** */ |
| 467 | PM_TOKEN_STAR_STAR, |
| 468 | |
| 469 | /** **= */ |
| 470 | PM_TOKEN_STAR_STAR_EQUAL, |
| 471 | |
| 472 | /** the beginning of a string */ |
| 473 | PM_TOKEN_STRING_BEGIN, |
| 474 | |
| 475 | /** the contents of a string */ |
| 476 | PM_TOKEN_STRING_CONTENT, |
| 477 | |
| 478 | /** the end of a string */ |
| 479 | PM_TOKEN_STRING_END, |
| 480 | |
| 481 | /** the beginning of a symbol */ |
| 482 | PM_TOKEN_SYMBOL_BEGIN, |
| 483 | |
| 484 | /** ~ or ~@ */ |
| 485 | PM_TOKEN_TILDE, |
| 486 | |
| 487 | /** unary & */ |
| 488 | PM_TOKEN_UAMPERSAND, |
| 489 | |
| 490 | /** unary :: */ |
| 491 | PM_TOKEN_UCOLON_COLON, |
| 492 | |
| 493 | /** unary .. operator */ |
| 494 | PM_TOKEN_UDOT_DOT, |
| 495 | |
| 496 | /** unary ... operator */ |
| 497 | PM_TOKEN_UDOT_DOT_DOT, |
| 498 | |
| 499 | /** -@ */ |
| 500 | PM_TOKEN_UMINUS, |
| 501 | |
| 502 | /** -@ for a number */ |
| 503 | PM_TOKEN_UMINUS_NUM, |
| 504 | |
| 505 | /** +@ */ |
| 506 | PM_TOKEN_UPLUS, |
| 507 | |
| 508 | /** unary * */ |
| 509 | PM_TOKEN_USTAR, |
| 510 | |
| 511 | /** unary ** */ |
| 512 | PM_TOKEN_USTAR_STAR, |
| 513 | |
| 514 | /** a separator between words in a list */ |
| 515 | PM_TOKEN_WORDS_SEP, |
| 516 | |
| 517 | /** marker for the point in the file at which the parser should stop */ |
| 518 | PM_TOKEN___END__, |
| 519 | |
| 520 | /** a token that was expected but not found */ |
| 521 | PM_TOKEN_MISSING, |
| 522 | |
| 523 | /** a token that was not present but it is okay */ |
| 524 | PM_TOKEN_NOT_PROVIDED, |
| 525 | |
| 526 | /** The maximum token value. */ |
| 527 | PM_TOKEN_MAXIMUM, |
| 528 | } pm_token_type_t; |
| 529 | |
| 530 | /** |
| 531 | * This struct represents a token in the Ruby source. We use it to track both |
| 532 | * type and location information. |
| 533 | */ |
| 534 | typedef struct { |
| 535 | /** The type of the token. */ |
| 536 | pm_token_type_t type; |
| 537 | |
| 538 | /** A pointer to the start location of the token in the source. */ |
| 539 | const uint8_t *start; |
| 540 | |
| 541 | /** A pointer to the end location of the token in the source. */ |
| 542 | const uint8_t *end; |
| 543 | } pm_token_t; |
| 544 | |
| 545 | /** |
| 546 | * This represents a range of bytes in the source string to which a node or |
| 547 | * token corresponds. |
| 548 | */ |
| 549 | typedef struct { |
| 550 | /** A pointer to the start location of the range in the source. */ |
| 551 | const uint8_t *start; |
| 552 | |
| 553 | /** A pointer to the end location of the range in the source. */ |
| 554 | const uint8_t *end; |
| 555 | } pm_location_t; |
| 556 | |
| 557 | struct pm_node; |
| 558 | |
| 559 | /** |
| 560 | * A list of nodes in the source, most often used for lists of children. |
| 561 | */ |
| 562 | typedef struct pm_node_list { |
| 563 | /** The number of nodes in the list. */ |
| 564 | size_t size; |
| 565 | |
| 566 | /** The capacity of the list that has been allocated. */ |
| 567 | size_t capacity; |
| 568 | |
| 569 | /** The nodes in the list. */ |
| 570 | struct pm_node **nodes; |
| 571 | } pm_node_list_t; |
| 572 | |
| 573 | /** |
| 574 | * This enum represents every type of node in the Ruby syntax tree. |
| 575 | */ |
| 576 | enum pm_node_type { |
| 577 | /** AliasGlobalVariableNode */ |
| 578 | PM_ALIAS_GLOBAL_VARIABLE_NODE = 1, |
| 579 | |
| 580 | /** AliasMethodNode */ |
| 581 | PM_ALIAS_METHOD_NODE = 2, |
| 582 | |
| 583 | /** AlternationPatternNode */ |
| 584 | PM_ALTERNATION_PATTERN_NODE = 3, |
| 585 | |
| 586 | /** AndNode */ |
| 587 | PM_AND_NODE = 4, |
| 588 | |
| 589 | /** ArgumentsNode */ |
| 590 | PM_ARGUMENTS_NODE = 5, |
| 591 | |
| 592 | /** ArrayNode */ |
| 593 | PM_ARRAY_NODE = 6, |
| 594 | |
| 595 | /** ArrayPatternNode */ |
| 596 | PM_ARRAY_PATTERN_NODE = 7, |
| 597 | |
| 598 | /** AssocNode */ |
| 599 | PM_ASSOC_NODE = 8, |
| 600 | |
| 601 | /** AssocSplatNode */ |
| 602 | PM_ASSOC_SPLAT_NODE = 9, |
| 603 | |
| 604 | /** BackReferenceReadNode */ |
| 605 | PM_BACK_REFERENCE_READ_NODE = 10, |
| 606 | |
| 607 | /** BeginNode */ |
| 608 | PM_BEGIN_NODE = 11, |
| 609 | |
| 610 | /** BlockArgumentNode */ |
| 611 | PM_BLOCK_ARGUMENT_NODE = 12, |
| 612 | |
| 613 | /** BlockLocalVariableNode */ |
| 614 | PM_BLOCK_LOCAL_VARIABLE_NODE = 13, |
| 615 | |
| 616 | /** BlockNode */ |
| 617 | PM_BLOCK_NODE = 14, |
| 618 | |
| 619 | /** BlockParameterNode */ |
| 620 | PM_BLOCK_PARAMETER_NODE = 15, |
| 621 | |
| 622 | /** BlockParametersNode */ |
| 623 | PM_BLOCK_PARAMETERS_NODE = 16, |
| 624 | |
| 625 | /** BreakNode */ |
| 626 | PM_BREAK_NODE = 17, |
| 627 | |
| 628 | /** CallAndWriteNode */ |
| 629 | PM_CALL_AND_WRITE_NODE = 18, |
| 630 | |
| 631 | /** CallNode */ |
| 632 | PM_CALL_NODE = 19, |
| 633 | |
| 634 | /** CallOperatorWriteNode */ |
| 635 | PM_CALL_OPERATOR_WRITE_NODE = 20, |
| 636 | |
| 637 | /** CallOrWriteNode */ |
| 638 | PM_CALL_OR_WRITE_NODE = 21, |
| 639 | |
| 640 | /** CallTargetNode */ |
| 641 | PM_CALL_TARGET_NODE = 22, |
| 642 | |
| 643 | /** CapturePatternNode */ |
| 644 | PM_CAPTURE_PATTERN_NODE = 23, |
| 645 | |
| 646 | /** CaseMatchNode */ |
| 647 | PM_CASE_MATCH_NODE = 24, |
| 648 | |
| 649 | /** CaseNode */ |
| 650 | PM_CASE_NODE = 25, |
| 651 | |
| 652 | /** ClassNode */ |
| 653 | PM_CLASS_NODE = 26, |
| 654 | |
| 655 | /** ClassVariableAndWriteNode */ |
| 656 | PM_CLASS_VARIABLE_AND_WRITE_NODE = 27, |
| 657 | |
| 658 | /** ClassVariableOperatorWriteNode */ |
| 659 | PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE = 28, |
| 660 | |
| 661 | /** ClassVariableOrWriteNode */ |
| 662 | PM_CLASS_VARIABLE_OR_WRITE_NODE = 29, |
| 663 | |
| 664 | /** ClassVariableReadNode */ |
| 665 | PM_CLASS_VARIABLE_READ_NODE = 30, |
| 666 | |
| 667 | /** ClassVariableTargetNode */ |
| 668 | PM_CLASS_VARIABLE_TARGET_NODE = 31, |
| 669 | |
| 670 | /** ClassVariableWriteNode */ |
| 671 | PM_CLASS_VARIABLE_WRITE_NODE = 32, |
| 672 | |
| 673 | /** ConstantAndWriteNode */ |
| 674 | PM_CONSTANT_AND_WRITE_NODE = 33, |
| 675 | |
| 676 | /** ConstantOperatorWriteNode */ |
| 677 | PM_CONSTANT_OPERATOR_WRITE_NODE = 34, |
| 678 | |
| 679 | /** ConstantOrWriteNode */ |
| 680 | PM_CONSTANT_OR_WRITE_NODE = 35, |
| 681 | |
| 682 | /** ConstantPathAndWriteNode */ |
| 683 | PM_CONSTANT_PATH_AND_WRITE_NODE = 36, |
| 684 | |
| 685 | /** ConstantPathNode */ |
| 686 | PM_CONSTANT_PATH_NODE = 37, |
| 687 | |
| 688 | /** ConstantPathOperatorWriteNode */ |
| 689 | PM_CONSTANT_PATH_OPERATOR_WRITE_NODE = 38, |
| 690 | |
| 691 | /** ConstantPathOrWriteNode */ |
| 692 | PM_CONSTANT_PATH_OR_WRITE_NODE = 39, |
| 693 | |
| 694 | /** ConstantPathTargetNode */ |
| 695 | PM_CONSTANT_PATH_TARGET_NODE = 40, |
| 696 | |
| 697 | /** ConstantPathWriteNode */ |
| 698 | PM_CONSTANT_PATH_WRITE_NODE = 41, |
| 699 | |
| 700 | /** ConstantReadNode */ |
| 701 | PM_CONSTANT_READ_NODE = 42, |
| 702 | |
| 703 | /** ConstantTargetNode */ |
| 704 | PM_CONSTANT_TARGET_NODE = 43, |
| 705 | |
| 706 | /** ConstantWriteNode */ |
| 707 | PM_CONSTANT_WRITE_NODE = 44, |
| 708 | |
| 709 | /** DefNode */ |
| 710 | PM_DEF_NODE = 45, |
| 711 | |
| 712 | /** DefinedNode */ |
| 713 | PM_DEFINED_NODE = 46, |
| 714 | |
| 715 | /** ElseNode */ |
| 716 | PM_ELSE_NODE = 47, |
| 717 | |
| 718 | /** EmbeddedStatementsNode */ |
| 719 | PM_EMBEDDED_STATEMENTS_NODE = 48, |
| 720 | |
| 721 | /** EmbeddedVariableNode */ |
| 722 | PM_EMBEDDED_VARIABLE_NODE = 49, |
| 723 | |
| 724 | /** EnsureNode */ |
| 725 | PM_ENSURE_NODE = 50, |
| 726 | |
| 727 | /** FalseNode */ |
| 728 | PM_FALSE_NODE = 51, |
| 729 | |
| 730 | /** FindPatternNode */ |
| 731 | PM_FIND_PATTERN_NODE = 52, |
| 732 | |
| 733 | /** FlipFlopNode */ |
| 734 | PM_FLIP_FLOP_NODE = 53, |
| 735 | |
| 736 | /** FloatNode */ |
| 737 | PM_FLOAT_NODE = 54, |
| 738 | |
| 739 | /** ForNode */ |
| 740 | PM_FOR_NODE = 55, |
| 741 | |
| 742 | /** ForwardingArgumentsNode */ |
| 743 | PM_FORWARDING_ARGUMENTS_NODE = 56, |
| 744 | |
| 745 | /** ForwardingParameterNode */ |
| 746 | PM_FORWARDING_PARAMETER_NODE = 57, |
| 747 | |
| 748 | /** ForwardingSuperNode */ |
| 749 | PM_FORWARDING_SUPER_NODE = 58, |
| 750 | |
| 751 | /** GlobalVariableAndWriteNode */ |
| 752 | PM_GLOBAL_VARIABLE_AND_WRITE_NODE = 59, |
| 753 | |
| 754 | /** GlobalVariableOperatorWriteNode */ |
| 755 | PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE = 60, |
| 756 | |
| 757 | /** GlobalVariableOrWriteNode */ |
| 758 | PM_GLOBAL_VARIABLE_OR_WRITE_NODE = 61, |
| 759 | |
| 760 | /** GlobalVariableReadNode */ |
| 761 | PM_GLOBAL_VARIABLE_READ_NODE = 62, |
| 762 | |
| 763 | /** GlobalVariableTargetNode */ |
| 764 | PM_GLOBAL_VARIABLE_TARGET_NODE = 63, |
| 765 | |
| 766 | /** GlobalVariableWriteNode */ |
| 767 | PM_GLOBAL_VARIABLE_WRITE_NODE = 64, |
| 768 | |
| 769 | /** HashNode */ |
| 770 | PM_HASH_NODE = 65, |
| 771 | |
| 772 | /** HashPatternNode */ |
| 773 | PM_HASH_PATTERN_NODE = 66, |
| 774 | |
| 775 | /** IfNode */ |
| 776 | PM_IF_NODE = 67, |
| 777 | |
| 778 | /** ImaginaryNode */ |
| 779 | PM_IMAGINARY_NODE = 68, |
| 780 | |
| 781 | /** ImplicitNode */ |
| 782 | PM_IMPLICIT_NODE = 69, |
| 783 | |
| 784 | /** ImplicitRestNode */ |
| 785 | PM_IMPLICIT_REST_NODE = 70, |
| 786 | |
| 787 | /** InNode */ |
| 788 | PM_IN_NODE = 71, |
| 789 | |
| 790 | /** IndexAndWriteNode */ |
| 791 | PM_INDEX_AND_WRITE_NODE = 72, |
| 792 | |
| 793 | /** IndexOperatorWriteNode */ |
| 794 | PM_INDEX_OPERATOR_WRITE_NODE = 73, |
| 795 | |
| 796 | /** IndexOrWriteNode */ |
| 797 | PM_INDEX_OR_WRITE_NODE = 74, |
| 798 | |
| 799 | /** IndexTargetNode */ |
| 800 | PM_INDEX_TARGET_NODE = 75, |
| 801 | |
| 802 | /** InstanceVariableAndWriteNode */ |
| 803 | PM_INSTANCE_VARIABLE_AND_WRITE_NODE = 76, |
| 804 | |
| 805 | /** InstanceVariableOperatorWriteNode */ |
| 806 | PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE = 77, |
| 807 | |
| 808 | /** InstanceVariableOrWriteNode */ |
| 809 | PM_INSTANCE_VARIABLE_OR_WRITE_NODE = 78, |
| 810 | |
| 811 | /** InstanceVariableReadNode */ |
| 812 | PM_INSTANCE_VARIABLE_READ_NODE = 79, |
| 813 | |
| 814 | /** InstanceVariableTargetNode */ |
| 815 | PM_INSTANCE_VARIABLE_TARGET_NODE = 80, |
| 816 | |
| 817 | /** InstanceVariableWriteNode */ |
| 818 | PM_INSTANCE_VARIABLE_WRITE_NODE = 81, |
| 819 | |
| 820 | /** IntegerNode */ |
| 821 | PM_INTEGER_NODE = 82, |
| 822 | |
| 823 | /** InterpolatedMatchLastLineNode */ |
| 824 | PM_INTERPOLATED_MATCH_LAST_LINE_NODE = 83, |
| 825 | |
| 826 | /** InterpolatedRegularExpressionNode */ |
| 827 | PM_INTERPOLATED_REGULAR_EXPRESSION_NODE = 84, |
| 828 | |
| 829 | /** InterpolatedStringNode */ |
| 830 | PM_INTERPOLATED_STRING_NODE = 85, |
| 831 | |
| 832 | /** InterpolatedSymbolNode */ |
| 833 | PM_INTERPOLATED_SYMBOL_NODE = 86, |
| 834 | |
| 835 | /** InterpolatedXStringNode */ |
| 836 | PM_INTERPOLATED_X_STRING_NODE = 87, |
| 837 | |
| 838 | /** ItLocalVariableReadNode */ |
| 839 | PM_IT_LOCAL_VARIABLE_READ_NODE = 88, |
| 840 | |
| 841 | /** ItParametersNode */ |
| 842 | PM_IT_PARAMETERS_NODE = 89, |
| 843 | |
| 844 | /** KeywordHashNode */ |
| 845 | PM_KEYWORD_HASH_NODE = 90, |
| 846 | |
| 847 | /** KeywordRestParameterNode */ |
| 848 | PM_KEYWORD_REST_PARAMETER_NODE = 91, |
| 849 | |
| 850 | /** LambdaNode */ |
| 851 | PM_LAMBDA_NODE = 92, |
| 852 | |
| 853 | /** LocalVariableAndWriteNode */ |
| 854 | PM_LOCAL_VARIABLE_AND_WRITE_NODE = 93, |
| 855 | |
| 856 | /** LocalVariableOperatorWriteNode */ |
| 857 | PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE = 94, |
| 858 | |
| 859 | /** LocalVariableOrWriteNode */ |
| 860 | PM_LOCAL_VARIABLE_OR_WRITE_NODE = 95, |
| 861 | |
| 862 | /** LocalVariableReadNode */ |
| 863 | PM_LOCAL_VARIABLE_READ_NODE = 96, |
| 864 | |
| 865 | /** LocalVariableTargetNode */ |
| 866 | PM_LOCAL_VARIABLE_TARGET_NODE = 97, |
| 867 | |
| 868 | /** LocalVariableWriteNode */ |
| 869 | PM_LOCAL_VARIABLE_WRITE_NODE = 98, |
| 870 | |
| 871 | /** MatchLastLineNode */ |
| 872 | PM_MATCH_LAST_LINE_NODE = 99, |
| 873 | |
| 874 | /** MatchPredicateNode */ |
| 875 | PM_MATCH_PREDICATE_NODE = 100, |
| 876 | |
| 877 | /** MatchRequiredNode */ |
| 878 | PM_MATCH_REQUIRED_NODE = 101, |
| 879 | |
| 880 | /** MatchWriteNode */ |
| 881 | PM_MATCH_WRITE_NODE = 102, |
| 882 | |
| 883 | /** MissingNode */ |
| 884 | PM_MISSING_NODE = 103, |
| 885 | |
| 886 | /** ModuleNode */ |
| 887 | PM_MODULE_NODE = 104, |
| 888 | |
| 889 | /** MultiTargetNode */ |
| 890 | PM_MULTI_TARGET_NODE = 105, |
| 891 | |
| 892 | /** MultiWriteNode */ |
| 893 | PM_MULTI_WRITE_NODE = 106, |
| 894 | |
| 895 | /** NextNode */ |
| 896 | PM_NEXT_NODE = 107, |
| 897 | |
| 898 | /** NilNode */ |
| 899 | PM_NIL_NODE = 108, |
| 900 | |
| 901 | /** NoKeywordsParameterNode */ |
| 902 | PM_NO_KEYWORDS_PARAMETER_NODE = 109, |
| 903 | |
| 904 | /** NumberedParametersNode */ |
| 905 | PM_NUMBERED_PARAMETERS_NODE = 110, |
| 906 | |
| 907 | /** NumberedReferenceReadNode */ |
| 908 | PM_NUMBERED_REFERENCE_READ_NODE = 111, |
| 909 | |
| 910 | /** OptionalKeywordParameterNode */ |
| 911 | PM_OPTIONAL_KEYWORD_PARAMETER_NODE = 112, |
| 912 | |
| 913 | /** OptionalParameterNode */ |
| 914 | PM_OPTIONAL_PARAMETER_NODE = 113, |
| 915 | |
| 916 | /** OrNode */ |
| 917 | PM_OR_NODE = 114, |
| 918 | |
| 919 | /** ParametersNode */ |
| 920 | PM_PARAMETERS_NODE = 115, |
| 921 | |
| 922 | /** ParenthesesNode */ |
| 923 | PM_PARENTHESES_NODE = 116, |
| 924 | |
| 925 | /** PinnedExpressionNode */ |
| 926 | PM_PINNED_EXPRESSION_NODE = 117, |
| 927 | |
| 928 | /** PinnedVariableNode */ |
| 929 | PM_PINNED_VARIABLE_NODE = 118, |
| 930 | |
| 931 | /** PostExecutionNode */ |
| 932 | PM_POST_EXECUTION_NODE = 119, |
| 933 | |
| 934 | /** PreExecutionNode */ |
| 935 | PM_PRE_EXECUTION_NODE = 120, |
| 936 | |
| 937 | /** ProgramNode */ |
| 938 | PM_PROGRAM_NODE = 121, |
| 939 | |
| 940 | /** RangeNode */ |
| 941 | PM_RANGE_NODE = 122, |
| 942 | |
| 943 | /** RationalNode */ |
| 944 | PM_RATIONAL_NODE = 123, |
| 945 | |
| 946 | /** RedoNode */ |
| 947 | PM_REDO_NODE = 124, |
| 948 | |
| 949 | /** RegularExpressionNode */ |
| 950 | PM_REGULAR_EXPRESSION_NODE = 125, |
| 951 | |
| 952 | /** RequiredKeywordParameterNode */ |
| 953 | PM_REQUIRED_KEYWORD_PARAMETER_NODE = 126, |
| 954 | |
| 955 | /** RequiredParameterNode */ |
| 956 | PM_REQUIRED_PARAMETER_NODE = 127, |
| 957 | |
| 958 | /** RescueModifierNode */ |
| 959 | PM_RESCUE_MODIFIER_NODE = 128, |
| 960 | |
| 961 | /** RescueNode */ |
| 962 | PM_RESCUE_NODE = 129, |
| 963 | |
| 964 | /** RestParameterNode */ |
| 965 | PM_REST_PARAMETER_NODE = 130, |
| 966 | |
| 967 | /** RetryNode */ |
| 968 | PM_RETRY_NODE = 131, |
| 969 | |
| 970 | /** ReturnNode */ |
| 971 | PM_RETURN_NODE = 132, |
| 972 | |
| 973 | /** SelfNode */ |
| 974 | PM_SELF_NODE = 133, |
| 975 | |
| 976 | /** ShareableConstantNode */ |
| 977 | PM_SHAREABLE_CONSTANT_NODE = 134, |
| 978 | |
| 979 | /** SingletonClassNode */ |
| 980 | PM_SINGLETON_CLASS_NODE = 135, |
| 981 | |
| 982 | /** SourceEncodingNode */ |
| 983 | PM_SOURCE_ENCODING_NODE = 136, |
| 984 | |
| 985 | /** SourceFileNode */ |
| 986 | PM_SOURCE_FILE_NODE = 137, |
| 987 | |
| 988 | /** SourceLineNode */ |
| 989 | PM_SOURCE_LINE_NODE = 138, |
| 990 | |
| 991 | /** SplatNode */ |
| 992 | PM_SPLAT_NODE = 139, |
| 993 | |
| 994 | /** StatementsNode */ |
| 995 | PM_STATEMENTS_NODE = 140, |
| 996 | |
| 997 | /** StringNode */ |
| 998 | PM_STRING_NODE = 141, |
| 999 | |
| 1000 | /** SuperNode */ |
| 1001 | PM_SUPER_NODE = 142, |
| 1002 | |
| 1003 | /** SymbolNode */ |
| 1004 | PM_SYMBOL_NODE = 143, |
| 1005 | |
| 1006 | /** TrueNode */ |
| 1007 | PM_TRUE_NODE = 144, |
| 1008 | |
| 1009 | /** UndefNode */ |
| 1010 | PM_UNDEF_NODE = 145, |
| 1011 | |
| 1012 | /** UnlessNode */ |
| 1013 | PM_UNLESS_NODE = 146, |
| 1014 | |
| 1015 | /** UntilNode */ |
| 1016 | PM_UNTIL_NODE = 147, |
| 1017 | |
| 1018 | /** WhenNode */ |
| 1019 | PM_WHEN_NODE = 148, |
| 1020 | |
| 1021 | /** WhileNode */ |
| 1022 | PM_WHILE_NODE = 149, |
| 1023 | |
| 1024 | /** XStringNode */ |
| 1025 | PM_X_STRING_NODE = 150, |
| 1026 | |
| 1027 | /** YieldNode */ |
| 1028 | PM_YIELD_NODE = 151, |
| 1029 | |
| 1030 | /** A special kind of node used for compilation. */ |
| 1031 | PM_SCOPE_NODE |
| 1032 | }; |
| 1033 | |
| 1034 | /** |
| 1035 | * This is the type of node embedded in the node struct. We explicitly control |
| 1036 | * the size of it here to avoid having the variable-width enum. |
| 1037 | */ |
| 1038 | typedef uint16_t pm_node_type_t; |
| 1039 | |
| 1040 | /** |
| 1041 | * These are the flags embedded in the node struct. We explicitly control the |
| 1042 | * size of it here to avoid having the variable-width enum. |
| 1043 | */ |
| 1044 | typedef uint16_t pm_node_flags_t; |
| 1045 | |
| 1046 | /** |
| 1047 | * We store the flags enum in every node in the tree. Some flags are common to |
| 1048 | * all nodes (the ones listed below). Others are specific to certain node types. |
| 1049 | */ |
| 1050 | static const pm_node_flags_t PM_NODE_FLAG_NEWLINE = 0x1; |
| 1051 | static const pm_node_flags_t PM_NODE_FLAG_STATIC_LITERAL = 0x2; |
| 1052 | |
| 1053 | /** |
| 1054 | * This is the base structure that represents a node in the syntax tree. It is |
| 1055 | * embedded into every node type. |
| 1056 | */ |
| 1057 | typedef struct pm_node { |
| 1058 | /** |
| 1059 | * This represents the type of the node. It somewhat maps to the nodes that |
| 1060 | * existed in the original grammar and ripper, but it's not a 1:1 mapping. |
| 1061 | */ |
| 1062 | pm_node_type_t type; |
| 1063 | |
| 1064 | /** |
| 1065 | * This represents any flags on the node. Some are common to all nodes, and |
| 1066 | * some are specific to the type of node. |
| 1067 | */ |
| 1068 | pm_node_flags_t flags; |
| 1069 | |
| 1070 | /** |
| 1071 | * The unique identifier for this node, which is deterministic based on the |
| 1072 | * source. It is used to identify unique nodes across parses. |
| 1073 | */ |
| 1074 | uint32_t node_id; |
| 1075 | |
| 1076 | /** |
| 1077 | * This is the location of the node in the source. It's a range of bytes |
| 1078 | * containing a start and an end. |
| 1079 | */ |
| 1080 | pm_location_t location; |
| 1081 | } pm_node_t; |
| 1082 | |
| 1083 | /** |
| 1084 | * Cast the given node to the base pm_node_t type. |
| 1085 | */ |
| 1086 | #define PM_NODE_UPCAST(node_) ((pm_node_t *) (node_)) |
| 1087 | |
| 1088 | /** |
| 1089 | * Cast the type to an enum to allow the compiler to provide exhaustiveness |
| 1090 | * checking. |
| 1091 | */ |
| 1092 | #define PM_NODE_TYPE(node_) ((enum pm_node_type) (node_)->type) |
| 1093 | |
| 1094 | /** |
| 1095 | * Return true if the type of the given node matches the given type. |
| 1096 | */ |
| 1097 | #define PM_NODE_TYPE_P(node_, type_) (PM_NODE_TYPE(node_) == (type_)) |
| 1098 | |
| 1099 | /** |
| 1100 | * Return the flags associated with the given node. |
| 1101 | */ |
| 1102 | #define PM_NODE_FLAGS(node_) (PM_NODE_UPCAST(node_)->flags) |
| 1103 | |
| 1104 | /** |
| 1105 | * Return true if the given flag is set on the given node. |
| 1106 | */ |
| 1107 | #define PM_NODE_FLAG_P(node_, flag_) ((PM_NODE_FLAGS(node_) & (flag_)) != 0) |
| 1108 | |
| 1109 | /** |
| 1110 | * AliasGlobalVariableNode |
| 1111 | * |
| 1112 | * Represents the use of the `alias` keyword to alias a global variable. |
| 1113 | * |
| 1114 | * alias $foo $bar |
| 1115 | * ^^^^^^^^^^^^^^^ |
| 1116 | * |
| 1117 | * Type: ::PM_ALIAS_GLOBAL_VARIABLE_NODE |
| 1118 | * |
| 1119 | * @extends pm_node_t |
| 1120 | */ |
| 1121 | typedef struct pm_alias_global_variable_node { |
| 1122 | /** The embedded base node. */ |
| 1123 | pm_node_t base; |
| 1124 | |
| 1125 | |
| 1126 | /** |
| 1127 | * AliasGlobalVariableNode#new_name |
| 1128 | * |
| 1129 | * Represents the new name of the global variable that can be used after aliasing. |
| 1130 | * |
| 1131 | * alias $foo $bar |
| 1132 | * ^^^^ |
| 1133 | */ |
| 1134 | struct pm_node *new_name; |
| 1135 | |
| 1136 | /** |
| 1137 | * AliasGlobalVariableNode#old_name |
| 1138 | * |
| 1139 | * Represents the old name of the global variable that can be used before aliasing. |
| 1140 | * |
| 1141 | * alias $foo $bar |
| 1142 | * ^^^^ |
| 1143 | */ |
| 1144 | struct pm_node *old_name; |
| 1145 | |
| 1146 | /** |
| 1147 | * AliasGlobalVariableNode#keyword_loc |
| 1148 | * |
| 1149 | * The location of the `alias` keyword. |
| 1150 | * |
| 1151 | * alias $foo $bar |
| 1152 | * ^^^^^ |
| 1153 | */ |
| 1154 | pm_location_t keyword_loc; |
| 1155 | } pm_alias_global_variable_node_t; |
| 1156 | |
| 1157 | /** |
| 1158 | * AliasMethodNode |
| 1159 | * |
| 1160 | * Represents the use of the `alias` keyword to alias a method. |
| 1161 | * |
| 1162 | * alias foo bar |
| 1163 | * ^^^^^^^^^^^^^ |
| 1164 | * |
| 1165 | * Type: ::PM_ALIAS_METHOD_NODE |
| 1166 | * |
| 1167 | * @extends pm_node_t |
| 1168 | */ |
| 1169 | typedef struct pm_alias_method_node { |
| 1170 | /** The embedded base node. */ |
| 1171 | pm_node_t base; |
| 1172 | |
| 1173 | |
| 1174 | /** |
| 1175 | * AliasMethodNode#new_name |
| 1176 | * |
| 1177 | * Represents the new name of the method that will be aliased. |
| 1178 | * |
| 1179 | * alias foo bar |
| 1180 | * ^^^ |
| 1181 | * |
| 1182 | * alias :foo :bar |
| 1183 | * ^^^^ |
| 1184 | * |
| 1185 | * alias :"#{foo}" :"#{bar}" |
| 1186 | * ^^^^^^^^^ |
| 1187 | */ |
| 1188 | struct pm_node *new_name; |
| 1189 | |
| 1190 | /** |
| 1191 | * AliasMethodNode#old_name |
| 1192 | * |
| 1193 | * Represents the old name of the method that will be aliased. |
| 1194 | * |
| 1195 | * alias foo bar |
| 1196 | * ^^^ |
| 1197 | * |
| 1198 | * alias :foo :bar |
| 1199 | * ^^^^ |
| 1200 | * |
| 1201 | * alias :"#{foo}" :"#{bar}" |
| 1202 | * ^^^^^^^^^ |
| 1203 | */ |
| 1204 | struct pm_node *old_name; |
| 1205 | |
| 1206 | /** |
| 1207 | * AliasMethodNode#keyword_loc |
| 1208 | * |
| 1209 | * Represents the location of the `alias` keyword. |
| 1210 | * |
| 1211 | * alias foo bar |
| 1212 | * ^^^^^ |
| 1213 | */ |
| 1214 | pm_location_t keyword_loc; |
| 1215 | } pm_alias_method_node_t; |
| 1216 | |
| 1217 | /** |
| 1218 | * AlternationPatternNode |
| 1219 | * |
| 1220 | * Represents an alternation pattern in pattern matching. |
| 1221 | * |
| 1222 | * foo => bar | baz |
| 1223 | * ^^^^^^^^^ |
| 1224 | * |
| 1225 | * Type: ::PM_ALTERNATION_PATTERN_NODE |
| 1226 | * |
| 1227 | * @extends pm_node_t |
| 1228 | */ |
| 1229 | typedef struct pm_alternation_pattern_node { |
| 1230 | /** The embedded base node. */ |
| 1231 | pm_node_t base; |
| 1232 | |
| 1233 | |
| 1234 | /** |
| 1235 | * AlternationPatternNode#left |
| 1236 | * |
| 1237 | * Represents the left side of the expression. |
| 1238 | * |
| 1239 | * foo => bar | baz |
| 1240 | * ^^^ |
| 1241 | */ |
| 1242 | struct pm_node *left; |
| 1243 | |
| 1244 | /** |
| 1245 | * AlternationPatternNode#right |
| 1246 | * |
| 1247 | * Represents the right side of the expression. |
| 1248 | * |
| 1249 | * foo => bar | baz |
| 1250 | * ^^^ |
| 1251 | */ |
| 1252 | struct pm_node *right; |
| 1253 | |
| 1254 | /** |
| 1255 | * AlternationPatternNode#operator_loc |
| 1256 | * |
| 1257 | * Represents the alternation operator location. |
| 1258 | * |
| 1259 | * foo => bar | baz |
| 1260 | * ^ |
| 1261 | */ |
| 1262 | pm_location_t operator_loc; |
| 1263 | } pm_alternation_pattern_node_t; |
| 1264 | |
| 1265 | /** |
| 1266 | * AndNode |
| 1267 | * |
| 1268 | * Represents the use of the `&&` operator or the `and` keyword. |
| 1269 | * |
| 1270 | * left and right |
| 1271 | * ^^^^^^^^^^^^^^ |
| 1272 | * |
| 1273 | * Type: ::PM_AND_NODE |
| 1274 | * |
| 1275 | * @extends pm_node_t |
| 1276 | */ |
| 1277 | typedef struct pm_and_node { |
| 1278 | /** The embedded base node. */ |
| 1279 | pm_node_t base; |
| 1280 | |
| 1281 | |
| 1282 | /** |
| 1283 | * AndNode#left |
| 1284 | * |
| 1285 | * Represents the left side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 1286 | * |
| 1287 | * left and right |
| 1288 | * ^^^^ |
| 1289 | * |
| 1290 | * 1 && 2 |
| 1291 | * ^ |
| 1292 | */ |
| 1293 | struct pm_node *left; |
| 1294 | |
| 1295 | /** |
| 1296 | * AndNode#right |
| 1297 | * |
| 1298 | * Represents the right side of the expression. |
| 1299 | * |
| 1300 | * left && right |
| 1301 | * ^^^^^ |
| 1302 | * |
| 1303 | * 1 and 2 |
| 1304 | * ^ |
| 1305 | */ |
| 1306 | struct pm_node *right; |
| 1307 | |
| 1308 | /** |
| 1309 | * AndNode#operator_loc |
| 1310 | * |
| 1311 | * The location of the `and` keyword or the `&&` operator. |
| 1312 | * |
| 1313 | * left and right |
| 1314 | * ^^^ |
| 1315 | */ |
| 1316 | pm_location_t operator_loc; |
| 1317 | } pm_and_node_t; |
| 1318 | |
| 1319 | /** |
| 1320 | * ArgumentsNode |
| 1321 | * |
| 1322 | * Represents a set of arguments to a method or a keyword. |
| 1323 | * |
| 1324 | * return foo, bar, baz |
| 1325 | * ^^^^^^^^^^^^^ |
| 1326 | * |
| 1327 | * Type: ::PM_ARGUMENTS_NODE |
| 1328 | |
| 1329 | * Flags (#pm_arguments_node_flags): |
| 1330 | * * ::PM_ARGUMENTS_NODE_FLAGS_CONTAINS_FORWARDING |
| 1331 | * * ::PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS |
| 1332 | * * ::PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT |
| 1333 | * * ::PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT |
| 1334 | * * ::PM_ARGUMENTS_NODE_FLAGS_CONTAINS_MULTIPLE_SPLATS |
| 1335 | * |
| 1336 | * @extends pm_node_t |
| 1337 | */ |
| 1338 | typedef struct pm_arguments_node { |
| 1339 | /** The embedded base node. */ |
| 1340 | pm_node_t base; |
| 1341 | |
| 1342 | |
| 1343 | /** |
| 1344 | * ArgumentsNode#arguments |
| 1345 | * |
| 1346 | * The list of arguments, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 1347 | * |
| 1348 | * foo(bar, baz) |
| 1349 | * ^^^^^^^^ |
| 1350 | */ |
| 1351 | struct pm_node_list arguments; |
| 1352 | } pm_arguments_node_t; |
| 1353 | |
| 1354 | /** |
| 1355 | * ArrayNode |
| 1356 | * |
| 1357 | * Represents an array literal. This can be a regular array using brackets or a special array using % like %w or %i. |
| 1358 | * |
| 1359 | * [1, 2, 3] |
| 1360 | * ^^^^^^^^^ |
| 1361 | * |
| 1362 | * Type: ::PM_ARRAY_NODE |
| 1363 | |
| 1364 | * Flags (#pm_array_node_flags): |
| 1365 | * * ::PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT |
| 1366 | * |
| 1367 | * @extends pm_node_t |
| 1368 | */ |
| 1369 | typedef struct pm_array_node { |
| 1370 | /** The embedded base node. */ |
| 1371 | pm_node_t base; |
| 1372 | |
| 1373 | |
| 1374 | /** |
| 1375 | * ArrayNode#elements |
| 1376 | * |
| 1377 | * Represent the list of zero or more [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression) within the array. |
| 1378 | */ |
| 1379 | struct pm_node_list elements; |
| 1380 | |
| 1381 | /** |
| 1382 | * ArrayNode#opening_loc |
| 1383 | * |
| 1384 | * Represents the optional source location for the opening token. |
| 1385 | * |
| 1386 | * [1,2,3] # "[" |
| 1387 | * %w[foo bar baz] # "%w[" |
| 1388 | * %I(apple orange banana) # "%I(" |
| 1389 | * foo = 1, 2, 3 # nil |
| 1390 | */ |
| 1391 | pm_location_t opening_loc; |
| 1392 | |
| 1393 | /** |
| 1394 | * ArrayNode#closing_loc |
| 1395 | * |
| 1396 | * Represents the optional source location for the closing token. |
| 1397 | * |
| 1398 | * [1,2,3] # "]" |
| 1399 | * %w[foo bar baz] # "]" |
| 1400 | * %I(apple orange banana) # ")" |
| 1401 | * foo = 1, 2, 3 # nil |
| 1402 | */ |
| 1403 | pm_location_t closing_loc; |
| 1404 | } pm_array_node_t; |
| 1405 | |
| 1406 | /** |
| 1407 | * ArrayPatternNode |
| 1408 | * |
| 1409 | * Represents an array pattern in pattern matching. |
| 1410 | * |
| 1411 | * foo in 1, 2 |
| 1412 | * ^^^^^^^^^^^ |
| 1413 | * |
| 1414 | * foo in [1, 2] |
| 1415 | * ^^^^^^^^^^^^^ |
| 1416 | * |
| 1417 | * foo in *bar |
| 1418 | * ^^^^^^^^^^^ |
| 1419 | * |
| 1420 | * foo in Bar[] |
| 1421 | * ^^^^^^^^^^^^ |
| 1422 | * |
| 1423 | * foo in Bar[1, 2, 3] |
| 1424 | * ^^^^^^^^^^^^^^^^^^^ |
| 1425 | * |
| 1426 | * Type: ::PM_ARRAY_PATTERN_NODE |
| 1427 | * |
| 1428 | * @extends pm_node_t |
| 1429 | */ |
| 1430 | typedef struct pm_array_pattern_node { |
| 1431 | /** The embedded base node. */ |
| 1432 | pm_node_t base; |
| 1433 | |
| 1434 | |
| 1435 | /** |
| 1436 | * ArrayPatternNode#constant |
| 1437 | * |
| 1438 | * Represents the optional constant preceding the Array |
| 1439 | * |
| 1440 | * foo in Bar[] |
| 1441 | * ^^^ |
| 1442 | * |
| 1443 | * foo in Bar[1, 2, 3] |
| 1444 | * ^^^ |
| 1445 | * |
| 1446 | * foo in Bar::Baz[1, 2, 3] |
| 1447 | * ^^^^^^^^ |
| 1448 | */ |
| 1449 | struct pm_node *constant; |
| 1450 | |
| 1451 | /** |
| 1452 | * ArrayPatternNode#requireds |
| 1453 | * |
| 1454 | * Represents the required elements of the array pattern. |
| 1455 | * |
| 1456 | * foo in [1, 2] |
| 1457 | * ^ ^ |
| 1458 | */ |
| 1459 | struct pm_node_list requireds; |
| 1460 | |
| 1461 | /** |
| 1462 | * ArrayPatternNode#rest |
| 1463 | * |
| 1464 | * Represents the rest element of the array pattern. |
| 1465 | * |
| 1466 | * foo in *bar |
| 1467 | * ^^^^ |
| 1468 | */ |
| 1469 | struct pm_node *rest; |
| 1470 | |
| 1471 | /** |
| 1472 | * ArrayPatternNode#posts |
| 1473 | * |
| 1474 | * Represents the elements after the rest element of the array pattern. |
| 1475 | * |
| 1476 | * foo in *bar, baz |
| 1477 | * ^^^ |
| 1478 | */ |
| 1479 | struct pm_node_list posts; |
| 1480 | |
| 1481 | /** |
| 1482 | * ArrayPatternNode#opening_loc |
| 1483 | * |
| 1484 | * Represents the opening location of the array pattern. |
| 1485 | * |
| 1486 | * foo in [1, 2] |
| 1487 | * ^ |
| 1488 | */ |
| 1489 | pm_location_t opening_loc; |
| 1490 | |
| 1491 | /** |
| 1492 | * ArrayPatternNode#closing_loc |
| 1493 | * |
| 1494 | * Represents the closing location of the array pattern. |
| 1495 | * |
| 1496 | * foo in [1, 2] |
| 1497 | * ^ |
| 1498 | */ |
| 1499 | pm_location_t closing_loc; |
| 1500 | } pm_array_pattern_node_t; |
| 1501 | |
| 1502 | /** |
| 1503 | * AssocNode |
| 1504 | * |
| 1505 | * Represents a hash key/value pair. |
| 1506 | * |
| 1507 | * { a => b } |
| 1508 | * ^^^^^^ |
| 1509 | * |
| 1510 | * Type: ::PM_ASSOC_NODE |
| 1511 | * |
| 1512 | * @extends pm_node_t |
| 1513 | */ |
| 1514 | typedef struct pm_assoc_node { |
| 1515 | /** The embedded base node. */ |
| 1516 | pm_node_t base; |
| 1517 | |
| 1518 | |
| 1519 | /** |
| 1520 | * AssocNode#key |
| 1521 | * |
| 1522 | * The key of the association. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 1523 | * |
| 1524 | * { a: b } |
| 1525 | * ^ |
| 1526 | * |
| 1527 | * { foo => bar } |
| 1528 | * ^^^ |
| 1529 | * |
| 1530 | * { def a; end => 1 } |
| 1531 | * ^^^^^^^^^^ |
| 1532 | */ |
| 1533 | struct pm_node *key; |
| 1534 | |
| 1535 | /** |
| 1536 | * AssocNode#value |
| 1537 | * |
| 1538 | * The value of the association, if present. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 1539 | * |
| 1540 | * { foo => bar } |
| 1541 | * ^^^ |
| 1542 | * |
| 1543 | * { x: 1 } |
| 1544 | * ^ |
| 1545 | */ |
| 1546 | struct pm_node *value; |
| 1547 | |
| 1548 | /** |
| 1549 | * AssocNode#operator_loc |
| 1550 | * |
| 1551 | * The location of the `=>` operator, if present. |
| 1552 | * |
| 1553 | * { foo => bar } |
| 1554 | * ^^ |
| 1555 | */ |
| 1556 | pm_location_t operator_loc; |
| 1557 | } pm_assoc_node_t; |
| 1558 | |
| 1559 | /** |
| 1560 | * AssocSplatNode |
| 1561 | * |
| 1562 | * Represents a splat in a hash literal. |
| 1563 | * |
| 1564 | * { **foo } |
| 1565 | * ^^^^^ |
| 1566 | * |
| 1567 | * Type: ::PM_ASSOC_SPLAT_NODE |
| 1568 | * |
| 1569 | * @extends pm_node_t |
| 1570 | */ |
| 1571 | typedef struct pm_assoc_splat_node { |
| 1572 | /** The embedded base node. */ |
| 1573 | pm_node_t base; |
| 1574 | |
| 1575 | |
| 1576 | /** |
| 1577 | * AssocSplatNode#value |
| 1578 | * |
| 1579 | * The value to be splatted, if present. Will be missing when keyword rest argument forwarding is used. |
| 1580 | * |
| 1581 | * { **foo } |
| 1582 | * ^^^ |
| 1583 | */ |
| 1584 | struct pm_node *value; |
| 1585 | |
| 1586 | /** |
| 1587 | * AssocSplatNode#operator_loc |
| 1588 | * |
| 1589 | * The location of the `**` operator. |
| 1590 | * |
| 1591 | * { **x } |
| 1592 | * ^^ |
| 1593 | */ |
| 1594 | pm_location_t operator_loc; |
| 1595 | } pm_assoc_splat_node_t; |
| 1596 | |
| 1597 | /** |
| 1598 | * BackReferenceReadNode |
| 1599 | * |
| 1600 | * Represents reading a reference to a field in the previous match. |
| 1601 | * |
| 1602 | * $' |
| 1603 | * ^^ |
| 1604 | * |
| 1605 | * Type: ::PM_BACK_REFERENCE_READ_NODE |
| 1606 | * |
| 1607 | * @extends pm_node_t |
| 1608 | */ |
| 1609 | typedef struct pm_back_reference_read_node { |
| 1610 | /** The embedded base node. */ |
| 1611 | pm_node_t base; |
| 1612 | |
| 1613 | |
| 1614 | /** |
| 1615 | * BackReferenceReadNode#name |
| 1616 | * |
| 1617 | * The name of the back-reference variable, including the leading `$`. |
| 1618 | * |
| 1619 | * $& # name `:$&` |
| 1620 | * |
| 1621 | * $+ # name `:$+` |
| 1622 | */ |
| 1623 | pm_constant_id_t name; |
| 1624 | } pm_back_reference_read_node_t; |
| 1625 | |
| 1626 | /** |
| 1627 | * BeginNode |
| 1628 | * |
| 1629 | * Represents a begin statement. |
| 1630 | * |
| 1631 | * begin |
| 1632 | * foo |
| 1633 | * end |
| 1634 | * ^^^^^ |
| 1635 | * |
| 1636 | * Type: ::PM_BEGIN_NODE |
| 1637 | * |
| 1638 | * @extends pm_node_t |
| 1639 | */ |
| 1640 | typedef struct pm_begin_node { |
| 1641 | /** The embedded base node. */ |
| 1642 | pm_node_t base; |
| 1643 | |
| 1644 | |
| 1645 | /** |
| 1646 | * BeginNode#begin_keyword_loc |
| 1647 | * |
| 1648 | * Represents the location of the `begin` keyword. |
| 1649 | * |
| 1650 | * begin x end |
| 1651 | * ^^^^^ |
| 1652 | */ |
| 1653 | pm_location_t begin_keyword_loc; |
| 1654 | |
| 1655 | /** |
| 1656 | * BeginNode#statements |
| 1657 | * |
| 1658 | * Represents the statements within the begin block. |
| 1659 | * |
| 1660 | * begin x end |
| 1661 | * ^ |
| 1662 | */ |
| 1663 | struct pm_statements_node *statements; |
| 1664 | |
| 1665 | /** |
| 1666 | * BeginNode#rescue_clause |
| 1667 | * |
| 1668 | * Represents the rescue clause within the begin block. |
| 1669 | * |
| 1670 | * begin x; rescue y; end |
| 1671 | * ^^^^^^^^ |
| 1672 | */ |
| 1673 | struct pm_rescue_node *rescue_clause; |
| 1674 | |
| 1675 | /** |
| 1676 | * BeginNode#else_clause |
| 1677 | * |
| 1678 | * Represents the else clause within the begin block. |
| 1679 | * |
| 1680 | * begin x; rescue y; else z; end |
| 1681 | * ^^^^^^ |
| 1682 | */ |
| 1683 | struct pm_else_node *else_clause; |
| 1684 | |
| 1685 | /** |
| 1686 | * BeginNode#ensure_clause |
| 1687 | * |
| 1688 | * Represents the ensure clause within the begin block. |
| 1689 | * |
| 1690 | * begin x; ensure y; end |
| 1691 | * ^^^^^^^^ |
| 1692 | */ |
| 1693 | struct pm_ensure_node *ensure_clause; |
| 1694 | |
| 1695 | /** |
| 1696 | * BeginNode#end_keyword_loc |
| 1697 | * |
| 1698 | * Represents the location of the `end` keyword. |
| 1699 | * |
| 1700 | * begin x end |
| 1701 | * ^^^ |
| 1702 | */ |
| 1703 | pm_location_t end_keyword_loc; |
| 1704 | } pm_begin_node_t; |
| 1705 | |
| 1706 | /** |
| 1707 | * BlockArgumentNode |
| 1708 | * |
| 1709 | * Represents a block argument using `&`. |
| 1710 | * |
| 1711 | * bar(&args) |
| 1712 | * ^^^^^^^^^^ |
| 1713 | * |
| 1714 | * Type: ::PM_BLOCK_ARGUMENT_NODE |
| 1715 | * |
| 1716 | * @extends pm_node_t |
| 1717 | */ |
| 1718 | typedef struct pm_block_argument_node { |
| 1719 | /** The embedded base node. */ |
| 1720 | pm_node_t base; |
| 1721 | |
| 1722 | |
| 1723 | /** |
| 1724 | * BlockArgumentNode#expression |
| 1725 | * |
| 1726 | * The expression that is being passed as a block argument. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 1727 | * |
| 1728 | * foo(&args) |
| 1729 | * ^^^^^ |
| 1730 | */ |
| 1731 | struct pm_node *expression; |
| 1732 | |
| 1733 | /** |
| 1734 | * BlockArgumentNode#operator_loc |
| 1735 | * |
| 1736 | * Represents the location of the `&` operator. |
| 1737 | * |
| 1738 | * foo(&args) |
| 1739 | * ^ |
| 1740 | */ |
| 1741 | pm_location_t operator_loc; |
| 1742 | } pm_block_argument_node_t; |
| 1743 | |
| 1744 | /** |
| 1745 | * BlockLocalVariableNode |
| 1746 | * |
| 1747 | * Represents a block local variable. |
| 1748 | * |
| 1749 | * a { |; b| } |
| 1750 | * ^ |
| 1751 | * |
| 1752 | * Type: ::PM_BLOCK_LOCAL_VARIABLE_NODE |
| 1753 | |
| 1754 | * Flags (#pm_parameter_flags): |
| 1755 | * * ::PM_PARAMETER_FLAGS_REPEATED_PARAMETER |
| 1756 | * |
| 1757 | * @extends pm_node_t |
| 1758 | */ |
| 1759 | typedef struct pm_block_local_variable_node { |
| 1760 | /** The embedded base node. */ |
| 1761 | pm_node_t base; |
| 1762 | |
| 1763 | |
| 1764 | /** |
| 1765 | * BlockLocalVariableNode#name |
| 1766 | * |
| 1767 | * The name of the block local variable. |
| 1768 | * |
| 1769 | * a { |; b| } # name `:b` |
| 1770 | * ^ |
| 1771 | */ |
| 1772 | pm_constant_id_t name; |
| 1773 | } pm_block_local_variable_node_t; |
| 1774 | |
| 1775 | /** |
| 1776 | * BlockNode |
| 1777 | * |
| 1778 | * Represents a block of ruby code. |
| 1779 | * |
| 1780 | * [1, 2, 3].each { |i| puts x } |
| 1781 | * ^^^^^^^^^^^^^^ |
| 1782 | * |
| 1783 | * Type: ::PM_BLOCK_NODE |
| 1784 | * |
| 1785 | * @extends pm_node_t |
| 1786 | */ |
| 1787 | typedef struct pm_block_node { |
| 1788 | /** The embedded base node. */ |
| 1789 | pm_node_t base; |
| 1790 | |
| 1791 | |
| 1792 | /** |
| 1793 | * BlockNode#locals |
| 1794 | * |
| 1795 | * The local variables declared in the block. |
| 1796 | * |
| 1797 | * [1, 2, 3].each { |i| puts x } # locals: [:i] |
| 1798 | * ^ |
| 1799 | */ |
| 1800 | pm_constant_id_list_t locals; |
| 1801 | |
| 1802 | /** |
| 1803 | * BlockNode#parameters |
| 1804 | * |
| 1805 | * The parameters of the block. |
| 1806 | * |
| 1807 | * [1, 2, 3].each { |i| puts x } |
| 1808 | * ^^^ |
| 1809 | * [1, 2, 3].each { puts _1 } |
| 1810 | * ^^^^^^^^^^^ |
| 1811 | * [1, 2, 3].each { puts it } |
| 1812 | * ^^^^^^^^^^^ |
| 1813 | */ |
| 1814 | struct pm_node *parameters; |
| 1815 | |
| 1816 | /** |
| 1817 | * BlockNode#body |
| 1818 | * |
| 1819 | * The body of the block. |
| 1820 | * |
| 1821 | * [1, 2, 3].each { |i| puts x } |
| 1822 | * ^^^^^^ |
| 1823 | */ |
| 1824 | struct pm_node *body; |
| 1825 | |
| 1826 | /** |
| 1827 | * BlockNode#opening_loc |
| 1828 | * |
| 1829 | * Represents the location of the opening `{` or `do`. |
| 1830 | * |
| 1831 | * [1, 2, 3].each { |i| puts x } |
| 1832 | * ^ |
| 1833 | */ |
| 1834 | pm_location_t opening_loc; |
| 1835 | |
| 1836 | /** |
| 1837 | * BlockNode#closing_loc |
| 1838 | * |
| 1839 | * Represents the location of the closing `}` or `end`. |
| 1840 | * |
| 1841 | * [1, 2, 3].each { |i| puts x } |
| 1842 | * ^ |
| 1843 | */ |
| 1844 | pm_location_t closing_loc; |
| 1845 | } pm_block_node_t; |
| 1846 | |
| 1847 | /** |
| 1848 | * BlockParameterNode |
| 1849 | * |
| 1850 | * Represents a block parameter of a method, block, or lambda definition. |
| 1851 | * |
| 1852 | * def a(&b) |
| 1853 | * ^^ |
| 1854 | * end |
| 1855 | * |
| 1856 | * Type: ::PM_BLOCK_PARAMETER_NODE |
| 1857 | |
| 1858 | * Flags (#pm_parameter_flags): |
| 1859 | * * ::PM_PARAMETER_FLAGS_REPEATED_PARAMETER |
| 1860 | * |
| 1861 | * @extends pm_node_t |
| 1862 | */ |
| 1863 | typedef struct pm_block_parameter_node { |
| 1864 | /** The embedded base node. */ |
| 1865 | pm_node_t base; |
| 1866 | |
| 1867 | |
| 1868 | /** |
| 1869 | * BlockParameterNode#name |
| 1870 | * |
| 1871 | * The name of the block parameter. |
| 1872 | * |
| 1873 | * def a(&b) # name `:b` |
| 1874 | * ^ |
| 1875 | * end |
| 1876 | */ |
| 1877 | pm_constant_id_t name; |
| 1878 | |
| 1879 | /** |
| 1880 | * BlockParameterNode#name_loc |
| 1881 | * |
| 1882 | * Represents the location of the block parameter name. |
| 1883 | * |
| 1884 | * def a(&b) |
| 1885 | * ^ |
| 1886 | */ |
| 1887 | pm_location_t name_loc; |
| 1888 | |
| 1889 | /** |
| 1890 | * BlockParameterNode#operator_loc |
| 1891 | * |
| 1892 | * Represents the location of the `&` operator. |
| 1893 | * |
| 1894 | * def a(&b) |
| 1895 | * ^ |
| 1896 | * end |
| 1897 | */ |
| 1898 | pm_location_t operator_loc; |
| 1899 | } pm_block_parameter_node_t; |
| 1900 | |
| 1901 | /** |
| 1902 | * BlockParametersNode |
| 1903 | * |
| 1904 | * Represents a block's parameters declaration. |
| 1905 | * |
| 1906 | * -> (a, b = 1; local) { } |
| 1907 | * ^^^^^^^^^^^^^^^^^ |
| 1908 | * |
| 1909 | * foo do |a, b = 1; local| |
| 1910 | * ^^^^^^^^^^^^^^^^^ |
| 1911 | * end |
| 1912 | * |
| 1913 | * Type: ::PM_BLOCK_PARAMETERS_NODE |
| 1914 | * |
| 1915 | * @extends pm_node_t |
| 1916 | */ |
| 1917 | typedef struct pm_block_parameters_node { |
| 1918 | /** The embedded base node. */ |
| 1919 | pm_node_t base; |
| 1920 | |
| 1921 | |
| 1922 | /** |
| 1923 | * BlockParametersNode#parameters |
| 1924 | * |
| 1925 | * Represents the parameters of the block. |
| 1926 | * |
| 1927 | * -> (a, b = 1; local) { } |
| 1928 | * ^^^^^^^^ |
| 1929 | * |
| 1930 | * foo do |a, b = 1; local| |
| 1931 | * ^^^^^^^^ |
| 1932 | * end |
| 1933 | */ |
| 1934 | struct pm_parameters_node *parameters; |
| 1935 | |
| 1936 | /** |
| 1937 | * BlockParametersNode#locals |
| 1938 | * |
| 1939 | * Represents the local variables of the block. |
| 1940 | * |
| 1941 | * -> (a, b = 1; local) { } |
| 1942 | * ^^^^^ |
| 1943 | * |
| 1944 | * foo do |a, b = 1; local| |
| 1945 | * ^^^^^ |
| 1946 | * end |
| 1947 | */ |
| 1948 | struct pm_node_list locals; |
| 1949 | |
| 1950 | /** |
| 1951 | * BlockParametersNode#opening_loc |
| 1952 | * |
| 1953 | * Represents the opening location of the block parameters. |
| 1954 | * |
| 1955 | * -> (a, b = 1; local) { } |
| 1956 | * ^ |
| 1957 | * |
| 1958 | * foo do |a, b = 1; local| |
| 1959 | * ^ |
| 1960 | * end |
| 1961 | */ |
| 1962 | pm_location_t opening_loc; |
| 1963 | |
| 1964 | /** |
| 1965 | * BlockParametersNode#closing_loc |
| 1966 | * |
| 1967 | * Represents the closing location of the block parameters. |
| 1968 | * |
| 1969 | * -> (a, b = 1; local) { } |
| 1970 | * ^ |
| 1971 | * |
| 1972 | * foo do |a, b = 1; local| |
| 1973 | * ^ |
| 1974 | * end |
| 1975 | */ |
| 1976 | pm_location_t closing_loc; |
| 1977 | } pm_block_parameters_node_t; |
| 1978 | |
| 1979 | /** |
| 1980 | * BreakNode |
| 1981 | * |
| 1982 | * Represents the use of the `break` keyword. |
| 1983 | * |
| 1984 | * break foo |
| 1985 | * ^^^^^^^^^ |
| 1986 | * |
| 1987 | * Type: ::PM_BREAK_NODE |
| 1988 | * |
| 1989 | * @extends pm_node_t |
| 1990 | */ |
| 1991 | typedef struct pm_break_node { |
| 1992 | /** The embedded base node. */ |
| 1993 | pm_node_t base; |
| 1994 | |
| 1995 | |
| 1996 | /** |
| 1997 | * BreakNode#arguments |
| 1998 | * |
| 1999 | * The arguments to the break statement, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 2000 | * |
| 2001 | * break foo |
| 2002 | * ^^^ |
| 2003 | */ |
| 2004 | struct pm_arguments_node *arguments; |
| 2005 | |
| 2006 | /** |
| 2007 | * BreakNode#keyword_loc |
| 2008 | * |
| 2009 | * The location of the `break` keyword. |
| 2010 | * |
| 2011 | * break foo |
| 2012 | * ^^^^^ |
| 2013 | */ |
| 2014 | pm_location_t keyword_loc; |
| 2015 | } pm_break_node_t; |
| 2016 | |
| 2017 | /** |
| 2018 | * CallAndWriteNode |
| 2019 | * |
| 2020 | * Represents the use of the `&&=` operator on a call. |
| 2021 | * |
| 2022 | * foo.bar &&= value |
| 2023 | * ^^^^^^^^^^^^^^^^^ |
| 2024 | * |
| 2025 | * Type: ::PM_CALL_AND_WRITE_NODE |
| 2026 | |
| 2027 | * Flags (#pm_call_node_flags): |
| 2028 | * * ::PM_CALL_NODE_FLAGS_SAFE_NAVIGATION |
| 2029 | * * ::PM_CALL_NODE_FLAGS_VARIABLE_CALL |
| 2030 | * * ::PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE |
| 2031 | * * ::PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY |
| 2032 | * |
| 2033 | * @extends pm_node_t |
| 2034 | */ |
| 2035 | typedef struct pm_call_and_write_node { |
| 2036 | /** The embedded base node. */ |
| 2037 | pm_node_t base; |
| 2038 | |
| 2039 | |
| 2040 | /** |
| 2041 | * CallAndWriteNode#receiver |
| 2042 | * |
| 2043 | * The object that the method is being called on. This can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 2044 | * |
| 2045 | * foo.bar &&= value |
| 2046 | * ^^^ |
| 2047 | */ |
| 2048 | struct pm_node *receiver; |
| 2049 | |
| 2050 | /** |
| 2051 | * CallAndWriteNode#call_operator_loc |
| 2052 | * |
| 2053 | * Represents the location of the call operator. |
| 2054 | * |
| 2055 | * foo.bar &&= value |
| 2056 | * ^ |
| 2057 | */ |
| 2058 | pm_location_t call_operator_loc; |
| 2059 | |
| 2060 | /** |
| 2061 | * CallAndWriteNode#message_loc |
| 2062 | * |
| 2063 | * Represents the location of the message. |
| 2064 | * |
| 2065 | * foo.bar &&= value |
| 2066 | * ^^^ |
| 2067 | */ |
| 2068 | pm_location_t message_loc; |
| 2069 | |
| 2070 | /** |
| 2071 | * CallAndWriteNode#read_name |
| 2072 | * |
| 2073 | * Represents the name of the method being called. |
| 2074 | * |
| 2075 | * foo.bar &&= value # read_name `:bar` |
| 2076 | * ^^^ |
| 2077 | */ |
| 2078 | pm_constant_id_t read_name; |
| 2079 | |
| 2080 | /** |
| 2081 | * CallAndWriteNode#write_name |
| 2082 | * |
| 2083 | * Represents the name of the method being written to. |
| 2084 | * |
| 2085 | * foo.bar &&= value # write_name `:bar=` |
| 2086 | * ^^^ |
| 2087 | */ |
| 2088 | pm_constant_id_t write_name; |
| 2089 | |
| 2090 | /** |
| 2091 | * CallAndWriteNode#operator_loc |
| 2092 | * |
| 2093 | * Represents the location of the operator. |
| 2094 | * |
| 2095 | * foo.bar &&= value |
| 2096 | * ^^^ |
| 2097 | */ |
| 2098 | pm_location_t operator_loc; |
| 2099 | |
| 2100 | /** |
| 2101 | * CallAndWriteNode#value |
| 2102 | * |
| 2103 | * Represents the value being assigned. |
| 2104 | * |
| 2105 | * foo.bar &&= value |
| 2106 | * ^^^^^ |
| 2107 | */ |
| 2108 | struct pm_node *value; |
| 2109 | } pm_call_and_write_node_t; |
| 2110 | |
| 2111 | /** |
| 2112 | * CallNode |
| 2113 | * |
| 2114 | * Represents a method call, in all of the various forms that can take. |
| 2115 | * |
| 2116 | * foo |
| 2117 | * ^^^ |
| 2118 | * |
| 2119 | * foo() |
| 2120 | * ^^^^^ |
| 2121 | * |
| 2122 | * +foo |
| 2123 | * ^^^^ |
| 2124 | * |
| 2125 | * foo + bar |
| 2126 | * ^^^^^^^^^ |
| 2127 | * |
| 2128 | * foo.bar |
| 2129 | * ^^^^^^^ |
| 2130 | * |
| 2131 | * foo&.bar |
| 2132 | * ^^^^^^^^ |
| 2133 | * |
| 2134 | * Type: ::PM_CALL_NODE |
| 2135 | |
| 2136 | * Flags (#pm_call_node_flags): |
| 2137 | * * ::PM_CALL_NODE_FLAGS_SAFE_NAVIGATION |
| 2138 | * * ::PM_CALL_NODE_FLAGS_VARIABLE_CALL |
| 2139 | * * ::PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE |
| 2140 | * * ::PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY |
| 2141 | * |
| 2142 | * @extends pm_node_t |
| 2143 | */ |
| 2144 | typedef struct pm_call_node { |
| 2145 | /** The embedded base node. */ |
| 2146 | pm_node_t base; |
| 2147 | |
| 2148 | |
| 2149 | /** |
| 2150 | * CallNode#receiver |
| 2151 | * |
| 2152 | * The object that the method is being called on. This can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 2153 | * |
| 2154 | * foo.bar |
| 2155 | * ^^^ |
| 2156 | * |
| 2157 | * +foo |
| 2158 | * ^^^ |
| 2159 | * |
| 2160 | * foo + bar |
| 2161 | * ^^^ |
| 2162 | */ |
| 2163 | struct pm_node *receiver; |
| 2164 | |
| 2165 | /** |
| 2166 | * CallNode#call_operator_loc |
| 2167 | * |
| 2168 | * Represents the location of the call operator. |
| 2169 | * |
| 2170 | * foo.bar |
| 2171 | * ^ |
| 2172 | * |
| 2173 | * foo&.bar |
| 2174 | * ^^ |
| 2175 | */ |
| 2176 | pm_location_t call_operator_loc; |
| 2177 | |
| 2178 | /** |
| 2179 | * CallNode#name |
| 2180 | * |
| 2181 | * Represents the name of the method being called. |
| 2182 | * |
| 2183 | * foo.bar # name `:foo` |
| 2184 | * ^^^ |
| 2185 | */ |
| 2186 | pm_constant_id_t name; |
| 2187 | |
| 2188 | /** |
| 2189 | * CallNode#message_loc |
| 2190 | * |
| 2191 | * Represents the location of the message. |
| 2192 | * |
| 2193 | * foo.bar |
| 2194 | * ^^^ |
| 2195 | */ |
| 2196 | pm_location_t message_loc; |
| 2197 | |
| 2198 | /** |
| 2199 | * CallNode#opening_loc |
| 2200 | * |
| 2201 | * Represents the location of the left parenthesis. |
| 2202 | * foo(bar) |
| 2203 | * ^ |
| 2204 | */ |
| 2205 | pm_location_t opening_loc; |
| 2206 | |
| 2207 | /** |
| 2208 | * CallNode#arguments |
| 2209 | * |
| 2210 | * Represents the arguments to the method call. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 2211 | * |
| 2212 | * foo(bar) |
| 2213 | * ^^^ |
| 2214 | */ |
| 2215 | struct pm_arguments_node *arguments; |
| 2216 | |
| 2217 | /** |
| 2218 | * CallNode#closing_loc |
| 2219 | * |
| 2220 | * Represents the location of the right parenthesis. |
| 2221 | * |
| 2222 | * foo(bar) |
| 2223 | * ^ |
| 2224 | */ |
| 2225 | pm_location_t closing_loc; |
| 2226 | |
| 2227 | /** |
| 2228 | * CallNode#equal_loc |
| 2229 | * |
| 2230 | * Represents the location of the equal sign, in the case that this is an attribute write. |
| 2231 | * |
| 2232 | * foo.bar = value |
| 2233 | * ^ |
| 2234 | * |
| 2235 | * foo[bar] = value |
| 2236 | * ^ |
| 2237 | */ |
| 2238 | pm_location_t equal_loc; |
| 2239 | |
| 2240 | /** |
| 2241 | * CallNode#block |
| 2242 | * |
| 2243 | * Represents the block that is being passed to the method. |
| 2244 | * |
| 2245 | * foo { |a| a } |
| 2246 | * ^^^^^^^^^ |
| 2247 | */ |
| 2248 | struct pm_node *block; |
| 2249 | } pm_call_node_t; |
| 2250 | |
| 2251 | /** |
| 2252 | * CallOperatorWriteNode |
| 2253 | * |
| 2254 | * Represents the use of an assignment operator on a call. |
| 2255 | * |
| 2256 | * foo.bar += baz |
| 2257 | * ^^^^^^^^^^^^^^ |
| 2258 | * |
| 2259 | * Type: ::PM_CALL_OPERATOR_WRITE_NODE |
| 2260 | |
| 2261 | * Flags (#pm_call_node_flags): |
| 2262 | * * ::PM_CALL_NODE_FLAGS_SAFE_NAVIGATION |
| 2263 | * * ::PM_CALL_NODE_FLAGS_VARIABLE_CALL |
| 2264 | * * ::PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE |
| 2265 | * * ::PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY |
| 2266 | * |
| 2267 | * @extends pm_node_t |
| 2268 | */ |
| 2269 | typedef struct pm_call_operator_write_node { |
| 2270 | /** The embedded base node. */ |
| 2271 | pm_node_t base; |
| 2272 | |
| 2273 | |
| 2274 | /** |
| 2275 | * CallOperatorWriteNode#receiver |
| 2276 | * |
| 2277 | * The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 2278 | * |
| 2279 | * foo.bar += value |
| 2280 | * ^^^ |
| 2281 | */ |
| 2282 | struct pm_node *receiver; |
| 2283 | |
| 2284 | /** |
| 2285 | * CallOperatorWriteNode#call_operator_loc |
| 2286 | * |
| 2287 | * Represents the location of the call operator. |
| 2288 | * |
| 2289 | * foo.bar += value |
| 2290 | * ^ |
| 2291 | */ |
| 2292 | pm_location_t call_operator_loc; |
| 2293 | |
| 2294 | /** |
| 2295 | * CallOperatorWriteNode#message_loc |
| 2296 | * |
| 2297 | * Represents the location of the message. |
| 2298 | * |
| 2299 | * foo.bar += value |
| 2300 | * ^^^ |
| 2301 | */ |
| 2302 | pm_location_t message_loc; |
| 2303 | |
| 2304 | /** |
| 2305 | * CallOperatorWriteNode#read_name |
| 2306 | * |
| 2307 | * Represents the name of the method being called. |
| 2308 | * |
| 2309 | * foo.bar += value # read_name `:bar` |
| 2310 | * ^^^ |
| 2311 | */ |
| 2312 | pm_constant_id_t read_name; |
| 2313 | |
| 2314 | /** |
| 2315 | * CallOperatorWriteNode#write_name |
| 2316 | * |
| 2317 | * Represents the name of the method being written to. |
| 2318 | * |
| 2319 | * foo.bar += value # write_name `:bar=` |
| 2320 | * ^^^ |
| 2321 | */ |
| 2322 | pm_constant_id_t write_name; |
| 2323 | |
| 2324 | /** |
| 2325 | * CallOperatorWriteNode#binary_operator |
| 2326 | * |
| 2327 | * Represents the binary operator being used. |
| 2328 | * |
| 2329 | * foo.bar += value # binary_operator `:+` |
| 2330 | * ^ |
| 2331 | */ |
| 2332 | pm_constant_id_t binary_operator; |
| 2333 | |
| 2334 | /** |
| 2335 | * CallOperatorWriteNode#binary_operator_loc |
| 2336 | * |
| 2337 | * Represents the location of the binary operator. |
| 2338 | * |
| 2339 | * foo.bar += value |
| 2340 | * ^^ |
| 2341 | */ |
| 2342 | pm_location_t binary_operator_loc; |
| 2343 | |
| 2344 | /** |
| 2345 | * CallOperatorWriteNode#value |
| 2346 | * |
| 2347 | * Represents the value being assigned. |
| 2348 | * |
| 2349 | * foo.bar += value |
| 2350 | * ^^^^^ |
| 2351 | */ |
| 2352 | struct pm_node *value; |
| 2353 | } pm_call_operator_write_node_t; |
| 2354 | |
| 2355 | /** |
| 2356 | * CallOrWriteNode |
| 2357 | * |
| 2358 | * Represents the use of the `||=` operator on a call. |
| 2359 | * |
| 2360 | * foo.bar ||= value |
| 2361 | * ^^^^^^^^^^^^^^^^^ |
| 2362 | * |
| 2363 | * Type: ::PM_CALL_OR_WRITE_NODE |
| 2364 | |
| 2365 | * Flags (#pm_call_node_flags): |
| 2366 | * * ::PM_CALL_NODE_FLAGS_SAFE_NAVIGATION |
| 2367 | * * ::PM_CALL_NODE_FLAGS_VARIABLE_CALL |
| 2368 | * * ::PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE |
| 2369 | * * ::PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY |
| 2370 | * |
| 2371 | * @extends pm_node_t |
| 2372 | */ |
| 2373 | typedef struct pm_call_or_write_node { |
| 2374 | /** The embedded base node. */ |
| 2375 | pm_node_t base; |
| 2376 | |
| 2377 | |
| 2378 | /** |
| 2379 | * CallOrWriteNode#receiver |
| 2380 | * |
| 2381 | * The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 2382 | * |
| 2383 | * foo.bar ||= value |
| 2384 | * ^^^ |
| 2385 | */ |
| 2386 | struct pm_node *receiver; |
| 2387 | |
| 2388 | /** |
| 2389 | * CallOrWriteNode#call_operator_loc |
| 2390 | * |
| 2391 | * Represents the location of the call operator. |
| 2392 | * |
| 2393 | * foo.bar ||= value |
| 2394 | * ^ |
| 2395 | */ |
| 2396 | pm_location_t call_operator_loc; |
| 2397 | |
| 2398 | /** |
| 2399 | * CallOrWriteNode#message_loc |
| 2400 | * |
| 2401 | * Represents the location of the message. |
| 2402 | * |
| 2403 | * foo.bar ||= value |
| 2404 | * ^^^ |
| 2405 | */ |
| 2406 | pm_location_t message_loc; |
| 2407 | |
| 2408 | /** |
| 2409 | * CallOrWriteNode#read_name |
| 2410 | * |
| 2411 | * Represents the name of the method being called. |
| 2412 | * |
| 2413 | * foo.bar ||= value # read_name `:bar` |
| 2414 | * ^^^ |
| 2415 | */ |
| 2416 | pm_constant_id_t read_name; |
| 2417 | |
| 2418 | /** |
| 2419 | * CallOrWriteNode#write_name |
| 2420 | * |
| 2421 | * Represents the name of the method being written to. |
| 2422 | * |
| 2423 | * foo.bar ||= value # write_name `:bar=` |
| 2424 | * ^^^ |
| 2425 | */ |
| 2426 | pm_constant_id_t write_name; |
| 2427 | |
| 2428 | /** |
| 2429 | * CallOrWriteNode#operator_loc |
| 2430 | * |
| 2431 | * Represents the location of the operator. |
| 2432 | * |
| 2433 | * foo.bar ||= value |
| 2434 | * ^^^ |
| 2435 | */ |
| 2436 | pm_location_t operator_loc; |
| 2437 | |
| 2438 | /** |
| 2439 | * CallOrWriteNode#value |
| 2440 | * |
| 2441 | * Represents the value being assigned. |
| 2442 | * |
| 2443 | * foo.bar ||= value |
| 2444 | * ^^^^^ |
| 2445 | */ |
| 2446 | struct pm_node *value; |
| 2447 | } pm_call_or_write_node_t; |
| 2448 | |
| 2449 | /** |
| 2450 | * CallTargetNode |
| 2451 | * |
| 2452 | * Represents assigning to a method call. |
| 2453 | * |
| 2454 | * foo.bar, = 1 |
| 2455 | * ^^^^^^^ |
| 2456 | * |
| 2457 | * begin |
| 2458 | * rescue => foo.bar |
| 2459 | * ^^^^^^^ |
| 2460 | * end |
| 2461 | * |
| 2462 | * for foo.bar in baz do end |
| 2463 | * ^^^^^^^ |
| 2464 | * |
| 2465 | * Type: ::PM_CALL_TARGET_NODE |
| 2466 | |
| 2467 | * Flags (#pm_call_node_flags): |
| 2468 | * * ::PM_CALL_NODE_FLAGS_SAFE_NAVIGATION |
| 2469 | * * ::PM_CALL_NODE_FLAGS_VARIABLE_CALL |
| 2470 | * * ::PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE |
| 2471 | * * ::PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY |
| 2472 | * |
| 2473 | * @extends pm_node_t |
| 2474 | */ |
| 2475 | typedef struct pm_call_target_node { |
| 2476 | /** The embedded base node. */ |
| 2477 | pm_node_t base; |
| 2478 | |
| 2479 | |
| 2480 | /** |
| 2481 | * CallTargetNode#receiver |
| 2482 | * |
| 2483 | * The object that the method is being called on. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 2484 | * |
| 2485 | * foo.bar = 1 |
| 2486 | * ^^^ |
| 2487 | */ |
| 2488 | struct pm_node *receiver; |
| 2489 | |
| 2490 | /** |
| 2491 | * CallTargetNode#call_operator_loc |
| 2492 | * |
| 2493 | * Represents the location of the call operator. |
| 2494 | * |
| 2495 | * foo.bar = 1 |
| 2496 | * ^ |
| 2497 | */ |
| 2498 | pm_location_t call_operator_loc; |
| 2499 | |
| 2500 | /** |
| 2501 | * CallTargetNode#name |
| 2502 | * |
| 2503 | * Represents the name of the method being called. |
| 2504 | * |
| 2505 | * foo.bar = 1 # name `:foo` |
| 2506 | * ^^^ |
| 2507 | */ |
| 2508 | pm_constant_id_t name; |
| 2509 | |
| 2510 | /** |
| 2511 | * CallTargetNode#message_loc |
| 2512 | * |
| 2513 | * Represents the location of the message. |
| 2514 | * |
| 2515 | * foo.bar = 1 |
| 2516 | * ^^^ |
| 2517 | */ |
| 2518 | pm_location_t message_loc; |
| 2519 | } pm_call_target_node_t; |
| 2520 | |
| 2521 | /** |
| 2522 | * CapturePatternNode |
| 2523 | * |
| 2524 | * Represents assigning to a local variable in pattern matching. |
| 2525 | * |
| 2526 | * foo => [bar => baz] |
| 2527 | * ^^^^^^^^^^^^ |
| 2528 | * |
| 2529 | * Type: ::PM_CAPTURE_PATTERN_NODE |
| 2530 | * |
| 2531 | * @extends pm_node_t |
| 2532 | */ |
| 2533 | typedef struct pm_capture_pattern_node { |
| 2534 | /** The embedded base node. */ |
| 2535 | pm_node_t base; |
| 2536 | |
| 2537 | |
| 2538 | /** |
| 2539 | * CapturePatternNode#value |
| 2540 | * |
| 2541 | * Represents the value to capture. |
| 2542 | * |
| 2543 | * foo => bar |
| 2544 | * ^^^ |
| 2545 | */ |
| 2546 | struct pm_node *value; |
| 2547 | |
| 2548 | /** |
| 2549 | * CapturePatternNode#target |
| 2550 | * |
| 2551 | * Represents the target of the capture. |
| 2552 | * |
| 2553 | * foo => bar |
| 2554 | * ^^^ |
| 2555 | */ |
| 2556 | struct pm_local_variable_target_node *target; |
| 2557 | |
| 2558 | /** |
| 2559 | * CapturePatternNode#operator_loc |
| 2560 | * |
| 2561 | * Represents the location of the `=>` operator. |
| 2562 | * |
| 2563 | * foo => bar |
| 2564 | * ^^ |
| 2565 | */ |
| 2566 | pm_location_t operator_loc; |
| 2567 | } pm_capture_pattern_node_t; |
| 2568 | |
| 2569 | /** |
| 2570 | * CaseMatchNode |
| 2571 | * |
| 2572 | * Represents the use of a case statement for pattern matching. |
| 2573 | * |
| 2574 | * case true |
| 2575 | * in false |
| 2576 | * end |
| 2577 | * ^^^^^^^^^ |
| 2578 | * |
| 2579 | * Type: ::PM_CASE_MATCH_NODE |
| 2580 | * |
| 2581 | * @extends pm_node_t |
| 2582 | */ |
| 2583 | typedef struct pm_case_match_node { |
| 2584 | /** The embedded base node. */ |
| 2585 | pm_node_t base; |
| 2586 | |
| 2587 | |
| 2588 | /** |
| 2589 | * CaseMatchNode#predicate |
| 2590 | * |
| 2591 | * Represents the predicate of the case match. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 2592 | * |
| 2593 | * case true; in false; end |
| 2594 | * ^^^^ |
| 2595 | */ |
| 2596 | struct pm_node *predicate; |
| 2597 | |
| 2598 | /** |
| 2599 | * CaseMatchNode#conditions |
| 2600 | * |
| 2601 | * Represents the conditions of the case match. |
| 2602 | * |
| 2603 | * case true; in false; end |
| 2604 | * ^^^^^^^^ |
| 2605 | */ |
| 2606 | struct pm_node_list conditions; |
| 2607 | |
| 2608 | /** |
| 2609 | * CaseMatchNode#else_clause |
| 2610 | * |
| 2611 | * Represents the else clause of the case match. |
| 2612 | * |
| 2613 | * case true; in false; else; end |
| 2614 | * ^^^^ |
| 2615 | */ |
| 2616 | struct pm_else_node *else_clause; |
| 2617 | |
| 2618 | /** |
| 2619 | * CaseMatchNode#case_keyword_loc |
| 2620 | * |
| 2621 | * Represents the location of the `case` keyword. |
| 2622 | * |
| 2623 | * case true; in false; end |
| 2624 | * ^^^^ |
| 2625 | */ |
| 2626 | pm_location_t case_keyword_loc; |
| 2627 | |
| 2628 | /** |
| 2629 | * CaseMatchNode#end_keyword_loc |
| 2630 | * |
| 2631 | * Represents the location of the `end` keyword. |
| 2632 | * |
| 2633 | * case true; in false; end |
| 2634 | * ^^^ |
| 2635 | */ |
| 2636 | pm_location_t end_keyword_loc; |
| 2637 | } pm_case_match_node_t; |
| 2638 | |
| 2639 | /** |
| 2640 | * CaseNode |
| 2641 | * |
| 2642 | * Represents the use of a case statement. |
| 2643 | * |
| 2644 | * case true |
| 2645 | * when false |
| 2646 | * end |
| 2647 | * ^^^^^^^^^^ |
| 2648 | * |
| 2649 | * Type: ::PM_CASE_NODE |
| 2650 | * |
| 2651 | * @extends pm_node_t |
| 2652 | */ |
| 2653 | typedef struct pm_case_node { |
| 2654 | /** The embedded base node. */ |
| 2655 | pm_node_t base; |
| 2656 | |
| 2657 | |
| 2658 | /** |
| 2659 | * CaseNode#predicate |
| 2660 | * |
| 2661 | * Represents the predicate of the case statement. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 2662 | * |
| 2663 | * case true; when false; end |
| 2664 | * ^^^^ |
| 2665 | */ |
| 2666 | struct pm_node *predicate; |
| 2667 | |
| 2668 | /** |
| 2669 | * CaseNode#conditions |
| 2670 | * |
| 2671 | * Represents the conditions of the case statement. |
| 2672 | * |
| 2673 | * case true; when false; end |
| 2674 | * ^^^^^^^^^^ |
| 2675 | */ |
| 2676 | struct pm_node_list conditions; |
| 2677 | |
| 2678 | /** |
| 2679 | * CaseNode#else_clause |
| 2680 | * |
| 2681 | * Represents the else clause of the case statement. |
| 2682 | * |
| 2683 | * case true; when false; else; end |
| 2684 | * ^^^^ |
| 2685 | */ |
| 2686 | struct pm_else_node *else_clause; |
| 2687 | |
| 2688 | /** |
| 2689 | * CaseNode#case_keyword_loc |
| 2690 | * |
| 2691 | * Represents the location of the `case` keyword. |
| 2692 | * |
| 2693 | * case true; when false; end |
| 2694 | * ^^^^ |
| 2695 | */ |
| 2696 | pm_location_t case_keyword_loc; |
| 2697 | |
| 2698 | /** |
| 2699 | * CaseNode#end_keyword_loc |
| 2700 | * |
| 2701 | * Represents the location of the `end` keyword. |
| 2702 | * |
| 2703 | * case true; when false; end |
| 2704 | * ^^^ |
| 2705 | */ |
| 2706 | pm_location_t end_keyword_loc; |
| 2707 | } pm_case_node_t; |
| 2708 | |
| 2709 | /** |
| 2710 | * ClassNode |
| 2711 | * |
| 2712 | * Represents a class declaration involving the `class` keyword. |
| 2713 | * |
| 2714 | * class Foo end |
| 2715 | * ^^^^^^^^^^^^^ |
| 2716 | * |
| 2717 | * Type: ::PM_CLASS_NODE |
| 2718 | * |
| 2719 | * @extends pm_node_t |
| 2720 | */ |
| 2721 | typedef struct pm_class_node { |
| 2722 | /** The embedded base node. */ |
| 2723 | pm_node_t base; |
| 2724 | |
| 2725 | |
| 2726 | /** |
| 2727 | * ClassNode#locals |
| 2728 | */ |
| 2729 | pm_constant_id_list_t locals; |
| 2730 | |
| 2731 | /** |
| 2732 | * ClassNode#class_keyword_loc |
| 2733 | * |
| 2734 | * Represents the location of the `class` keyword. |
| 2735 | * |
| 2736 | * class Foo end |
| 2737 | * ^^^^^ |
| 2738 | */ |
| 2739 | pm_location_t class_keyword_loc; |
| 2740 | |
| 2741 | /** |
| 2742 | * ClassNode#constant_path |
| 2743 | */ |
| 2744 | struct pm_node *constant_path; |
| 2745 | |
| 2746 | /** |
| 2747 | * ClassNode#inheritance_operator_loc |
| 2748 | * |
| 2749 | * Represents the location of the `<` operator. |
| 2750 | * |
| 2751 | * class Foo < Bar |
| 2752 | * ^ |
| 2753 | */ |
| 2754 | pm_location_t inheritance_operator_loc; |
| 2755 | |
| 2756 | /** |
| 2757 | * ClassNode#superclass |
| 2758 | * |
| 2759 | * Represents the superclass of the class. |
| 2760 | * |
| 2761 | * class Foo < Bar |
| 2762 | * ^^^ |
| 2763 | */ |
| 2764 | struct pm_node *superclass; |
| 2765 | |
| 2766 | /** |
| 2767 | * ClassNode#body |
| 2768 | * |
| 2769 | * Represents the body of the class. |
| 2770 | * |
| 2771 | * class Foo |
| 2772 | * foo |
| 2773 | * ^^^ |
| 2774 | */ |
| 2775 | struct pm_node *body; |
| 2776 | |
| 2777 | /** |
| 2778 | * ClassNode#end_keyword_loc |
| 2779 | * |
| 2780 | * Represents the location of the `end` keyword. |
| 2781 | * |
| 2782 | * class Foo end |
| 2783 | * ^^^ |
| 2784 | */ |
| 2785 | pm_location_t end_keyword_loc; |
| 2786 | |
| 2787 | /** |
| 2788 | * ClassNode#name |
| 2789 | * |
| 2790 | * The name of the class. |
| 2791 | * |
| 2792 | * class Foo end # name `:Foo` |
| 2793 | */ |
| 2794 | pm_constant_id_t name; |
| 2795 | } pm_class_node_t; |
| 2796 | |
| 2797 | /** |
| 2798 | * ClassVariableAndWriteNode |
| 2799 | * |
| 2800 | * Represents the use of the `&&=` operator for assignment to a class variable. |
| 2801 | * |
| 2802 | * @@target &&= value |
| 2803 | * ^^^^^^^^^^^^^^^^^^ |
| 2804 | * |
| 2805 | * Type: ::PM_CLASS_VARIABLE_AND_WRITE_NODE |
| 2806 | * |
| 2807 | * @extends pm_node_t |
| 2808 | */ |
| 2809 | typedef struct pm_class_variable_and_write_node { |
| 2810 | /** The embedded base node. */ |
| 2811 | pm_node_t base; |
| 2812 | |
| 2813 | |
| 2814 | /** |
| 2815 | * ClassVariableAndWriteNode#name |
| 2816 | * |
| 2817 | * The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). |
| 2818 | * |
| 2819 | * @@target &&= value # name `:@@target` |
| 2820 | * ^^^^^^^^ |
| 2821 | */ |
| 2822 | pm_constant_id_t name; |
| 2823 | |
| 2824 | /** |
| 2825 | * ClassVariableAndWriteNode#name_loc |
| 2826 | * |
| 2827 | * Represents the location of the variable name. |
| 2828 | * |
| 2829 | * @@target &&= value |
| 2830 | * ^^^^^^^^ |
| 2831 | */ |
| 2832 | pm_location_t name_loc; |
| 2833 | |
| 2834 | /** |
| 2835 | * ClassVariableAndWriteNode#operator_loc |
| 2836 | * |
| 2837 | * Represents the location of the `&&=` operator. |
| 2838 | * |
| 2839 | * @@target &&= value |
| 2840 | * ^^^ |
| 2841 | */ |
| 2842 | pm_location_t operator_loc; |
| 2843 | |
| 2844 | /** |
| 2845 | * ClassVariableAndWriteNode#value |
| 2846 | * |
| 2847 | * Represents the value being assigned. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 2848 | * |
| 2849 | * @@target &&= value |
| 2850 | * ^^^^^ |
| 2851 | */ |
| 2852 | struct pm_node *value; |
| 2853 | } pm_class_variable_and_write_node_t; |
| 2854 | |
| 2855 | /** |
| 2856 | * ClassVariableOperatorWriteNode |
| 2857 | * |
| 2858 | * Represents assigning to a class variable using an operator that isn't `=`. |
| 2859 | * |
| 2860 | * @@target += value |
| 2861 | * ^^^^^^^^^^^^^^^^^ |
| 2862 | * |
| 2863 | * Type: ::PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE |
| 2864 | * |
| 2865 | * @extends pm_node_t |
| 2866 | */ |
| 2867 | typedef struct pm_class_variable_operator_write_node { |
| 2868 | /** The embedded base node. */ |
| 2869 | pm_node_t base; |
| 2870 | |
| 2871 | |
| 2872 | /** |
| 2873 | * ClassVariableOperatorWriteNode#name |
| 2874 | */ |
| 2875 | pm_constant_id_t name; |
| 2876 | |
| 2877 | /** |
| 2878 | * ClassVariableOperatorWriteNode#name_loc |
| 2879 | */ |
| 2880 | pm_location_t name_loc; |
| 2881 | |
| 2882 | /** |
| 2883 | * ClassVariableOperatorWriteNode#binary_operator_loc |
| 2884 | */ |
| 2885 | pm_location_t binary_operator_loc; |
| 2886 | |
| 2887 | /** |
| 2888 | * ClassVariableOperatorWriteNode#value |
| 2889 | */ |
| 2890 | struct pm_node *value; |
| 2891 | |
| 2892 | /** |
| 2893 | * ClassVariableOperatorWriteNode#binary_operator |
| 2894 | */ |
| 2895 | pm_constant_id_t binary_operator; |
| 2896 | } pm_class_variable_operator_write_node_t; |
| 2897 | |
| 2898 | /** |
| 2899 | * ClassVariableOrWriteNode |
| 2900 | * |
| 2901 | * Represents the use of the `||=` operator for assignment to a class variable. |
| 2902 | * |
| 2903 | * @@target ||= value |
| 2904 | * ^^^^^^^^^^^^^^^^^^ |
| 2905 | * |
| 2906 | * Type: ::PM_CLASS_VARIABLE_OR_WRITE_NODE |
| 2907 | * |
| 2908 | * @extends pm_node_t |
| 2909 | */ |
| 2910 | typedef struct pm_class_variable_or_write_node { |
| 2911 | /** The embedded base node. */ |
| 2912 | pm_node_t base; |
| 2913 | |
| 2914 | |
| 2915 | /** |
| 2916 | * ClassVariableOrWriteNode#name |
| 2917 | */ |
| 2918 | pm_constant_id_t name; |
| 2919 | |
| 2920 | /** |
| 2921 | * ClassVariableOrWriteNode#name_loc |
| 2922 | */ |
| 2923 | pm_location_t name_loc; |
| 2924 | |
| 2925 | /** |
| 2926 | * ClassVariableOrWriteNode#operator_loc |
| 2927 | */ |
| 2928 | pm_location_t operator_loc; |
| 2929 | |
| 2930 | /** |
| 2931 | * ClassVariableOrWriteNode#value |
| 2932 | */ |
| 2933 | struct pm_node *value; |
| 2934 | } pm_class_variable_or_write_node_t; |
| 2935 | |
| 2936 | /** |
| 2937 | * ClassVariableReadNode |
| 2938 | * |
| 2939 | * Represents referencing a class variable. |
| 2940 | * |
| 2941 | * @@foo |
| 2942 | * ^^^^^ |
| 2943 | * |
| 2944 | * Type: ::PM_CLASS_VARIABLE_READ_NODE |
| 2945 | * |
| 2946 | * @extends pm_node_t |
| 2947 | */ |
| 2948 | typedef struct pm_class_variable_read_node { |
| 2949 | /** The embedded base node. */ |
| 2950 | pm_node_t base; |
| 2951 | |
| 2952 | |
| 2953 | /** |
| 2954 | * ClassVariableReadNode#name |
| 2955 | * |
| 2956 | * The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). |
| 2957 | * |
| 2958 | * @@abc # name `:@@abc` |
| 2959 | * |
| 2960 | * @@_test # name `:@@_test` |
| 2961 | */ |
| 2962 | pm_constant_id_t name; |
| 2963 | } pm_class_variable_read_node_t; |
| 2964 | |
| 2965 | /** |
| 2966 | * ClassVariableTargetNode |
| 2967 | * |
| 2968 | * Represents writing to a class variable in a context that doesn't have an explicit value. |
| 2969 | * |
| 2970 | * @@foo, @@bar = baz |
| 2971 | * ^^^^^ ^^^^^ |
| 2972 | * |
| 2973 | * Type: ::PM_CLASS_VARIABLE_TARGET_NODE |
| 2974 | * |
| 2975 | * @extends pm_node_t |
| 2976 | */ |
| 2977 | typedef struct pm_class_variable_target_node { |
| 2978 | /** The embedded base node. */ |
| 2979 | pm_node_t base; |
| 2980 | |
| 2981 | |
| 2982 | /** |
| 2983 | * ClassVariableTargetNode#name |
| 2984 | */ |
| 2985 | pm_constant_id_t name; |
| 2986 | } pm_class_variable_target_node_t; |
| 2987 | |
| 2988 | /** |
| 2989 | * ClassVariableWriteNode |
| 2990 | * |
| 2991 | * Represents writing to a class variable. |
| 2992 | * |
| 2993 | * @@foo = 1 |
| 2994 | * ^^^^^^^^^ |
| 2995 | * |
| 2996 | * Type: ::PM_CLASS_VARIABLE_WRITE_NODE |
| 2997 | * |
| 2998 | * @extends pm_node_t |
| 2999 | */ |
| 3000 | typedef struct pm_class_variable_write_node { |
| 3001 | /** The embedded base node. */ |
| 3002 | pm_node_t base; |
| 3003 | |
| 3004 | |
| 3005 | /** |
| 3006 | * ClassVariableWriteNode#name |
| 3007 | * |
| 3008 | * The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). |
| 3009 | * |
| 3010 | * @@abc = 123 # name `@@abc` |
| 3011 | * |
| 3012 | * @@_test = :test # name `@@_test` |
| 3013 | */ |
| 3014 | pm_constant_id_t name; |
| 3015 | |
| 3016 | /** |
| 3017 | * ClassVariableWriteNode#name_loc |
| 3018 | * |
| 3019 | * The location of the variable name. |
| 3020 | * |
| 3021 | * @@foo = :bar |
| 3022 | * ^^^^^ |
| 3023 | */ |
| 3024 | pm_location_t name_loc; |
| 3025 | |
| 3026 | /** |
| 3027 | * ClassVariableWriteNode#value |
| 3028 | * |
| 3029 | * The value to write to the class variable. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 3030 | * |
| 3031 | * @@foo = :bar |
| 3032 | * ^^^^ |
| 3033 | * |
| 3034 | * @@_xyz = 123 |
| 3035 | * ^^^ |
| 3036 | */ |
| 3037 | struct pm_node *value; |
| 3038 | |
| 3039 | /** |
| 3040 | * ClassVariableWriteNode#operator_loc |
| 3041 | * |
| 3042 | * The location of the `=` operator. |
| 3043 | * |
| 3044 | * @@foo = :bar |
| 3045 | * ^ |
| 3046 | */ |
| 3047 | pm_location_t operator_loc; |
| 3048 | } pm_class_variable_write_node_t; |
| 3049 | |
| 3050 | /** |
| 3051 | * ConstantAndWriteNode |
| 3052 | * |
| 3053 | * Represents the use of the `&&=` operator for assignment to a constant. |
| 3054 | * |
| 3055 | * Target &&= value |
| 3056 | * ^^^^^^^^^^^^^^^^ |
| 3057 | * |
| 3058 | * Type: ::PM_CONSTANT_AND_WRITE_NODE |
| 3059 | * |
| 3060 | * @extends pm_node_t |
| 3061 | */ |
| 3062 | typedef struct pm_constant_and_write_node { |
| 3063 | /** The embedded base node. */ |
| 3064 | pm_node_t base; |
| 3065 | |
| 3066 | |
| 3067 | /** |
| 3068 | * ConstantAndWriteNode#name |
| 3069 | */ |
| 3070 | pm_constant_id_t name; |
| 3071 | |
| 3072 | /** |
| 3073 | * ConstantAndWriteNode#name_loc |
| 3074 | */ |
| 3075 | pm_location_t name_loc; |
| 3076 | |
| 3077 | /** |
| 3078 | * ConstantAndWriteNode#operator_loc |
| 3079 | */ |
| 3080 | pm_location_t operator_loc; |
| 3081 | |
| 3082 | /** |
| 3083 | * ConstantAndWriteNode#value |
| 3084 | */ |
| 3085 | struct pm_node *value; |
| 3086 | } pm_constant_and_write_node_t; |
| 3087 | |
| 3088 | /** |
| 3089 | * ConstantOperatorWriteNode |
| 3090 | * |
| 3091 | * Represents assigning to a constant using an operator that isn't `=`. |
| 3092 | * |
| 3093 | * Target += value |
| 3094 | * ^^^^^^^^^^^^^^^ |
| 3095 | * |
| 3096 | * Type: ::PM_CONSTANT_OPERATOR_WRITE_NODE |
| 3097 | * |
| 3098 | * @extends pm_node_t |
| 3099 | */ |
| 3100 | typedef struct pm_constant_operator_write_node { |
| 3101 | /** The embedded base node. */ |
| 3102 | pm_node_t base; |
| 3103 | |
| 3104 | |
| 3105 | /** |
| 3106 | * ConstantOperatorWriteNode#name |
| 3107 | */ |
| 3108 | pm_constant_id_t name; |
| 3109 | |
| 3110 | /** |
| 3111 | * ConstantOperatorWriteNode#name_loc |
| 3112 | */ |
| 3113 | pm_location_t name_loc; |
| 3114 | |
| 3115 | /** |
| 3116 | * ConstantOperatorWriteNode#binary_operator_loc |
| 3117 | */ |
| 3118 | pm_location_t binary_operator_loc; |
| 3119 | |
| 3120 | /** |
| 3121 | * ConstantOperatorWriteNode#value |
| 3122 | */ |
| 3123 | struct pm_node *value; |
| 3124 | |
| 3125 | /** |
| 3126 | * ConstantOperatorWriteNode#binary_operator |
| 3127 | */ |
| 3128 | pm_constant_id_t binary_operator; |
| 3129 | } pm_constant_operator_write_node_t; |
| 3130 | |
| 3131 | /** |
| 3132 | * ConstantOrWriteNode |
| 3133 | * |
| 3134 | * Represents the use of the `||=` operator for assignment to a constant. |
| 3135 | * |
| 3136 | * Target ||= value |
| 3137 | * ^^^^^^^^^^^^^^^^ |
| 3138 | * |
| 3139 | * Type: ::PM_CONSTANT_OR_WRITE_NODE |
| 3140 | * |
| 3141 | * @extends pm_node_t |
| 3142 | */ |
| 3143 | typedef struct pm_constant_or_write_node { |
| 3144 | /** The embedded base node. */ |
| 3145 | pm_node_t base; |
| 3146 | |
| 3147 | |
| 3148 | /** |
| 3149 | * ConstantOrWriteNode#name |
| 3150 | */ |
| 3151 | pm_constant_id_t name; |
| 3152 | |
| 3153 | /** |
| 3154 | * ConstantOrWriteNode#name_loc |
| 3155 | */ |
| 3156 | pm_location_t name_loc; |
| 3157 | |
| 3158 | /** |
| 3159 | * ConstantOrWriteNode#operator_loc |
| 3160 | */ |
| 3161 | pm_location_t operator_loc; |
| 3162 | |
| 3163 | /** |
| 3164 | * ConstantOrWriteNode#value |
| 3165 | */ |
| 3166 | struct pm_node *value; |
| 3167 | } pm_constant_or_write_node_t; |
| 3168 | |
| 3169 | /** |
| 3170 | * ConstantPathAndWriteNode |
| 3171 | * |
| 3172 | * Represents the use of the `&&=` operator for assignment to a constant path. |
| 3173 | * |
| 3174 | * Parent::Child &&= value |
| 3175 | * ^^^^^^^^^^^^^^^^^^^^^^^ |
| 3176 | * |
| 3177 | * Type: ::PM_CONSTANT_PATH_AND_WRITE_NODE |
| 3178 | * |
| 3179 | * @extends pm_node_t |
| 3180 | */ |
| 3181 | typedef struct pm_constant_path_and_write_node { |
| 3182 | /** The embedded base node. */ |
| 3183 | pm_node_t base; |
| 3184 | |
| 3185 | |
| 3186 | /** |
| 3187 | * ConstantPathAndWriteNode#target |
| 3188 | */ |
| 3189 | struct pm_constant_path_node *target; |
| 3190 | |
| 3191 | /** |
| 3192 | * ConstantPathAndWriteNode#operator_loc |
| 3193 | */ |
| 3194 | pm_location_t operator_loc; |
| 3195 | |
| 3196 | /** |
| 3197 | * ConstantPathAndWriteNode#value |
| 3198 | */ |
| 3199 | struct pm_node *value; |
| 3200 | } pm_constant_path_and_write_node_t; |
| 3201 | |
| 3202 | /** |
| 3203 | * ConstantPathNode |
| 3204 | * |
| 3205 | * Represents accessing a constant through a path of `::` operators. |
| 3206 | * |
| 3207 | * Foo::Bar |
| 3208 | * ^^^^^^^^ |
| 3209 | * |
| 3210 | * Type: ::PM_CONSTANT_PATH_NODE |
| 3211 | * |
| 3212 | * @extends pm_node_t |
| 3213 | */ |
| 3214 | typedef struct pm_constant_path_node { |
| 3215 | /** The embedded base node. */ |
| 3216 | pm_node_t base; |
| 3217 | |
| 3218 | |
| 3219 | /** |
| 3220 | * ConstantPathNode#parent |
| 3221 | * |
| 3222 | * The left-hand node of the path, if present. It can be `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). It will be `nil` when the constant lookup is at the root of the module tree. |
| 3223 | * |
| 3224 | * Foo::Bar |
| 3225 | * ^^^ |
| 3226 | * |
| 3227 | * self::Test |
| 3228 | * ^^^^ |
| 3229 | * |
| 3230 | * a.b::C |
| 3231 | * ^^^ |
| 3232 | */ |
| 3233 | struct pm_node *parent; |
| 3234 | |
| 3235 | /** |
| 3236 | * ConstantPathNode#name |
| 3237 | * |
| 3238 | * The name of the constant being accessed. This could be `nil` in the event of a syntax error. |
| 3239 | */ |
| 3240 | pm_constant_id_t name; |
| 3241 | |
| 3242 | /** |
| 3243 | * ConstantPathNode#delimiter_loc |
| 3244 | * |
| 3245 | * The location of the `::` delimiter. |
| 3246 | * |
| 3247 | * ::Foo |
| 3248 | * ^^ |
| 3249 | * |
| 3250 | * One::Two |
| 3251 | * ^^ |
| 3252 | */ |
| 3253 | pm_location_t delimiter_loc; |
| 3254 | |
| 3255 | /** |
| 3256 | * ConstantPathNode#name_loc |
| 3257 | * |
| 3258 | * The location of the name of the constant. |
| 3259 | * |
| 3260 | * ::Foo |
| 3261 | * ^^^ |
| 3262 | * |
| 3263 | * One::Two |
| 3264 | * ^^^ |
| 3265 | */ |
| 3266 | pm_location_t name_loc; |
| 3267 | } pm_constant_path_node_t; |
| 3268 | |
| 3269 | /** |
| 3270 | * ConstantPathOperatorWriteNode |
| 3271 | * |
| 3272 | * Represents assigning to a constant path using an operator that isn't `=`. |
| 3273 | * |
| 3274 | * Parent::Child += value |
| 3275 | * ^^^^^^^^^^^^^^^^^^^^^^ |
| 3276 | * |
| 3277 | * Type: ::PM_CONSTANT_PATH_OPERATOR_WRITE_NODE |
| 3278 | * |
| 3279 | * @extends pm_node_t |
| 3280 | */ |
| 3281 | typedef struct pm_constant_path_operator_write_node { |
| 3282 | /** The embedded base node. */ |
| 3283 | pm_node_t base; |
| 3284 | |
| 3285 | |
| 3286 | /** |
| 3287 | * ConstantPathOperatorWriteNode#target |
| 3288 | */ |
| 3289 | struct pm_constant_path_node *target; |
| 3290 | |
| 3291 | /** |
| 3292 | * ConstantPathOperatorWriteNode#binary_operator_loc |
| 3293 | */ |
| 3294 | pm_location_t binary_operator_loc; |
| 3295 | |
| 3296 | /** |
| 3297 | * ConstantPathOperatorWriteNode#value |
| 3298 | */ |
| 3299 | struct pm_node *value; |
| 3300 | |
| 3301 | /** |
| 3302 | * ConstantPathOperatorWriteNode#binary_operator |
| 3303 | */ |
| 3304 | pm_constant_id_t binary_operator; |
| 3305 | } pm_constant_path_operator_write_node_t; |
| 3306 | |
| 3307 | /** |
| 3308 | * ConstantPathOrWriteNode |
| 3309 | * |
| 3310 | * Represents the use of the `||=` operator for assignment to a constant path. |
| 3311 | * |
| 3312 | * Parent::Child ||= value |
| 3313 | * ^^^^^^^^^^^^^^^^^^^^^^^ |
| 3314 | * |
| 3315 | * Type: ::PM_CONSTANT_PATH_OR_WRITE_NODE |
| 3316 | * |
| 3317 | * @extends pm_node_t |
| 3318 | */ |
| 3319 | typedef struct pm_constant_path_or_write_node { |
| 3320 | /** The embedded base node. */ |
| 3321 | pm_node_t base; |
| 3322 | |
| 3323 | |
| 3324 | /** |
| 3325 | * ConstantPathOrWriteNode#target |
| 3326 | */ |
| 3327 | struct pm_constant_path_node *target; |
| 3328 | |
| 3329 | /** |
| 3330 | * ConstantPathOrWriteNode#operator_loc |
| 3331 | */ |
| 3332 | pm_location_t operator_loc; |
| 3333 | |
| 3334 | /** |
| 3335 | * ConstantPathOrWriteNode#value |
| 3336 | */ |
| 3337 | struct pm_node *value; |
| 3338 | } pm_constant_path_or_write_node_t; |
| 3339 | |
| 3340 | /** |
| 3341 | * ConstantPathTargetNode |
| 3342 | * |
| 3343 | * Represents writing to a constant path in a context that doesn't have an explicit value. |
| 3344 | * |
| 3345 | * Foo::Foo, Bar::Bar = baz |
| 3346 | * ^^^^^^^^ ^^^^^^^^ |
| 3347 | * |
| 3348 | * Type: ::PM_CONSTANT_PATH_TARGET_NODE |
| 3349 | * |
| 3350 | * @extends pm_node_t |
| 3351 | */ |
| 3352 | typedef struct pm_constant_path_target_node { |
| 3353 | /** The embedded base node. */ |
| 3354 | pm_node_t base; |
| 3355 | |
| 3356 | |
| 3357 | /** |
| 3358 | * ConstantPathTargetNode#parent |
| 3359 | */ |
| 3360 | struct pm_node *parent; |
| 3361 | |
| 3362 | /** |
| 3363 | * ConstantPathTargetNode#name |
| 3364 | */ |
| 3365 | pm_constant_id_t name; |
| 3366 | |
| 3367 | /** |
| 3368 | * ConstantPathTargetNode#delimiter_loc |
| 3369 | */ |
| 3370 | pm_location_t delimiter_loc; |
| 3371 | |
| 3372 | /** |
| 3373 | * ConstantPathTargetNode#name_loc |
| 3374 | */ |
| 3375 | pm_location_t name_loc; |
| 3376 | } pm_constant_path_target_node_t; |
| 3377 | |
| 3378 | /** |
| 3379 | * ConstantPathWriteNode |
| 3380 | * |
| 3381 | * Represents writing to a constant path. |
| 3382 | * |
| 3383 | * ::Foo = 1 |
| 3384 | * ^^^^^^^^^ |
| 3385 | * |
| 3386 | * Foo::Bar = 1 |
| 3387 | * ^^^^^^^^^^^^ |
| 3388 | * |
| 3389 | * ::Foo::Bar = 1 |
| 3390 | * ^^^^^^^^^^^^^^ |
| 3391 | * |
| 3392 | * Type: ::PM_CONSTANT_PATH_WRITE_NODE |
| 3393 | * |
| 3394 | * @extends pm_node_t |
| 3395 | */ |
| 3396 | typedef struct pm_constant_path_write_node { |
| 3397 | /** The embedded base node. */ |
| 3398 | pm_node_t base; |
| 3399 | |
| 3400 | |
| 3401 | /** |
| 3402 | * ConstantPathWriteNode#target |
| 3403 | * |
| 3404 | * A node representing the constant path being written to. |
| 3405 | * |
| 3406 | * Foo::Bar = 1 |
| 3407 | * ^^^^^^^^ |
| 3408 | * |
| 3409 | * ::Foo = :abc |
| 3410 | * ^^^^^ |
| 3411 | */ |
| 3412 | struct pm_constant_path_node *target; |
| 3413 | |
| 3414 | /** |
| 3415 | * ConstantPathWriteNode#operator_loc |
| 3416 | * |
| 3417 | * The location of the `=` operator. |
| 3418 | * |
| 3419 | * ::ABC = 123 |
| 3420 | * ^ |
| 3421 | */ |
| 3422 | pm_location_t operator_loc; |
| 3423 | |
| 3424 | /** |
| 3425 | * ConstantPathWriteNode#value |
| 3426 | * |
| 3427 | * The value to write to the constant path. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 3428 | * |
| 3429 | * FOO::BAR = :abc |
| 3430 | * ^^^^ |
| 3431 | */ |
| 3432 | struct pm_node *value; |
| 3433 | } pm_constant_path_write_node_t; |
| 3434 | |
| 3435 | /** |
| 3436 | * ConstantReadNode |
| 3437 | * |
| 3438 | * Represents referencing a constant. |
| 3439 | * |
| 3440 | * Foo |
| 3441 | * ^^^ |
| 3442 | * |
| 3443 | * Type: ::PM_CONSTANT_READ_NODE |
| 3444 | * |
| 3445 | * @extends pm_node_t |
| 3446 | */ |
| 3447 | typedef struct pm_constant_read_node { |
| 3448 | /** The embedded base node. */ |
| 3449 | pm_node_t base; |
| 3450 | |
| 3451 | |
| 3452 | /** |
| 3453 | * ConstantReadNode#name |
| 3454 | * |
| 3455 | * The name of the [constant](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#constants). |
| 3456 | * |
| 3457 | * X # name `:X` |
| 3458 | * |
| 3459 | * SOME_CONSTANT # name `:SOME_CONSTANT` |
| 3460 | */ |
| 3461 | pm_constant_id_t name; |
| 3462 | } pm_constant_read_node_t; |
| 3463 | |
| 3464 | /** |
| 3465 | * ConstantTargetNode |
| 3466 | * |
| 3467 | * Represents writing to a constant in a context that doesn't have an explicit value. |
| 3468 | * |
| 3469 | * Foo, Bar = baz |
| 3470 | * ^^^ ^^^ |
| 3471 | * |
| 3472 | * Type: ::PM_CONSTANT_TARGET_NODE |
| 3473 | * |
| 3474 | * @extends pm_node_t |
| 3475 | */ |
| 3476 | typedef struct pm_constant_target_node { |
| 3477 | /** The embedded base node. */ |
| 3478 | pm_node_t base; |
| 3479 | |
| 3480 | |
| 3481 | /** |
| 3482 | * ConstantTargetNode#name |
| 3483 | */ |
| 3484 | pm_constant_id_t name; |
| 3485 | } pm_constant_target_node_t; |
| 3486 | |
| 3487 | /** |
| 3488 | * ConstantWriteNode |
| 3489 | * |
| 3490 | * Represents writing to a constant. |
| 3491 | * |
| 3492 | * Foo = 1 |
| 3493 | * ^^^^^^^ |
| 3494 | * |
| 3495 | * Type: ::PM_CONSTANT_WRITE_NODE |
| 3496 | * |
| 3497 | * @extends pm_node_t |
| 3498 | */ |
| 3499 | typedef struct pm_constant_write_node { |
| 3500 | /** The embedded base node. */ |
| 3501 | pm_node_t base; |
| 3502 | |
| 3503 | |
| 3504 | /** |
| 3505 | * ConstantWriteNode#name |
| 3506 | * |
| 3507 | * The name of the [constant](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#constants). |
| 3508 | * |
| 3509 | * Foo = :bar # name `:Foo` |
| 3510 | * |
| 3511 | * XYZ = 1 # name `:XYZ` |
| 3512 | */ |
| 3513 | pm_constant_id_t name; |
| 3514 | |
| 3515 | /** |
| 3516 | * ConstantWriteNode#name_loc |
| 3517 | * |
| 3518 | * The location of the constant name. |
| 3519 | * |
| 3520 | * FOO = 1 |
| 3521 | * ^^^ |
| 3522 | */ |
| 3523 | pm_location_t name_loc; |
| 3524 | |
| 3525 | /** |
| 3526 | * ConstantWriteNode#value |
| 3527 | * |
| 3528 | * The value to write to the constant. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 3529 | * |
| 3530 | * FOO = :bar |
| 3531 | * ^^^^ |
| 3532 | * |
| 3533 | * MyClass = Class.new |
| 3534 | * ^^^^^^^^^ |
| 3535 | */ |
| 3536 | struct pm_node *value; |
| 3537 | |
| 3538 | /** |
| 3539 | * ConstantWriteNode#operator_loc |
| 3540 | * |
| 3541 | * The location of the `=` operator. |
| 3542 | * |
| 3543 | * FOO = :bar |
| 3544 | * ^ |
| 3545 | */ |
| 3546 | pm_location_t operator_loc; |
| 3547 | } pm_constant_write_node_t; |
| 3548 | |
| 3549 | /** |
| 3550 | * DefNode |
| 3551 | * |
| 3552 | * Represents a method definition. |
| 3553 | * |
| 3554 | * def method |
| 3555 | * end |
| 3556 | * ^^^^^^^^^^ |
| 3557 | * |
| 3558 | * Type: ::PM_DEF_NODE |
| 3559 | * |
| 3560 | * @extends pm_node_t |
| 3561 | */ |
| 3562 | typedef struct pm_def_node { |
| 3563 | /** The embedded base node. */ |
| 3564 | pm_node_t base; |
| 3565 | |
| 3566 | |
| 3567 | /** |
| 3568 | * DefNode#name |
| 3569 | */ |
| 3570 | pm_constant_id_t name; |
| 3571 | |
| 3572 | /** |
| 3573 | * DefNode#name_loc |
| 3574 | */ |
| 3575 | pm_location_t name_loc; |
| 3576 | |
| 3577 | /** |
| 3578 | * DefNode#receiver |
| 3579 | */ |
| 3580 | struct pm_node *receiver; |
| 3581 | |
| 3582 | /** |
| 3583 | * DefNode#parameters |
| 3584 | */ |
| 3585 | struct pm_parameters_node *parameters; |
| 3586 | |
| 3587 | /** |
| 3588 | * DefNode#body |
| 3589 | */ |
| 3590 | struct pm_node *body; |
| 3591 | |
| 3592 | /** |
| 3593 | * DefNode#locals |
| 3594 | */ |
| 3595 | pm_constant_id_list_t locals; |
| 3596 | |
| 3597 | /** |
| 3598 | * DefNode#def_keyword_loc |
| 3599 | */ |
| 3600 | pm_location_t def_keyword_loc; |
| 3601 | |
| 3602 | /** |
| 3603 | * DefNode#operator_loc |
| 3604 | */ |
| 3605 | pm_location_t operator_loc; |
| 3606 | |
| 3607 | /** |
| 3608 | * DefNode#lparen_loc |
| 3609 | */ |
| 3610 | pm_location_t lparen_loc; |
| 3611 | |
| 3612 | /** |
| 3613 | * DefNode#rparen_loc |
| 3614 | */ |
| 3615 | pm_location_t rparen_loc; |
| 3616 | |
| 3617 | /** |
| 3618 | * DefNode#equal_loc |
| 3619 | */ |
| 3620 | pm_location_t equal_loc; |
| 3621 | |
| 3622 | /** |
| 3623 | * DefNode#end_keyword_loc |
| 3624 | */ |
| 3625 | pm_location_t end_keyword_loc; |
| 3626 | } pm_def_node_t; |
| 3627 | |
| 3628 | /** |
| 3629 | * DefinedNode |
| 3630 | * |
| 3631 | * Represents the use of the `defined?` keyword. |
| 3632 | * |
| 3633 | * defined?(a) |
| 3634 | * ^^^^^^^^^^^ |
| 3635 | * |
| 3636 | * Type: ::PM_DEFINED_NODE |
| 3637 | * |
| 3638 | * @extends pm_node_t |
| 3639 | */ |
| 3640 | typedef struct pm_defined_node { |
| 3641 | /** The embedded base node. */ |
| 3642 | pm_node_t base; |
| 3643 | |
| 3644 | |
| 3645 | /** |
| 3646 | * DefinedNode#lparen_loc |
| 3647 | */ |
| 3648 | pm_location_t lparen_loc; |
| 3649 | |
| 3650 | /** |
| 3651 | * DefinedNode#value |
| 3652 | */ |
| 3653 | struct pm_node *value; |
| 3654 | |
| 3655 | /** |
| 3656 | * DefinedNode#rparen_loc |
| 3657 | */ |
| 3658 | pm_location_t rparen_loc; |
| 3659 | |
| 3660 | /** |
| 3661 | * DefinedNode#keyword_loc |
| 3662 | */ |
| 3663 | pm_location_t keyword_loc; |
| 3664 | } pm_defined_node_t; |
| 3665 | |
| 3666 | /** |
| 3667 | * ElseNode |
| 3668 | * |
| 3669 | * Represents an `else` clause in a `case`, `if`, or `unless` statement. |
| 3670 | * |
| 3671 | * if a then b else c end |
| 3672 | * ^^^^^^^^^^ |
| 3673 | * |
| 3674 | * Type: ::PM_ELSE_NODE |
| 3675 | * |
| 3676 | * @extends pm_node_t |
| 3677 | */ |
| 3678 | typedef struct pm_else_node { |
| 3679 | /** The embedded base node. */ |
| 3680 | pm_node_t base; |
| 3681 | |
| 3682 | |
| 3683 | /** |
| 3684 | * ElseNode#else_keyword_loc |
| 3685 | */ |
| 3686 | pm_location_t else_keyword_loc; |
| 3687 | |
| 3688 | /** |
| 3689 | * ElseNode#statements |
| 3690 | */ |
| 3691 | struct pm_statements_node *statements; |
| 3692 | |
| 3693 | /** |
| 3694 | * ElseNode#end_keyword_loc |
| 3695 | */ |
| 3696 | pm_location_t end_keyword_loc; |
| 3697 | } pm_else_node_t; |
| 3698 | |
| 3699 | /** |
| 3700 | * EmbeddedStatementsNode |
| 3701 | * |
| 3702 | * Represents an interpolated set of statements. |
| 3703 | * |
| 3704 | * "foo #{bar}" |
| 3705 | * ^^^^^^ |
| 3706 | * |
| 3707 | * Type: ::PM_EMBEDDED_STATEMENTS_NODE |
| 3708 | * |
| 3709 | * @extends pm_node_t |
| 3710 | */ |
| 3711 | typedef struct pm_embedded_statements_node { |
| 3712 | /** The embedded base node. */ |
| 3713 | pm_node_t base; |
| 3714 | |
| 3715 | |
| 3716 | /** |
| 3717 | * EmbeddedStatementsNode#opening_loc |
| 3718 | */ |
| 3719 | pm_location_t opening_loc; |
| 3720 | |
| 3721 | /** |
| 3722 | * EmbeddedStatementsNode#statements |
| 3723 | */ |
| 3724 | struct pm_statements_node *statements; |
| 3725 | |
| 3726 | /** |
| 3727 | * EmbeddedStatementsNode#closing_loc |
| 3728 | */ |
| 3729 | pm_location_t closing_loc; |
| 3730 | } pm_embedded_statements_node_t; |
| 3731 | |
| 3732 | /** |
| 3733 | * EmbeddedVariableNode |
| 3734 | * |
| 3735 | * Represents an interpolated variable. |
| 3736 | * |
| 3737 | * "foo #@bar" |
| 3738 | * ^^^^^ |
| 3739 | * |
| 3740 | * Type: ::PM_EMBEDDED_VARIABLE_NODE |
| 3741 | * |
| 3742 | * @extends pm_node_t |
| 3743 | */ |
| 3744 | typedef struct pm_embedded_variable_node { |
| 3745 | /** The embedded base node. */ |
| 3746 | pm_node_t base; |
| 3747 | |
| 3748 | |
| 3749 | /** |
| 3750 | * EmbeddedVariableNode#operator_loc |
| 3751 | */ |
| 3752 | pm_location_t operator_loc; |
| 3753 | |
| 3754 | /** |
| 3755 | * EmbeddedVariableNode#variable |
| 3756 | */ |
| 3757 | struct pm_node *variable; |
| 3758 | } pm_embedded_variable_node_t; |
| 3759 | |
| 3760 | /** |
| 3761 | * EnsureNode |
| 3762 | * |
| 3763 | * Represents an `ensure` clause in a `begin` statement. |
| 3764 | * |
| 3765 | * begin |
| 3766 | * foo |
| 3767 | * ensure |
| 3768 | * ^^^^^^ |
| 3769 | * bar |
| 3770 | * end |
| 3771 | * |
| 3772 | * Type: ::PM_ENSURE_NODE |
| 3773 | * |
| 3774 | * @extends pm_node_t |
| 3775 | */ |
| 3776 | typedef struct pm_ensure_node { |
| 3777 | /** The embedded base node. */ |
| 3778 | pm_node_t base; |
| 3779 | |
| 3780 | |
| 3781 | /** |
| 3782 | * EnsureNode#ensure_keyword_loc |
| 3783 | */ |
| 3784 | pm_location_t ensure_keyword_loc; |
| 3785 | |
| 3786 | /** |
| 3787 | * EnsureNode#statements |
| 3788 | */ |
| 3789 | struct pm_statements_node *statements; |
| 3790 | |
| 3791 | /** |
| 3792 | * EnsureNode#end_keyword_loc |
| 3793 | */ |
| 3794 | pm_location_t end_keyword_loc; |
| 3795 | } pm_ensure_node_t; |
| 3796 | |
| 3797 | /** |
| 3798 | * FalseNode |
| 3799 | * |
| 3800 | * Represents the use of the literal `false` keyword. |
| 3801 | * |
| 3802 | * false |
| 3803 | * ^^^^^ |
| 3804 | * |
| 3805 | * Type: ::PM_FALSE_NODE |
| 3806 | * |
| 3807 | * @extends pm_node_t |
| 3808 | */ |
| 3809 | typedef struct pm_false_node { |
| 3810 | /** The embedded base node. */ |
| 3811 | pm_node_t base; |
| 3812 | |
| 3813 | } pm_false_node_t; |
| 3814 | |
| 3815 | /** |
| 3816 | * FindPatternNode |
| 3817 | * |
| 3818 | * Represents a find pattern in pattern matching. |
| 3819 | * |
| 3820 | * foo in *bar, baz, *qux |
| 3821 | * ^^^^^^^^^^^^^^^ |
| 3822 | * |
| 3823 | * foo in [*bar, baz, *qux] |
| 3824 | * ^^^^^^^^^^^^^^^^^ |
| 3825 | * |
| 3826 | * foo in Foo(*bar, baz, *qux) |
| 3827 | * ^^^^^^^^^^^^^^^^^^^^ |
| 3828 | * |
| 3829 | * foo => *bar, baz, *qux |
| 3830 | * ^^^^^^^^^^^^^^^ |
| 3831 | * |
| 3832 | * Type: ::PM_FIND_PATTERN_NODE |
| 3833 | * |
| 3834 | * @extends pm_node_t |
| 3835 | */ |
| 3836 | typedef struct pm_find_pattern_node { |
| 3837 | /** The embedded base node. */ |
| 3838 | pm_node_t base; |
| 3839 | |
| 3840 | |
| 3841 | /** |
| 3842 | * FindPatternNode#constant |
| 3843 | * |
| 3844 | * Represents the optional constant preceding the pattern |
| 3845 | * |
| 3846 | * foo in Foo(*bar, baz, *qux) |
| 3847 | * ^^^ |
| 3848 | */ |
| 3849 | struct pm_node *constant; |
| 3850 | |
| 3851 | /** |
| 3852 | * FindPatternNode#left |
| 3853 | * |
| 3854 | * Represents the first wildcard node in the pattern. |
| 3855 | * |
| 3856 | * foo in *bar, baz, *qux |
| 3857 | * ^^^^ |
| 3858 | * |
| 3859 | * foo in Foo(*bar, baz, *qux) |
| 3860 | * ^^^^ |
| 3861 | */ |
| 3862 | struct pm_splat_node *left; |
| 3863 | |
| 3864 | /** |
| 3865 | * FindPatternNode#requireds |
| 3866 | * |
| 3867 | * Represents the nodes in between the wildcards. |
| 3868 | * |
| 3869 | * foo in *bar, baz, *qux |
| 3870 | * ^^^ |
| 3871 | * |
| 3872 | * foo in Foo(*bar, baz, 1, *qux) |
| 3873 | * ^^^^^^ |
| 3874 | */ |
| 3875 | struct pm_node_list requireds; |
| 3876 | |
| 3877 | /** |
| 3878 | * FindPatternNode#right |
| 3879 | * |
| 3880 | * Represents the second wildcard node in the pattern. |
| 3881 | * |
| 3882 | * foo in *bar, baz, *qux |
| 3883 | * ^^^^ |
| 3884 | * |
| 3885 | * foo in Foo(*bar, baz, *qux) |
| 3886 | * ^^^^ |
| 3887 | */ |
| 3888 | struct pm_node *right; |
| 3889 | |
| 3890 | /** |
| 3891 | * FindPatternNode#opening_loc |
| 3892 | * |
| 3893 | * The location of the opening brace. |
| 3894 | * |
| 3895 | * foo in [*bar, baz, *qux] |
| 3896 | * ^ |
| 3897 | * |
| 3898 | * foo in Foo(*bar, baz, *qux) |
| 3899 | * ^ |
| 3900 | */ |
| 3901 | pm_location_t opening_loc; |
| 3902 | |
| 3903 | /** |
| 3904 | * FindPatternNode#closing_loc |
| 3905 | * |
| 3906 | * The location of the closing brace. |
| 3907 | * |
| 3908 | * foo in [*bar, baz, *qux] |
| 3909 | * ^ |
| 3910 | * |
| 3911 | * foo in Foo(*bar, baz, *qux) |
| 3912 | * ^ |
| 3913 | */ |
| 3914 | pm_location_t closing_loc; |
| 3915 | } pm_find_pattern_node_t; |
| 3916 | |
| 3917 | /** |
| 3918 | * FlipFlopNode |
| 3919 | * |
| 3920 | * Represents the use of the `..` or `...` operators to create flip flops. |
| 3921 | * |
| 3922 | * baz if foo .. bar |
| 3923 | * ^^^^^^^^^^ |
| 3924 | * |
| 3925 | * Type: ::PM_FLIP_FLOP_NODE |
| 3926 | |
| 3927 | * Flags (#pm_range_flags): |
| 3928 | * * ::PM_RANGE_FLAGS_EXCLUDE_END |
| 3929 | * |
| 3930 | * @extends pm_node_t |
| 3931 | */ |
| 3932 | typedef struct pm_flip_flop_node { |
| 3933 | /** The embedded base node. */ |
| 3934 | pm_node_t base; |
| 3935 | |
| 3936 | |
| 3937 | /** |
| 3938 | * FlipFlopNode#left |
| 3939 | */ |
| 3940 | struct pm_node *left; |
| 3941 | |
| 3942 | /** |
| 3943 | * FlipFlopNode#right |
| 3944 | */ |
| 3945 | struct pm_node *right; |
| 3946 | |
| 3947 | /** |
| 3948 | * FlipFlopNode#operator_loc |
| 3949 | */ |
| 3950 | pm_location_t operator_loc; |
| 3951 | } pm_flip_flop_node_t; |
| 3952 | |
| 3953 | /** |
| 3954 | * FloatNode |
| 3955 | * |
| 3956 | * Represents a floating point number literal. |
| 3957 | * |
| 3958 | * 1.0 |
| 3959 | * ^^^ |
| 3960 | * |
| 3961 | * Type: ::PM_FLOAT_NODE |
| 3962 | * |
| 3963 | * @extends pm_node_t |
| 3964 | */ |
| 3965 | typedef struct pm_float_node { |
| 3966 | /** The embedded base node. */ |
| 3967 | pm_node_t base; |
| 3968 | |
| 3969 | |
| 3970 | /** |
| 3971 | * FloatNode#value |
| 3972 | * |
| 3973 | * The value of the floating point number as a Float. |
| 3974 | */ |
| 3975 | double value; |
| 3976 | } pm_float_node_t; |
| 3977 | |
| 3978 | /** |
| 3979 | * ForNode |
| 3980 | * |
| 3981 | * Represents the use of the `for` keyword. |
| 3982 | * |
| 3983 | * for i in a end |
| 3984 | * ^^^^^^^^^^^^^^ |
| 3985 | * |
| 3986 | * Type: ::PM_FOR_NODE |
| 3987 | * |
| 3988 | * @extends pm_node_t |
| 3989 | */ |
| 3990 | typedef struct pm_for_node { |
| 3991 | /** The embedded base node. */ |
| 3992 | pm_node_t base; |
| 3993 | |
| 3994 | |
| 3995 | /** |
| 3996 | * ForNode#index |
| 3997 | * |
| 3998 | * The index expression for `for` loops. |
| 3999 | * |
| 4000 | * for i in a end |
| 4001 | * ^ |
| 4002 | */ |
| 4003 | struct pm_node *index; |
| 4004 | |
| 4005 | /** |
| 4006 | * ForNode#collection |
| 4007 | * |
| 4008 | * The collection to iterate over. |
| 4009 | * |
| 4010 | * for i in a end |
| 4011 | * ^ |
| 4012 | */ |
| 4013 | struct pm_node *collection; |
| 4014 | |
| 4015 | /** |
| 4016 | * ForNode#statements |
| 4017 | * |
| 4018 | * Represents the body of statements to execute for each iteration of the loop. |
| 4019 | * |
| 4020 | * for i in a |
| 4021 | * foo(i) |
| 4022 | * ^^^^^^ |
| 4023 | * end |
| 4024 | */ |
| 4025 | struct pm_statements_node *statements; |
| 4026 | |
| 4027 | /** |
| 4028 | * ForNode#for_keyword_loc |
| 4029 | * |
| 4030 | * The location of the `for` keyword. |
| 4031 | * |
| 4032 | * for i in a end |
| 4033 | * ^^^ |
| 4034 | */ |
| 4035 | pm_location_t for_keyword_loc; |
| 4036 | |
| 4037 | /** |
| 4038 | * ForNode#in_keyword_loc |
| 4039 | * |
| 4040 | * The location of the `in` keyword. |
| 4041 | * |
| 4042 | * for i in a end |
| 4043 | * ^^ |
| 4044 | */ |
| 4045 | pm_location_t in_keyword_loc; |
| 4046 | |
| 4047 | /** |
| 4048 | * ForNode#do_keyword_loc |
| 4049 | * |
| 4050 | * The location of the `do` keyword, if present. |
| 4051 | * |
| 4052 | * for i in a do end |
| 4053 | * ^^ |
| 4054 | */ |
| 4055 | pm_location_t do_keyword_loc; |
| 4056 | |
| 4057 | /** |
| 4058 | * ForNode#end_keyword_loc |
| 4059 | * |
| 4060 | * The location of the `end` keyword. |
| 4061 | * |
| 4062 | * for i in a end |
| 4063 | * ^^^ |
| 4064 | */ |
| 4065 | pm_location_t end_keyword_loc; |
| 4066 | } pm_for_node_t; |
| 4067 | |
| 4068 | /** |
| 4069 | * ForwardingArgumentsNode |
| 4070 | * |
| 4071 | * Represents forwarding all arguments to this method to another method. |
| 4072 | * |
| 4073 | * def foo(...) |
| 4074 | * bar(...) |
| 4075 | * ^^^ |
| 4076 | * end |
| 4077 | * |
| 4078 | * Type: ::PM_FORWARDING_ARGUMENTS_NODE |
| 4079 | * |
| 4080 | * @extends pm_node_t |
| 4081 | */ |
| 4082 | typedef struct pm_forwarding_arguments_node { |
| 4083 | /** The embedded base node. */ |
| 4084 | pm_node_t base; |
| 4085 | |
| 4086 | } pm_forwarding_arguments_node_t; |
| 4087 | |
| 4088 | /** |
| 4089 | * ForwardingParameterNode |
| 4090 | * |
| 4091 | * Represents the use of the forwarding parameter in a method, block, or lambda declaration. |
| 4092 | * |
| 4093 | * def foo(...) |
| 4094 | * ^^^ |
| 4095 | * end |
| 4096 | * |
| 4097 | * Type: ::PM_FORWARDING_PARAMETER_NODE |
| 4098 | * |
| 4099 | * @extends pm_node_t |
| 4100 | */ |
| 4101 | typedef struct pm_forwarding_parameter_node { |
| 4102 | /** The embedded base node. */ |
| 4103 | pm_node_t base; |
| 4104 | |
| 4105 | } pm_forwarding_parameter_node_t; |
| 4106 | |
| 4107 | /** |
| 4108 | * ForwardingSuperNode |
| 4109 | * |
| 4110 | * Represents the use of the `super` keyword without parentheses or arguments, but which might have a block. |
| 4111 | * |
| 4112 | * super |
| 4113 | * ^^^^^ |
| 4114 | * |
| 4115 | * super { 123 } |
| 4116 | * ^^^^^^^^^^^^^ |
| 4117 | * |
| 4118 | * If it has any other arguments, it would be a `SuperNode` instead. |
| 4119 | * |
| 4120 | * Type: ::PM_FORWARDING_SUPER_NODE |
| 4121 | * |
| 4122 | * @extends pm_node_t |
| 4123 | */ |
| 4124 | typedef struct pm_forwarding_super_node { |
| 4125 | /** The embedded base node. */ |
| 4126 | pm_node_t base; |
| 4127 | |
| 4128 | |
| 4129 | /** |
| 4130 | * ForwardingSuperNode#block |
| 4131 | * |
| 4132 | * All other arguments are forwarded as normal, except the original block is replaced with the new block. |
| 4133 | */ |
| 4134 | struct pm_block_node *block; |
| 4135 | } pm_forwarding_super_node_t; |
| 4136 | |
| 4137 | /** |
| 4138 | * GlobalVariableAndWriteNode |
| 4139 | * |
| 4140 | * Represents the use of the `&&=` operator for assignment to a global variable. |
| 4141 | * |
| 4142 | * $target &&= value |
| 4143 | * ^^^^^^^^^^^^^^^^^ |
| 4144 | * |
| 4145 | * Type: ::PM_GLOBAL_VARIABLE_AND_WRITE_NODE |
| 4146 | * |
| 4147 | * @extends pm_node_t |
| 4148 | */ |
| 4149 | typedef struct pm_global_variable_and_write_node { |
| 4150 | /** The embedded base node. */ |
| 4151 | pm_node_t base; |
| 4152 | |
| 4153 | |
| 4154 | /** |
| 4155 | * GlobalVariableAndWriteNode#name |
| 4156 | */ |
| 4157 | pm_constant_id_t name; |
| 4158 | |
| 4159 | /** |
| 4160 | * GlobalVariableAndWriteNode#name_loc |
| 4161 | */ |
| 4162 | pm_location_t name_loc; |
| 4163 | |
| 4164 | /** |
| 4165 | * GlobalVariableAndWriteNode#operator_loc |
| 4166 | */ |
| 4167 | pm_location_t operator_loc; |
| 4168 | |
| 4169 | /** |
| 4170 | * GlobalVariableAndWriteNode#value |
| 4171 | */ |
| 4172 | struct pm_node *value; |
| 4173 | } pm_global_variable_and_write_node_t; |
| 4174 | |
| 4175 | /** |
| 4176 | * GlobalVariableOperatorWriteNode |
| 4177 | * |
| 4178 | * Represents assigning to a global variable using an operator that isn't `=`. |
| 4179 | * |
| 4180 | * $target += value |
| 4181 | * ^^^^^^^^^^^^^^^^ |
| 4182 | * |
| 4183 | * Type: ::PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE |
| 4184 | * |
| 4185 | * @extends pm_node_t |
| 4186 | */ |
| 4187 | typedef struct pm_global_variable_operator_write_node { |
| 4188 | /** The embedded base node. */ |
| 4189 | pm_node_t base; |
| 4190 | |
| 4191 | |
| 4192 | /** |
| 4193 | * GlobalVariableOperatorWriteNode#name |
| 4194 | */ |
| 4195 | pm_constant_id_t name; |
| 4196 | |
| 4197 | /** |
| 4198 | * GlobalVariableOperatorWriteNode#name_loc |
| 4199 | */ |
| 4200 | pm_location_t name_loc; |
| 4201 | |
| 4202 | /** |
| 4203 | * GlobalVariableOperatorWriteNode#binary_operator_loc |
| 4204 | */ |
| 4205 | pm_location_t binary_operator_loc; |
| 4206 | |
| 4207 | /** |
| 4208 | * GlobalVariableOperatorWriteNode#value |
| 4209 | */ |
| 4210 | struct pm_node *value; |
| 4211 | |
| 4212 | /** |
| 4213 | * GlobalVariableOperatorWriteNode#binary_operator |
| 4214 | */ |
| 4215 | pm_constant_id_t binary_operator; |
| 4216 | } pm_global_variable_operator_write_node_t; |
| 4217 | |
| 4218 | /** |
| 4219 | * GlobalVariableOrWriteNode |
| 4220 | * |
| 4221 | * Represents the use of the `||=` operator for assignment to a global variable. |
| 4222 | * |
| 4223 | * $target ||= value |
| 4224 | * ^^^^^^^^^^^^^^^^^ |
| 4225 | * |
| 4226 | * Type: ::PM_GLOBAL_VARIABLE_OR_WRITE_NODE |
| 4227 | * |
| 4228 | * @extends pm_node_t |
| 4229 | */ |
| 4230 | typedef struct pm_global_variable_or_write_node { |
| 4231 | /** The embedded base node. */ |
| 4232 | pm_node_t base; |
| 4233 | |
| 4234 | |
| 4235 | /** |
| 4236 | * GlobalVariableOrWriteNode#name |
| 4237 | */ |
| 4238 | pm_constant_id_t name; |
| 4239 | |
| 4240 | /** |
| 4241 | * GlobalVariableOrWriteNode#name_loc |
| 4242 | */ |
| 4243 | pm_location_t name_loc; |
| 4244 | |
| 4245 | /** |
| 4246 | * GlobalVariableOrWriteNode#operator_loc |
| 4247 | */ |
| 4248 | pm_location_t operator_loc; |
| 4249 | |
| 4250 | /** |
| 4251 | * GlobalVariableOrWriteNode#value |
| 4252 | */ |
| 4253 | struct pm_node *value; |
| 4254 | } pm_global_variable_or_write_node_t; |
| 4255 | |
| 4256 | /** |
| 4257 | * GlobalVariableReadNode |
| 4258 | * |
| 4259 | * Represents referencing a global variable. |
| 4260 | * |
| 4261 | * $foo |
| 4262 | * ^^^^ |
| 4263 | * |
| 4264 | * Type: ::PM_GLOBAL_VARIABLE_READ_NODE |
| 4265 | * |
| 4266 | * @extends pm_node_t |
| 4267 | */ |
| 4268 | typedef struct pm_global_variable_read_node { |
| 4269 | /** The embedded base node. */ |
| 4270 | pm_node_t base; |
| 4271 | |
| 4272 | |
| 4273 | /** |
| 4274 | * GlobalVariableReadNode#name |
| 4275 | * |
| 4276 | * The name of the global variable, which is a `$` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifier). Alternatively, it can be one of the special global variables designated by a symbol. |
| 4277 | * |
| 4278 | * $foo # name `:$foo` |
| 4279 | * |
| 4280 | * $_Test # name `:$_Test` |
| 4281 | */ |
| 4282 | pm_constant_id_t name; |
| 4283 | } pm_global_variable_read_node_t; |
| 4284 | |
| 4285 | /** |
| 4286 | * GlobalVariableTargetNode |
| 4287 | * |
| 4288 | * Represents writing to a global variable in a context that doesn't have an explicit value. |
| 4289 | * |
| 4290 | * $foo, $bar = baz |
| 4291 | * ^^^^ ^^^^ |
| 4292 | * |
| 4293 | * Type: ::PM_GLOBAL_VARIABLE_TARGET_NODE |
| 4294 | * |
| 4295 | * @extends pm_node_t |
| 4296 | */ |
| 4297 | typedef struct pm_global_variable_target_node { |
| 4298 | /** The embedded base node. */ |
| 4299 | pm_node_t base; |
| 4300 | |
| 4301 | |
| 4302 | /** |
| 4303 | * GlobalVariableTargetNode#name |
| 4304 | */ |
| 4305 | pm_constant_id_t name; |
| 4306 | } pm_global_variable_target_node_t; |
| 4307 | |
| 4308 | /** |
| 4309 | * GlobalVariableWriteNode |
| 4310 | * |
| 4311 | * Represents writing to a global variable. |
| 4312 | * |
| 4313 | * $foo = 1 |
| 4314 | * ^^^^^^^^ |
| 4315 | * |
| 4316 | * Type: ::PM_GLOBAL_VARIABLE_WRITE_NODE |
| 4317 | * |
| 4318 | * @extends pm_node_t |
| 4319 | */ |
| 4320 | typedef struct pm_global_variable_write_node { |
| 4321 | /** The embedded base node. */ |
| 4322 | pm_node_t base; |
| 4323 | |
| 4324 | |
| 4325 | /** |
| 4326 | * GlobalVariableWriteNode#name |
| 4327 | * |
| 4328 | * The name of the global variable, which is a `$` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifier). Alternatively, it can be one of the special global variables designated by a symbol. |
| 4329 | * |
| 4330 | * $foo = :bar # name `:$foo` |
| 4331 | * |
| 4332 | * $_Test = 123 # name `:$_Test` |
| 4333 | */ |
| 4334 | pm_constant_id_t name; |
| 4335 | |
| 4336 | /** |
| 4337 | * GlobalVariableWriteNode#name_loc |
| 4338 | * |
| 4339 | * The location of the global variable's name. |
| 4340 | * |
| 4341 | * $foo = :bar |
| 4342 | * ^^^^ |
| 4343 | */ |
| 4344 | pm_location_t name_loc; |
| 4345 | |
| 4346 | /** |
| 4347 | * GlobalVariableWriteNode#value |
| 4348 | * |
| 4349 | * The value to write to the global variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 4350 | * |
| 4351 | * $foo = :bar |
| 4352 | * ^^^^ |
| 4353 | * |
| 4354 | * $-xyz = 123 |
| 4355 | * ^^^ |
| 4356 | */ |
| 4357 | struct pm_node *value; |
| 4358 | |
| 4359 | /** |
| 4360 | * GlobalVariableWriteNode#operator_loc |
| 4361 | * |
| 4362 | * The location of the `=` operator. |
| 4363 | * |
| 4364 | * $foo = :bar |
| 4365 | * ^ |
| 4366 | */ |
| 4367 | pm_location_t operator_loc; |
| 4368 | } pm_global_variable_write_node_t; |
| 4369 | |
| 4370 | /** |
| 4371 | * HashNode |
| 4372 | * |
| 4373 | * Represents a hash literal. |
| 4374 | * |
| 4375 | * { a => b } |
| 4376 | * ^^^^^^^^^^ |
| 4377 | * |
| 4378 | * Type: ::PM_HASH_NODE |
| 4379 | * |
| 4380 | * @extends pm_node_t |
| 4381 | */ |
| 4382 | typedef struct pm_hash_node { |
| 4383 | /** The embedded base node. */ |
| 4384 | pm_node_t base; |
| 4385 | |
| 4386 | |
| 4387 | /** |
| 4388 | * HashNode#opening_loc |
| 4389 | * |
| 4390 | * The location of the opening brace. |
| 4391 | * |
| 4392 | * { a => b } |
| 4393 | * ^ |
| 4394 | */ |
| 4395 | pm_location_t opening_loc; |
| 4396 | |
| 4397 | /** |
| 4398 | * HashNode#elements |
| 4399 | * |
| 4400 | * The elements of the hash. These can be either `AssocNode`s or `AssocSplatNode`s. |
| 4401 | * |
| 4402 | * { a: b } |
| 4403 | * ^^^^ |
| 4404 | * |
| 4405 | * { **foo } |
| 4406 | * ^^^^^ |
| 4407 | */ |
| 4408 | struct pm_node_list elements; |
| 4409 | |
| 4410 | /** |
| 4411 | * HashNode#closing_loc |
| 4412 | * |
| 4413 | * The location of the closing brace. |
| 4414 | * |
| 4415 | * { a => b } |
| 4416 | * ^ |
| 4417 | */ |
| 4418 | pm_location_t closing_loc; |
| 4419 | } pm_hash_node_t; |
| 4420 | |
| 4421 | /** |
| 4422 | * HashPatternNode |
| 4423 | * |
| 4424 | * Represents a hash pattern in pattern matching. |
| 4425 | * |
| 4426 | * foo => { a: 1, b: 2 } |
| 4427 | * ^^^^^^^^^^^^^^ |
| 4428 | * |
| 4429 | * foo => { a: 1, b: 2, **c } |
| 4430 | * ^^^^^^^^^^^^^^^^^^^ |
| 4431 | * |
| 4432 | * foo => Bar[a: 1, b: 2] |
| 4433 | * ^^^^^^^^^^^^^^^ |
| 4434 | * |
| 4435 | * foo in { a: 1, b: 2 } |
| 4436 | * ^^^^^^^^^^^^^^ |
| 4437 | * |
| 4438 | * Type: ::PM_HASH_PATTERN_NODE |
| 4439 | * |
| 4440 | * @extends pm_node_t |
| 4441 | */ |
| 4442 | typedef struct pm_hash_pattern_node { |
| 4443 | /** The embedded base node. */ |
| 4444 | pm_node_t base; |
| 4445 | |
| 4446 | |
| 4447 | /** |
| 4448 | * HashPatternNode#constant |
| 4449 | * |
| 4450 | * Represents the optional constant preceding the Hash. |
| 4451 | * |
| 4452 | * foo => Bar[a: 1, b: 2] |
| 4453 | * ^^^ |
| 4454 | * |
| 4455 | * foo => Bar::Baz[a: 1, b: 2] |
| 4456 | * ^^^^^^^^ |
| 4457 | */ |
| 4458 | struct pm_node *constant; |
| 4459 | |
| 4460 | /** |
| 4461 | * HashPatternNode#elements |
| 4462 | * |
| 4463 | * Represents the explicit named hash keys and values. |
| 4464 | * |
| 4465 | * foo => { a: 1, b:, ** } |
| 4466 | * ^^^^^^^^ |
| 4467 | */ |
| 4468 | struct pm_node_list elements; |
| 4469 | |
| 4470 | /** |
| 4471 | * HashPatternNode#rest |
| 4472 | * |
| 4473 | * Represents the rest of the Hash keys and values. This can be named, unnamed, or explicitly forbidden via `**nil`, this last one results in a `NoKeywordsParameterNode`. |
| 4474 | * |
| 4475 | * foo => { a: 1, b:, **c } |
| 4476 | * ^^^ |
| 4477 | * |
| 4478 | * foo => { a: 1, b:, ** } |
| 4479 | * ^^ |
| 4480 | * |
| 4481 | * foo => { a: 1, b:, **nil } |
| 4482 | * ^^^^^ |
| 4483 | */ |
| 4484 | struct pm_node *rest; |
| 4485 | |
| 4486 | /** |
| 4487 | * HashPatternNode#opening_loc |
| 4488 | * |
| 4489 | * The location of the opening brace. |
| 4490 | * |
| 4491 | * foo => { a: 1 } |
| 4492 | * ^ |
| 4493 | * |
| 4494 | * foo => Bar[a: 1] |
| 4495 | * ^ |
| 4496 | */ |
| 4497 | pm_location_t opening_loc; |
| 4498 | |
| 4499 | /** |
| 4500 | * HashPatternNode#closing_loc |
| 4501 | * |
| 4502 | * The location of the closing brace. |
| 4503 | * |
| 4504 | * foo => { a: 1 } |
| 4505 | * ^ |
| 4506 | * |
| 4507 | * foo => Bar[a: 1] |
| 4508 | * ^ |
| 4509 | */ |
| 4510 | pm_location_t closing_loc; |
| 4511 | } pm_hash_pattern_node_t; |
| 4512 | |
| 4513 | /** |
| 4514 | * IfNode |
| 4515 | * |
| 4516 | * Represents the use of the `if` keyword, either in the block form or the modifier form, or a ternary expression. |
| 4517 | * |
| 4518 | * bar if foo |
| 4519 | * ^^^^^^^^^^ |
| 4520 | * |
| 4521 | * if foo then bar end |
| 4522 | * ^^^^^^^^^^^^^^^^^^^ |
| 4523 | * |
| 4524 | * foo ? bar : baz |
| 4525 | * ^^^^^^^^^^^^^^^ |
| 4526 | * |
| 4527 | * Type: ::PM_IF_NODE |
| 4528 | * |
| 4529 | * @extends pm_node_t |
| 4530 | */ |
| 4531 | typedef struct pm_if_node { |
| 4532 | /** The embedded base node. */ |
| 4533 | pm_node_t base; |
| 4534 | |
| 4535 | |
| 4536 | /** |
| 4537 | * IfNode#if_keyword_loc |
| 4538 | * |
| 4539 | * The location of the `if` keyword if present. |
| 4540 | * |
| 4541 | * bar if foo |
| 4542 | * ^^ |
| 4543 | * |
| 4544 | * The `if_keyword_loc` field will be `nil` when the `IfNode` represents a ternary expression. |
| 4545 | */ |
| 4546 | pm_location_t if_keyword_loc; |
| 4547 | |
| 4548 | /** |
| 4549 | * IfNode#predicate |
| 4550 | * |
| 4551 | * The node for the condition the `IfNode` is testing. |
| 4552 | * |
| 4553 | * if foo |
| 4554 | * ^^^ |
| 4555 | * bar |
| 4556 | * end |
| 4557 | * |
| 4558 | * bar if foo |
| 4559 | * ^^^ |
| 4560 | * |
| 4561 | * foo ? bar : baz |
| 4562 | * ^^^ |
| 4563 | */ |
| 4564 | struct pm_node *predicate; |
| 4565 | |
| 4566 | /** |
| 4567 | * IfNode#then_keyword_loc |
| 4568 | * |
| 4569 | * The location of the `then` keyword (if present) or the `?` in a ternary expression, `nil` otherwise. |
| 4570 | * |
| 4571 | * if foo then bar end |
| 4572 | * ^^^^ |
| 4573 | * |
| 4574 | * a ? b : c |
| 4575 | * ^ |
| 4576 | */ |
| 4577 | pm_location_t then_keyword_loc; |
| 4578 | |
| 4579 | /** |
| 4580 | * IfNode#statements |
| 4581 | * |
| 4582 | * Represents the body of statements that will be executed when the predicate is evaluated as truthy. Will be `nil` when no body is provided. |
| 4583 | * |
| 4584 | * if foo |
| 4585 | * bar |
| 4586 | * ^^^ |
| 4587 | * baz |
| 4588 | * ^^^ |
| 4589 | * end |
| 4590 | */ |
| 4591 | struct pm_statements_node *statements; |
| 4592 | |
| 4593 | /** |
| 4594 | * IfNode#subsequent |
| 4595 | * |
| 4596 | * Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement. |
| 4597 | * |
| 4598 | * if foo |
| 4599 | * bar |
| 4600 | * elsif baz |
| 4601 | * ^^^^^^^^^ |
| 4602 | * qux |
| 4603 | * ^^^ |
| 4604 | * end |
| 4605 | * ^^^ |
| 4606 | * |
| 4607 | * if foo then bar else baz end |
| 4608 | * ^^^^^^^^^^^^ |
| 4609 | */ |
| 4610 | struct pm_node *subsequent; |
| 4611 | |
| 4612 | /** |
| 4613 | * IfNode#end_keyword_loc |
| 4614 | * |
| 4615 | * The location of the `end` keyword if present, `nil` otherwise. |
| 4616 | * |
| 4617 | * if foo |
| 4618 | * bar |
| 4619 | * end |
| 4620 | * ^^^ |
| 4621 | */ |
| 4622 | pm_location_t end_keyword_loc; |
| 4623 | } pm_if_node_t; |
| 4624 | |
| 4625 | /** |
| 4626 | * ImaginaryNode |
| 4627 | * |
| 4628 | * Represents an imaginary number literal. |
| 4629 | * |
| 4630 | * 1.0i |
| 4631 | * ^^^^ |
| 4632 | * |
| 4633 | * Type: ::PM_IMAGINARY_NODE |
| 4634 | * |
| 4635 | * @extends pm_node_t |
| 4636 | */ |
| 4637 | typedef struct pm_imaginary_node { |
| 4638 | /** The embedded base node. */ |
| 4639 | pm_node_t base; |
| 4640 | |
| 4641 | |
| 4642 | /** |
| 4643 | * ImaginaryNode#numeric |
| 4644 | */ |
| 4645 | struct pm_node *numeric; |
| 4646 | } pm_imaginary_node_t; |
| 4647 | |
| 4648 | /** |
| 4649 | * ImplicitNode |
| 4650 | * |
| 4651 | * Represents a node that is implicitly being added to the tree but doesn't correspond directly to a node in the source. |
| 4652 | * |
| 4653 | * { foo: } |
| 4654 | * ^^^^ |
| 4655 | * |
| 4656 | * { Foo: } |
| 4657 | * ^^^^ |
| 4658 | * |
| 4659 | * foo in { bar: } |
| 4660 | * ^^^^ |
| 4661 | * |
| 4662 | * Type: ::PM_IMPLICIT_NODE |
| 4663 | * |
| 4664 | * @extends pm_node_t |
| 4665 | */ |
| 4666 | typedef struct pm_implicit_node { |
| 4667 | /** The embedded base node. */ |
| 4668 | pm_node_t base; |
| 4669 | |
| 4670 | |
| 4671 | /** |
| 4672 | * ImplicitNode#value |
| 4673 | */ |
| 4674 | struct pm_node *value; |
| 4675 | } pm_implicit_node_t; |
| 4676 | |
| 4677 | /** |
| 4678 | * ImplicitRestNode |
| 4679 | * |
| 4680 | * Represents using a trailing comma to indicate an implicit rest parameter. |
| 4681 | * |
| 4682 | * foo { |bar,| } |
| 4683 | * ^ |
| 4684 | * |
| 4685 | * foo in [bar,] |
| 4686 | * ^ |
| 4687 | * |
| 4688 | * for foo, in bar do end |
| 4689 | * ^ |
| 4690 | * |
| 4691 | * foo, = bar |
| 4692 | * ^ |
| 4693 | * |
| 4694 | * Type: ::PM_IMPLICIT_REST_NODE |
| 4695 | * |
| 4696 | * @extends pm_node_t |
| 4697 | */ |
| 4698 | typedef struct pm_implicit_rest_node { |
| 4699 | /** The embedded base node. */ |
| 4700 | pm_node_t base; |
| 4701 | |
| 4702 | } pm_implicit_rest_node_t; |
| 4703 | |
| 4704 | /** |
| 4705 | * InNode |
| 4706 | * |
| 4707 | * Represents the use of the `in` keyword in a case statement. |
| 4708 | * |
| 4709 | * case a; in b then c end |
| 4710 | * ^^^^^^^^^^^ |
| 4711 | * |
| 4712 | * Type: ::PM_IN_NODE |
| 4713 | * |
| 4714 | * @extends pm_node_t |
| 4715 | */ |
| 4716 | typedef struct pm_in_node { |
| 4717 | /** The embedded base node. */ |
| 4718 | pm_node_t base; |
| 4719 | |
| 4720 | |
| 4721 | /** |
| 4722 | * InNode#pattern |
| 4723 | */ |
| 4724 | struct pm_node *pattern; |
| 4725 | |
| 4726 | /** |
| 4727 | * InNode#statements |
| 4728 | */ |
| 4729 | struct pm_statements_node *statements; |
| 4730 | |
| 4731 | /** |
| 4732 | * InNode#in_loc |
| 4733 | */ |
| 4734 | pm_location_t in_loc; |
| 4735 | |
| 4736 | /** |
| 4737 | * InNode#then_loc |
| 4738 | */ |
| 4739 | pm_location_t then_loc; |
| 4740 | } pm_in_node_t; |
| 4741 | |
| 4742 | /** |
| 4743 | * IndexAndWriteNode |
| 4744 | * |
| 4745 | * Represents the use of the `&&=` operator on a call to the `[]` method. |
| 4746 | * |
| 4747 | * foo.bar[baz] &&= value |
| 4748 | * ^^^^^^^^^^^^^^^^^^^^^^ |
| 4749 | * |
| 4750 | * Type: ::PM_INDEX_AND_WRITE_NODE |
| 4751 | |
| 4752 | * Flags (#pm_call_node_flags): |
| 4753 | * * ::PM_CALL_NODE_FLAGS_SAFE_NAVIGATION |
| 4754 | * * ::PM_CALL_NODE_FLAGS_VARIABLE_CALL |
| 4755 | * * ::PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE |
| 4756 | * * ::PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY |
| 4757 | * |
| 4758 | * @extends pm_node_t |
| 4759 | */ |
| 4760 | typedef struct pm_index_and_write_node { |
| 4761 | /** The embedded base node. */ |
| 4762 | pm_node_t base; |
| 4763 | |
| 4764 | |
| 4765 | /** |
| 4766 | * IndexAndWriteNode#receiver |
| 4767 | */ |
| 4768 | struct pm_node *receiver; |
| 4769 | |
| 4770 | /** |
| 4771 | * IndexAndWriteNode#call_operator_loc |
| 4772 | */ |
| 4773 | pm_location_t call_operator_loc; |
| 4774 | |
| 4775 | /** |
| 4776 | * IndexAndWriteNode#opening_loc |
| 4777 | */ |
| 4778 | pm_location_t opening_loc; |
| 4779 | |
| 4780 | /** |
| 4781 | * IndexAndWriteNode#arguments |
| 4782 | */ |
| 4783 | struct pm_arguments_node *arguments; |
| 4784 | |
| 4785 | /** |
| 4786 | * IndexAndWriteNode#closing_loc |
| 4787 | */ |
| 4788 | pm_location_t closing_loc; |
| 4789 | |
| 4790 | /** |
| 4791 | * IndexAndWriteNode#block |
| 4792 | */ |
| 4793 | struct pm_block_argument_node *block; |
| 4794 | |
| 4795 | /** |
| 4796 | * IndexAndWriteNode#operator_loc |
| 4797 | */ |
| 4798 | pm_location_t operator_loc; |
| 4799 | |
| 4800 | /** |
| 4801 | * IndexAndWriteNode#value |
| 4802 | */ |
| 4803 | struct pm_node *value; |
| 4804 | } pm_index_and_write_node_t; |
| 4805 | |
| 4806 | /** |
| 4807 | * IndexOperatorWriteNode |
| 4808 | * |
| 4809 | * Represents the use of an assignment operator on a call to `[]`. |
| 4810 | * |
| 4811 | * foo.bar[baz] += value |
| 4812 | * ^^^^^^^^^^^^^^^^^^^^^ |
| 4813 | * |
| 4814 | * Type: ::PM_INDEX_OPERATOR_WRITE_NODE |
| 4815 | |
| 4816 | * Flags (#pm_call_node_flags): |
| 4817 | * * ::PM_CALL_NODE_FLAGS_SAFE_NAVIGATION |
| 4818 | * * ::PM_CALL_NODE_FLAGS_VARIABLE_CALL |
| 4819 | * * ::PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE |
| 4820 | * * ::PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY |
| 4821 | * |
| 4822 | * @extends pm_node_t |
| 4823 | */ |
| 4824 | typedef struct pm_index_operator_write_node { |
| 4825 | /** The embedded base node. */ |
| 4826 | pm_node_t base; |
| 4827 | |
| 4828 | |
| 4829 | /** |
| 4830 | * IndexOperatorWriteNode#receiver |
| 4831 | */ |
| 4832 | struct pm_node *receiver; |
| 4833 | |
| 4834 | /** |
| 4835 | * IndexOperatorWriteNode#call_operator_loc |
| 4836 | */ |
| 4837 | pm_location_t call_operator_loc; |
| 4838 | |
| 4839 | /** |
| 4840 | * IndexOperatorWriteNode#opening_loc |
| 4841 | */ |
| 4842 | pm_location_t opening_loc; |
| 4843 | |
| 4844 | /** |
| 4845 | * IndexOperatorWriteNode#arguments |
| 4846 | */ |
| 4847 | struct pm_arguments_node *arguments; |
| 4848 | |
| 4849 | /** |
| 4850 | * IndexOperatorWriteNode#closing_loc |
| 4851 | */ |
| 4852 | pm_location_t closing_loc; |
| 4853 | |
| 4854 | /** |
| 4855 | * IndexOperatorWriteNode#block |
| 4856 | */ |
| 4857 | struct pm_block_argument_node *block; |
| 4858 | |
| 4859 | /** |
| 4860 | * IndexOperatorWriteNode#binary_operator |
| 4861 | */ |
| 4862 | pm_constant_id_t binary_operator; |
| 4863 | |
| 4864 | /** |
| 4865 | * IndexOperatorWriteNode#binary_operator_loc |
| 4866 | */ |
| 4867 | pm_location_t binary_operator_loc; |
| 4868 | |
| 4869 | /** |
| 4870 | * IndexOperatorWriteNode#value |
| 4871 | */ |
| 4872 | struct pm_node *value; |
| 4873 | } pm_index_operator_write_node_t; |
| 4874 | |
| 4875 | /** |
| 4876 | * IndexOrWriteNode |
| 4877 | * |
| 4878 | * Represents the use of the `||=` operator on a call to `[]`. |
| 4879 | * |
| 4880 | * foo.bar[baz] ||= value |
| 4881 | * ^^^^^^^^^^^^^^^^^^^^^^ |
| 4882 | * |
| 4883 | * Type: ::PM_INDEX_OR_WRITE_NODE |
| 4884 | |
| 4885 | * Flags (#pm_call_node_flags): |
| 4886 | * * ::PM_CALL_NODE_FLAGS_SAFE_NAVIGATION |
| 4887 | * * ::PM_CALL_NODE_FLAGS_VARIABLE_CALL |
| 4888 | * * ::PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE |
| 4889 | * * ::PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY |
| 4890 | * |
| 4891 | * @extends pm_node_t |
| 4892 | */ |
| 4893 | typedef struct pm_index_or_write_node { |
| 4894 | /** The embedded base node. */ |
| 4895 | pm_node_t base; |
| 4896 | |
| 4897 | |
| 4898 | /** |
| 4899 | * IndexOrWriteNode#receiver |
| 4900 | */ |
| 4901 | struct pm_node *receiver; |
| 4902 | |
| 4903 | /** |
| 4904 | * IndexOrWriteNode#call_operator_loc |
| 4905 | */ |
| 4906 | pm_location_t call_operator_loc; |
| 4907 | |
| 4908 | /** |
| 4909 | * IndexOrWriteNode#opening_loc |
| 4910 | */ |
| 4911 | pm_location_t opening_loc; |
| 4912 | |
| 4913 | /** |
| 4914 | * IndexOrWriteNode#arguments |
| 4915 | */ |
| 4916 | struct pm_arguments_node *arguments; |
| 4917 | |
| 4918 | /** |
| 4919 | * IndexOrWriteNode#closing_loc |
| 4920 | */ |
| 4921 | pm_location_t closing_loc; |
| 4922 | |
| 4923 | /** |
| 4924 | * IndexOrWriteNode#block |
| 4925 | */ |
| 4926 | struct pm_block_argument_node *block; |
| 4927 | |
| 4928 | /** |
| 4929 | * IndexOrWriteNode#operator_loc |
| 4930 | */ |
| 4931 | pm_location_t operator_loc; |
| 4932 | |
| 4933 | /** |
| 4934 | * IndexOrWriteNode#value |
| 4935 | */ |
| 4936 | struct pm_node *value; |
| 4937 | } pm_index_or_write_node_t; |
| 4938 | |
| 4939 | /** |
| 4940 | * IndexTargetNode |
| 4941 | * |
| 4942 | * Represents assigning to an index. |
| 4943 | * |
| 4944 | * foo[bar], = 1 |
| 4945 | * ^^^^^^^^ |
| 4946 | * |
| 4947 | * begin |
| 4948 | * rescue => foo[bar] |
| 4949 | * ^^^^^^^^ |
| 4950 | * end |
| 4951 | * |
| 4952 | * for foo[bar] in baz do end |
| 4953 | * ^^^^^^^^ |
| 4954 | * |
| 4955 | * Type: ::PM_INDEX_TARGET_NODE |
| 4956 | |
| 4957 | * Flags (#pm_call_node_flags): |
| 4958 | * * ::PM_CALL_NODE_FLAGS_SAFE_NAVIGATION |
| 4959 | * * ::PM_CALL_NODE_FLAGS_VARIABLE_CALL |
| 4960 | * * ::PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE |
| 4961 | * * ::PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY |
| 4962 | * |
| 4963 | * @extends pm_node_t |
| 4964 | */ |
| 4965 | typedef struct pm_index_target_node { |
| 4966 | /** The embedded base node. */ |
| 4967 | pm_node_t base; |
| 4968 | |
| 4969 | |
| 4970 | /** |
| 4971 | * IndexTargetNode#receiver |
| 4972 | */ |
| 4973 | struct pm_node *receiver; |
| 4974 | |
| 4975 | /** |
| 4976 | * IndexTargetNode#opening_loc |
| 4977 | */ |
| 4978 | pm_location_t opening_loc; |
| 4979 | |
| 4980 | /** |
| 4981 | * IndexTargetNode#arguments |
| 4982 | */ |
| 4983 | struct pm_arguments_node *arguments; |
| 4984 | |
| 4985 | /** |
| 4986 | * IndexTargetNode#closing_loc |
| 4987 | */ |
| 4988 | pm_location_t closing_loc; |
| 4989 | |
| 4990 | /** |
| 4991 | * IndexTargetNode#block |
| 4992 | */ |
| 4993 | struct pm_block_argument_node *block; |
| 4994 | } pm_index_target_node_t; |
| 4995 | |
| 4996 | /** |
| 4997 | * InstanceVariableAndWriteNode |
| 4998 | * |
| 4999 | * Represents the use of the `&&=` operator for assignment to an instance variable. |
| 5000 | * |
| 5001 | * @target &&= value |
| 5002 | * ^^^^^^^^^^^^^^^^^ |
| 5003 | * |
| 5004 | * Type: ::PM_INSTANCE_VARIABLE_AND_WRITE_NODE |
| 5005 | * |
| 5006 | * @extends pm_node_t |
| 5007 | */ |
| 5008 | typedef struct pm_instance_variable_and_write_node { |
| 5009 | /** The embedded base node. */ |
| 5010 | pm_node_t base; |
| 5011 | |
| 5012 | |
| 5013 | /** |
| 5014 | * InstanceVariableAndWriteNode#name |
| 5015 | */ |
| 5016 | pm_constant_id_t name; |
| 5017 | |
| 5018 | /** |
| 5019 | * InstanceVariableAndWriteNode#name_loc |
| 5020 | */ |
| 5021 | pm_location_t name_loc; |
| 5022 | |
| 5023 | /** |
| 5024 | * InstanceVariableAndWriteNode#operator_loc |
| 5025 | */ |
| 5026 | pm_location_t operator_loc; |
| 5027 | |
| 5028 | /** |
| 5029 | * InstanceVariableAndWriteNode#value |
| 5030 | */ |
| 5031 | struct pm_node *value; |
| 5032 | } pm_instance_variable_and_write_node_t; |
| 5033 | |
| 5034 | /** |
| 5035 | * InstanceVariableOperatorWriteNode |
| 5036 | * |
| 5037 | * Represents assigning to an instance variable using an operator that isn't `=`. |
| 5038 | * |
| 5039 | * @target += value |
| 5040 | * ^^^^^^^^^^^^^^^^ |
| 5041 | * |
| 5042 | * Type: ::PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE |
| 5043 | * |
| 5044 | * @extends pm_node_t |
| 5045 | */ |
| 5046 | typedef struct pm_instance_variable_operator_write_node { |
| 5047 | /** The embedded base node. */ |
| 5048 | pm_node_t base; |
| 5049 | |
| 5050 | |
| 5051 | /** |
| 5052 | * InstanceVariableOperatorWriteNode#name |
| 5053 | */ |
| 5054 | pm_constant_id_t name; |
| 5055 | |
| 5056 | /** |
| 5057 | * InstanceVariableOperatorWriteNode#name_loc |
| 5058 | */ |
| 5059 | pm_location_t name_loc; |
| 5060 | |
| 5061 | /** |
| 5062 | * InstanceVariableOperatorWriteNode#binary_operator_loc |
| 5063 | */ |
| 5064 | pm_location_t binary_operator_loc; |
| 5065 | |
| 5066 | /** |
| 5067 | * InstanceVariableOperatorWriteNode#value |
| 5068 | */ |
| 5069 | struct pm_node *value; |
| 5070 | |
| 5071 | /** |
| 5072 | * InstanceVariableOperatorWriteNode#binary_operator |
| 5073 | */ |
| 5074 | pm_constant_id_t binary_operator; |
| 5075 | } pm_instance_variable_operator_write_node_t; |
| 5076 | |
| 5077 | /** |
| 5078 | * InstanceVariableOrWriteNode |
| 5079 | * |
| 5080 | * Represents the use of the `||=` operator for assignment to an instance variable. |
| 5081 | * |
| 5082 | * @target ||= value |
| 5083 | * ^^^^^^^^^^^^^^^^^ |
| 5084 | * |
| 5085 | * Type: ::PM_INSTANCE_VARIABLE_OR_WRITE_NODE |
| 5086 | * |
| 5087 | * @extends pm_node_t |
| 5088 | */ |
| 5089 | typedef struct pm_instance_variable_or_write_node { |
| 5090 | /** The embedded base node. */ |
| 5091 | pm_node_t base; |
| 5092 | |
| 5093 | |
| 5094 | /** |
| 5095 | * InstanceVariableOrWriteNode#name |
| 5096 | */ |
| 5097 | pm_constant_id_t name; |
| 5098 | |
| 5099 | /** |
| 5100 | * InstanceVariableOrWriteNode#name_loc |
| 5101 | */ |
| 5102 | pm_location_t name_loc; |
| 5103 | |
| 5104 | /** |
| 5105 | * InstanceVariableOrWriteNode#operator_loc |
| 5106 | */ |
| 5107 | pm_location_t operator_loc; |
| 5108 | |
| 5109 | /** |
| 5110 | * InstanceVariableOrWriteNode#value |
| 5111 | */ |
| 5112 | struct pm_node *value; |
| 5113 | } pm_instance_variable_or_write_node_t; |
| 5114 | |
| 5115 | /** |
| 5116 | * InstanceVariableReadNode |
| 5117 | * |
| 5118 | * Represents referencing an instance variable. |
| 5119 | * |
| 5120 | * @foo |
| 5121 | * ^^^^ |
| 5122 | * |
| 5123 | * Type: ::PM_INSTANCE_VARIABLE_READ_NODE |
| 5124 | * |
| 5125 | * @extends pm_node_t |
| 5126 | */ |
| 5127 | typedef struct pm_instance_variable_read_node { |
| 5128 | /** The embedded base node. */ |
| 5129 | pm_node_t base; |
| 5130 | |
| 5131 | |
| 5132 | /** |
| 5133 | * InstanceVariableReadNode#name |
| 5134 | * |
| 5135 | * The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). |
| 5136 | * |
| 5137 | * @x # name `:@x` |
| 5138 | * |
| 5139 | * @_test # name `:@_test` |
| 5140 | */ |
| 5141 | pm_constant_id_t name; |
| 5142 | } pm_instance_variable_read_node_t; |
| 5143 | |
| 5144 | /** |
| 5145 | * InstanceVariableTargetNode |
| 5146 | * |
| 5147 | * Represents writing to an instance variable in a context that doesn't have an explicit value. |
| 5148 | * |
| 5149 | * @foo, @bar = baz |
| 5150 | * ^^^^ ^^^^ |
| 5151 | * |
| 5152 | * Type: ::PM_INSTANCE_VARIABLE_TARGET_NODE |
| 5153 | * |
| 5154 | * @extends pm_node_t |
| 5155 | */ |
| 5156 | typedef struct pm_instance_variable_target_node { |
| 5157 | /** The embedded base node. */ |
| 5158 | pm_node_t base; |
| 5159 | |
| 5160 | |
| 5161 | /** |
| 5162 | * InstanceVariableTargetNode#name |
| 5163 | */ |
| 5164 | pm_constant_id_t name; |
| 5165 | } pm_instance_variable_target_node_t; |
| 5166 | |
| 5167 | /** |
| 5168 | * InstanceVariableWriteNode |
| 5169 | * |
| 5170 | * Represents writing to an instance variable. |
| 5171 | * |
| 5172 | * @foo = 1 |
| 5173 | * ^^^^^^^^ |
| 5174 | * |
| 5175 | * Type: ::PM_INSTANCE_VARIABLE_WRITE_NODE |
| 5176 | * |
| 5177 | * @extends pm_node_t |
| 5178 | */ |
| 5179 | typedef struct pm_instance_variable_write_node { |
| 5180 | /** The embedded base node. */ |
| 5181 | pm_node_t base; |
| 5182 | |
| 5183 | |
| 5184 | /** |
| 5185 | * InstanceVariableWriteNode#name |
| 5186 | * |
| 5187 | * The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). |
| 5188 | * |
| 5189 | * @x = :y # name `:@x` |
| 5190 | * |
| 5191 | * @_foo = "bar" # name `@_foo` |
| 5192 | */ |
| 5193 | pm_constant_id_t name; |
| 5194 | |
| 5195 | /** |
| 5196 | * InstanceVariableWriteNode#name_loc |
| 5197 | * |
| 5198 | * The location of the variable name. |
| 5199 | * |
| 5200 | * @_x = 1 |
| 5201 | * ^^^ |
| 5202 | */ |
| 5203 | pm_location_t name_loc; |
| 5204 | |
| 5205 | /** |
| 5206 | * InstanceVariableWriteNode#value |
| 5207 | * |
| 5208 | * The value to write to the instance variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 5209 | * |
| 5210 | * @foo = :bar |
| 5211 | * ^^^^ |
| 5212 | * |
| 5213 | * @_x = 1234 |
| 5214 | * ^^^^ |
| 5215 | */ |
| 5216 | struct pm_node *value; |
| 5217 | |
| 5218 | /** |
| 5219 | * InstanceVariableWriteNode#operator_loc |
| 5220 | * |
| 5221 | * The location of the `=` operator. |
| 5222 | * |
| 5223 | * @x = y |
| 5224 | * ^ |
| 5225 | */ |
| 5226 | pm_location_t operator_loc; |
| 5227 | } pm_instance_variable_write_node_t; |
| 5228 | |
| 5229 | /** |
| 5230 | * IntegerNode |
| 5231 | * |
| 5232 | * Represents an integer number literal. |
| 5233 | * |
| 5234 | * 1 |
| 5235 | * ^ |
| 5236 | * |
| 5237 | * Type: ::PM_INTEGER_NODE |
| 5238 | |
| 5239 | * Flags (#pm_integer_base_flags): |
| 5240 | * * ::PM_INTEGER_BASE_FLAGS_BINARY |
| 5241 | * * ::PM_INTEGER_BASE_FLAGS_DECIMAL |
| 5242 | * * ::PM_INTEGER_BASE_FLAGS_OCTAL |
| 5243 | * * ::PM_INTEGER_BASE_FLAGS_HEXADECIMAL |
| 5244 | * |
| 5245 | * @extends pm_node_t |
| 5246 | */ |
| 5247 | typedef struct pm_integer_node { |
| 5248 | /** The embedded base node. */ |
| 5249 | pm_node_t base; |
| 5250 | |
| 5251 | |
| 5252 | /** |
| 5253 | * IntegerNode#value |
| 5254 | * |
| 5255 | * The value of the integer literal as a number. |
| 5256 | */ |
| 5257 | pm_integer_t value; |
| 5258 | } pm_integer_node_t; |
| 5259 | |
| 5260 | /** |
| 5261 | * InterpolatedMatchLastLineNode |
| 5262 | * |
| 5263 | * Represents a regular expression literal that contains interpolation that is being used in the predicate of a conditional to implicitly match against the last line read by an IO object. |
| 5264 | * |
| 5265 | * if /foo #{bar} baz/ then end |
| 5266 | * ^^^^^^^^^^^^^^^^ |
| 5267 | * |
| 5268 | * Type: ::PM_INTERPOLATED_MATCH_LAST_LINE_NODE |
| 5269 | |
| 5270 | * Flags (#pm_regular_expression_flags): |
| 5271 | * * ::PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE |
| 5272 | * * ::PM_REGULAR_EXPRESSION_FLAGS_EXTENDED |
| 5273 | * * ::PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE |
| 5274 | * * ::PM_REGULAR_EXPRESSION_FLAGS_ONCE |
| 5275 | * * ::PM_REGULAR_EXPRESSION_FLAGS_EUC_JP |
| 5276 | * * ::PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT |
| 5277 | * * ::PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J |
| 5278 | * * ::PM_REGULAR_EXPRESSION_FLAGS_UTF_8 |
| 5279 | * * ::PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING |
| 5280 | * * ::PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING |
| 5281 | * * ::PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING |
| 5282 | * |
| 5283 | * @extends pm_node_t |
| 5284 | */ |
| 5285 | typedef struct pm_interpolated_match_last_line_node { |
| 5286 | /** The embedded base node. */ |
| 5287 | pm_node_t base; |
| 5288 | |
| 5289 | |
| 5290 | /** |
| 5291 | * InterpolatedMatchLastLineNode#opening_loc |
| 5292 | */ |
| 5293 | pm_location_t opening_loc; |
| 5294 | |
| 5295 | /** |
| 5296 | * InterpolatedMatchLastLineNode#parts |
| 5297 | */ |
| 5298 | struct pm_node_list parts; |
| 5299 | |
| 5300 | /** |
| 5301 | * InterpolatedMatchLastLineNode#closing_loc |
| 5302 | */ |
| 5303 | pm_location_t closing_loc; |
| 5304 | } pm_interpolated_match_last_line_node_t; |
| 5305 | |
| 5306 | /** |
| 5307 | * InterpolatedRegularExpressionNode |
| 5308 | * |
| 5309 | * Represents a regular expression literal that contains interpolation. |
| 5310 | * |
| 5311 | * /foo #{bar} baz/ |
| 5312 | * ^^^^^^^^^^^^^^^^ |
| 5313 | * |
| 5314 | * Type: ::PM_INTERPOLATED_REGULAR_EXPRESSION_NODE |
| 5315 | |
| 5316 | * Flags (#pm_regular_expression_flags): |
| 5317 | * * ::PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE |
| 5318 | * * ::PM_REGULAR_EXPRESSION_FLAGS_EXTENDED |
| 5319 | * * ::PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE |
| 5320 | * * ::PM_REGULAR_EXPRESSION_FLAGS_ONCE |
| 5321 | * * ::PM_REGULAR_EXPRESSION_FLAGS_EUC_JP |
| 5322 | * * ::PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT |
| 5323 | * * ::PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J |
| 5324 | * * ::PM_REGULAR_EXPRESSION_FLAGS_UTF_8 |
| 5325 | * * ::PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING |
| 5326 | * * ::PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING |
| 5327 | * * ::PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING |
| 5328 | * |
| 5329 | * @extends pm_node_t |
| 5330 | */ |
| 5331 | typedef struct pm_interpolated_regular_expression_node { |
| 5332 | /** The embedded base node. */ |
| 5333 | pm_node_t base; |
| 5334 | |
| 5335 | |
| 5336 | /** |
| 5337 | * InterpolatedRegularExpressionNode#opening_loc |
| 5338 | */ |
| 5339 | pm_location_t opening_loc; |
| 5340 | |
| 5341 | /** |
| 5342 | * InterpolatedRegularExpressionNode#parts |
| 5343 | */ |
| 5344 | struct pm_node_list parts; |
| 5345 | |
| 5346 | /** |
| 5347 | * InterpolatedRegularExpressionNode#closing_loc |
| 5348 | */ |
| 5349 | pm_location_t closing_loc; |
| 5350 | } pm_interpolated_regular_expression_node_t; |
| 5351 | |
| 5352 | /** |
| 5353 | * InterpolatedStringNode |
| 5354 | * |
| 5355 | * Represents a string literal that contains interpolation. |
| 5356 | * |
| 5357 | * "foo #{bar} baz" |
| 5358 | * ^^^^^^^^^^^^^^^^ |
| 5359 | * |
| 5360 | * Type: ::PM_INTERPOLATED_STRING_NODE |
| 5361 | |
| 5362 | * Flags (#pm_interpolated_string_node_flags): |
| 5363 | * * ::PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN |
| 5364 | * * ::PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE |
| 5365 | * |
| 5366 | * @extends pm_node_t |
| 5367 | */ |
| 5368 | typedef struct pm_interpolated_string_node { |
| 5369 | /** The embedded base node. */ |
| 5370 | pm_node_t base; |
| 5371 | |
| 5372 | |
| 5373 | /** |
| 5374 | * InterpolatedStringNode#opening_loc |
| 5375 | */ |
| 5376 | pm_location_t opening_loc; |
| 5377 | |
| 5378 | /** |
| 5379 | * InterpolatedStringNode#parts |
| 5380 | */ |
| 5381 | struct pm_node_list parts; |
| 5382 | |
| 5383 | /** |
| 5384 | * InterpolatedStringNode#closing_loc |
| 5385 | */ |
| 5386 | pm_location_t closing_loc; |
| 5387 | } pm_interpolated_string_node_t; |
| 5388 | |
| 5389 | /** |
| 5390 | * InterpolatedSymbolNode |
| 5391 | * |
| 5392 | * Represents a symbol literal that contains interpolation. |
| 5393 | * |
| 5394 | * :"foo #{bar} baz" |
| 5395 | * ^^^^^^^^^^^^^^^^^ |
| 5396 | * |
| 5397 | * Type: ::PM_INTERPOLATED_SYMBOL_NODE |
| 5398 | * |
| 5399 | * @extends pm_node_t |
| 5400 | */ |
| 5401 | typedef struct pm_interpolated_symbol_node { |
| 5402 | /** The embedded base node. */ |
| 5403 | pm_node_t base; |
| 5404 | |
| 5405 | |
| 5406 | /** |
| 5407 | * InterpolatedSymbolNode#opening_loc |
| 5408 | */ |
| 5409 | pm_location_t opening_loc; |
| 5410 | |
| 5411 | /** |
| 5412 | * InterpolatedSymbolNode#parts |
| 5413 | */ |
| 5414 | struct pm_node_list parts; |
| 5415 | |
| 5416 | /** |
| 5417 | * InterpolatedSymbolNode#closing_loc |
| 5418 | */ |
| 5419 | pm_location_t closing_loc; |
| 5420 | } pm_interpolated_symbol_node_t; |
| 5421 | |
| 5422 | /** |
| 5423 | * InterpolatedXStringNode |
| 5424 | * |
| 5425 | * Represents an xstring literal that contains interpolation. |
| 5426 | * |
| 5427 | * `foo #{bar} baz` |
| 5428 | * ^^^^^^^^^^^^^^^^ |
| 5429 | * |
| 5430 | * Type: ::PM_INTERPOLATED_X_STRING_NODE |
| 5431 | * |
| 5432 | * @extends pm_node_t |
| 5433 | */ |
| 5434 | typedef struct pm_interpolated_x_string_node { |
| 5435 | /** The embedded base node. */ |
| 5436 | pm_node_t base; |
| 5437 | |
| 5438 | |
| 5439 | /** |
| 5440 | * InterpolatedXStringNode#opening_loc |
| 5441 | */ |
| 5442 | pm_location_t opening_loc; |
| 5443 | |
| 5444 | /** |
| 5445 | * InterpolatedXStringNode#parts |
| 5446 | */ |
| 5447 | struct pm_node_list parts; |
| 5448 | |
| 5449 | /** |
| 5450 | * InterpolatedXStringNode#closing_loc |
| 5451 | */ |
| 5452 | pm_location_t closing_loc; |
| 5453 | } pm_interpolated_x_string_node_t; |
| 5454 | |
| 5455 | /** |
| 5456 | * ItLocalVariableReadNode |
| 5457 | * |
| 5458 | * Represents reading from the implicit `it` local variable. |
| 5459 | * |
| 5460 | * -> { it } |
| 5461 | * ^^ |
| 5462 | * |
| 5463 | * Type: ::PM_IT_LOCAL_VARIABLE_READ_NODE |
| 5464 | * |
| 5465 | * @extends pm_node_t |
| 5466 | */ |
| 5467 | typedef struct pm_it_local_variable_read_node { |
| 5468 | /** The embedded base node. */ |
| 5469 | pm_node_t base; |
| 5470 | |
| 5471 | } pm_it_local_variable_read_node_t; |
| 5472 | |
| 5473 | /** |
| 5474 | * ItParametersNode |
| 5475 | * |
| 5476 | * Represents an implicit set of parameters through the use of the `it` keyword within a block or lambda. |
| 5477 | * |
| 5478 | * -> { it + it } |
| 5479 | * ^^^^^^^^^^^^^^ |
| 5480 | * |
| 5481 | * Type: ::PM_IT_PARAMETERS_NODE |
| 5482 | * |
| 5483 | * @extends pm_node_t |
| 5484 | */ |
| 5485 | typedef struct pm_it_parameters_node { |
| 5486 | /** The embedded base node. */ |
| 5487 | pm_node_t base; |
| 5488 | |
| 5489 | } pm_it_parameters_node_t; |
| 5490 | |
| 5491 | /** |
| 5492 | * KeywordHashNode |
| 5493 | * |
| 5494 | * Represents a hash literal without opening and closing braces. |
| 5495 | * |
| 5496 | * foo(a: b) |
| 5497 | * ^^^^ |
| 5498 | * |
| 5499 | * Type: ::PM_KEYWORD_HASH_NODE |
| 5500 | |
| 5501 | * Flags (#pm_keyword_hash_node_flags): |
| 5502 | * * ::PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS |
| 5503 | * |
| 5504 | * @extends pm_node_t |
| 5505 | */ |
| 5506 | typedef struct pm_keyword_hash_node { |
| 5507 | /** The embedded base node. */ |
| 5508 | pm_node_t base; |
| 5509 | |
| 5510 | |
| 5511 | /** |
| 5512 | * KeywordHashNode#elements |
| 5513 | */ |
| 5514 | struct pm_node_list elements; |
| 5515 | } pm_keyword_hash_node_t; |
| 5516 | |
| 5517 | /** |
| 5518 | * KeywordRestParameterNode |
| 5519 | * |
| 5520 | * Represents a keyword rest parameter to a method, block, or lambda definition. |
| 5521 | * |
| 5522 | * def a(**b) |
| 5523 | * ^^^ |
| 5524 | * end |
| 5525 | * |
| 5526 | * Type: ::PM_KEYWORD_REST_PARAMETER_NODE |
| 5527 | |
| 5528 | * Flags (#pm_parameter_flags): |
| 5529 | * * ::PM_PARAMETER_FLAGS_REPEATED_PARAMETER |
| 5530 | * |
| 5531 | * @extends pm_node_t |
| 5532 | */ |
| 5533 | typedef struct pm_keyword_rest_parameter_node { |
| 5534 | /** The embedded base node. */ |
| 5535 | pm_node_t base; |
| 5536 | |
| 5537 | |
| 5538 | /** |
| 5539 | * KeywordRestParameterNode#name |
| 5540 | */ |
| 5541 | pm_constant_id_t name; |
| 5542 | |
| 5543 | /** |
| 5544 | * KeywordRestParameterNode#name_loc |
| 5545 | */ |
| 5546 | pm_location_t name_loc; |
| 5547 | |
| 5548 | /** |
| 5549 | * KeywordRestParameterNode#operator_loc |
| 5550 | */ |
| 5551 | pm_location_t operator_loc; |
| 5552 | } pm_keyword_rest_parameter_node_t; |
| 5553 | |
| 5554 | /** |
| 5555 | * LambdaNode |
| 5556 | * |
| 5557 | * Represents using a lambda literal (not the lambda method call). |
| 5558 | * |
| 5559 | * ->(value) { value * 2 } |
| 5560 | * ^^^^^^^^^^^^^^^^^^^^^^^ |
| 5561 | * |
| 5562 | * Type: ::PM_LAMBDA_NODE |
| 5563 | * |
| 5564 | * @extends pm_node_t |
| 5565 | */ |
| 5566 | typedef struct pm_lambda_node { |
| 5567 | /** The embedded base node. */ |
| 5568 | pm_node_t base; |
| 5569 | |
| 5570 | |
| 5571 | /** |
| 5572 | * LambdaNode#locals |
| 5573 | */ |
| 5574 | pm_constant_id_list_t locals; |
| 5575 | |
| 5576 | /** |
| 5577 | * LambdaNode#operator_loc |
| 5578 | */ |
| 5579 | pm_location_t operator_loc; |
| 5580 | |
| 5581 | /** |
| 5582 | * LambdaNode#opening_loc |
| 5583 | */ |
| 5584 | pm_location_t opening_loc; |
| 5585 | |
| 5586 | /** |
| 5587 | * LambdaNode#closing_loc |
| 5588 | */ |
| 5589 | pm_location_t closing_loc; |
| 5590 | |
| 5591 | /** |
| 5592 | * LambdaNode#parameters |
| 5593 | */ |
| 5594 | struct pm_node *parameters; |
| 5595 | |
| 5596 | /** |
| 5597 | * LambdaNode#body |
| 5598 | */ |
| 5599 | struct pm_node *body; |
| 5600 | } pm_lambda_node_t; |
| 5601 | |
| 5602 | /** |
| 5603 | * LocalVariableAndWriteNode |
| 5604 | * |
| 5605 | * Represents the use of the `&&=` operator for assignment to a local variable. |
| 5606 | * |
| 5607 | * target &&= value |
| 5608 | * ^^^^^^^^^^^^^^^^ |
| 5609 | * |
| 5610 | * Type: ::PM_LOCAL_VARIABLE_AND_WRITE_NODE |
| 5611 | * |
| 5612 | * @extends pm_node_t |
| 5613 | */ |
| 5614 | typedef struct pm_local_variable_and_write_node { |
| 5615 | /** The embedded base node. */ |
| 5616 | pm_node_t base; |
| 5617 | |
| 5618 | |
| 5619 | /** |
| 5620 | * LocalVariableAndWriteNode#name_loc |
| 5621 | */ |
| 5622 | pm_location_t name_loc; |
| 5623 | |
| 5624 | /** |
| 5625 | * LocalVariableAndWriteNode#operator_loc |
| 5626 | */ |
| 5627 | pm_location_t operator_loc; |
| 5628 | |
| 5629 | /** |
| 5630 | * LocalVariableAndWriteNode#value |
| 5631 | */ |
| 5632 | struct pm_node *value; |
| 5633 | |
| 5634 | /** |
| 5635 | * LocalVariableAndWriteNode#name |
| 5636 | */ |
| 5637 | pm_constant_id_t name; |
| 5638 | |
| 5639 | /** |
| 5640 | * LocalVariableAndWriteNode#depth |
| 5641 | */ |
| 5642 | uint32_t depth; |
| 5643 | } pm_local_variable_and_write_node_t; |
| 5644 | |
| 5645 | /** |
| 5646 | * LocalVariableOperatorWriteNode |
| 5647 | * |
| 5648 | * Represents assigning to a local variable using an operator that isn't `=`. |
| 5649 | * |
| 5650 | * target += value |
| 5651 | * ^^^^^^^^^^^^^^^ |
| 5652 | * |
| 5653 | * Type: ::PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE |
| 5654 | * |
| 5655 | * @extends pm_node_t |
| 5656 | */ |
| 5657 | typedef struct pm_local_variable_operator_write_node { |
| 5658 | /** The embedded base node. */ |
| 5659 | pm_node_t base; |
| 5660 | |
| 5661 | |
| 5662 | /** |
| 5663 | * LocalVariableOperatorWriteNode#name_loc |
| 5664 | */ |
| 5665 | pm_location_t name_loc; |
| 5666 | |
| 5667 | /** |
| 5668 | * LocalVariableOperatorWriteNode#binary_operator_loc |
| 5669 | */ |
| 5670 | pm_location_t binary_operator_loc; |
| 5671 | |
| 5672 | /** |
| 5673 | * LocalVariableOperatorWriteNode#value |
| 5674 | */ |
| 5675 | struct pm_node *value; |
| 5676 | |
| 5677 | /** |
| 5678 | * LocalVariableOperatorWriteNode#name |
| 5679 | */ |
| 5680 | pm_constant_id_t name; |
| 5681 | |
| 5682 | /** |
| 5683 | * LocalVariableOperatorWriteNode#binary_operator |
| 5684 | */ |
| 5685 | pm_constant_id_t binary_operator; |
| 5686 | |
| 5687 | /** |
| 5688 | * LocalVariableOperatorWriteNode#depth |
| 5689 | */ |
| 5690 | uint32_t depth; |
| 5691 | } pm_local_variable_operator_write_node_t; |
| 5692 | |
| 5693 | /** |
| 5694 | * LocalVariableOrWriteNode |
| 5695 | * |
| 5696 | * Represents the use of the `||=` operator for assignment to a local variable. |
| 5697 | * |
| 5698 | * target ||= value |
| 5699 | * ^^^^^^^^^^^^^^^^ |
| 5700 | * |
| 5701 | * Type: ::PM_LOCAL_VARIABLE_OR_WRITE_NODE |
| 5702 | * |
| 5703 | * @extends pm_node_t |
| 5704 | */ |
| 5705 | typedef struct pm_local_variable_or_write_node { |
| 5706 | /** The embedded base node. */ |
| 5707 | pm_node_t base; |
| 5708 | |
| 5709 | |
| 5710 | /** |
| 5711 | * LocalVariableOrWriteNode#name_loc |
| 5712 | */ |
| 5713 | pm_location_t name_loc; |
| 5714 | |
| 5715 | /** |
| 5716 | * LocalVariableOrWriteNode#operator_loc |
| 5717 | */ |
| 5718 | pm_location_t operator_loc; |
| 5719 | |
| 5720 | /** |
| 5721 | * LocalVariableOrWriteNode#value |
| 5722 | */ |
| 5723 | struct pm_node *value; |
| 5724 | |
| 5725 | /** |
| 5726 | * LocalVariableOrWriteNode#name |
| 5727 | */ |
| 5728 | pm_constant_id_t name; |
| 5729 | |
| 5730 | /** |
| 5731 | * LocalVariableOrWriteNode#depth |
| 5732 | */ |
| 5733 | uint32_t depth; |
| 5734 | } pm_local_variable_or_write_node_t; |
| 5735 | |
| 5736 | /** |
| 5737 | * LocalVariableReadNode |
| 5738 | * |
| 5739 | * Represents reading a local variable. Note that this requires that a local variable of the same name has already been written to in the same scope, otherwise it is parsed as a method call. |
| 5740 | * |
| 5741 | * foo |
| 5742 | * ^^^ |
| 5743 | * |
| 5744 | * Type: ::PM_LOCAL_VARIABLE_READ_NODE |
| 5745 | * |
| 5746 | * @extends pm_node_t |
| 5747 | */ |
| 5748 | typedef struct pm_local_variable_read_node { |
| 5749 | /** The embedded base node. */ |
| 5750 | pm_node_t base; |
| 5751 | |
| 5752 | |
| 5753 | /** |
| 5754 | * LocalVariableReadNode#name |
| 5755 | * |
| 5756 | * The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). |
| 5757 | * |
| 5758 | * x # name `:x` |
| 5759 | * |
| 5760 | * _Test # name `:_Test` |
| 5761 | * |
| 5762 | * Note that this can also be an underscore followed by a number for the default block parameters. |
| 5763 | * |
| 5764 | * _1 # name `:_1` |
| 5765 | */ |
| 5766 | pm_constant_id_t name; |
| 5767 | |
| 5768 | /** |
| 5769 | * LocalVariableReadNode#depth |
| 5770 | * |
| 5771 | * The number of visible scopes that should be searched to find the origin of this local variable. |
| 5772 | * |
| 5773 | * foo = 1; foo # depth 0 |
| 5774 | * |
| 5775 | * bar = 2; tap { bar } # depth 1 |
| 5776 | * |
| 5777 | * The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md). |
| 5778 | */ |
| 5779 | uint32_t depth; |
| 5780 | } pm_local_variable_read_node_t; |
| 5781 | |
| 5782 | /** |
| 5783 | * LocalVariableTargetNode |
| 5784 | * |
| 5785 | * Represents writing to a local variable in a context that doesn't have an explicit value. |
| 5786 | * |
| 5787 | * foo, bar = baz |
| 5788 | * ^^^ ^^^ |
| 5789 | * |
| 5790 | * foo => baz |
| 5791 | * ^^^ |
| 5792 | * |
| 5793 | * Type: ::PM_LOCAL_VARIABLE_TARGET_NODE |
| 5794 | * |
| 5795 | * @extends pm_node_t |
| 5796 | */ |
| 5797 | typedef struct pm_local_variable_target_node { |
| 5798 | /** The embedded base node. */ |
| 5799 | pm_node_t base; |
| 5800 | |
| 5801 | |
| 5802 | /** |
| 5803 | * LocalVariableTargetNode#name |
| 5804 | */ |
| 5805 | pm_constant_id_t name; |
| 5806 | |
| 5807 | /** |
| 5808 | * LocalVariableTargetNode#depth |
| 5809 | */ |
| 5810 | uint32_t depth; |
| 5811 | } pm_local_variable_target_node_t; |
| 5812 | |
| 5813 | /** |
| 5814 | * LocalVariableWriteNode |
| 5815 | * |
| 5816 | * Represents writing to a local variable. |
| 5817 | * |
| 5818 | * foo = 1 |
| 5819 | * ^^^^^^^ |
| 5820 | * |
| 5821 | * Type: ::PM_LOCAL_VARIABLE_WRITE_NODE |
| 5822 | * |
| 5823 | * @extends pm_node_t |
| 5824 | */ |
| 5825 | typedef struct pm_local_variable_write_node { |
| 5826 | /** The embedded base node. */ |
| 5827 | pm_node_t base; |
| 5828 | |
| 5829 | |
| 5830 | /** |
| 5831 | * LocalVariableWriteNode#name |
| 5832 | * |
| 5833 | * The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). |
| 5834 | * |
| 5835 | * foo = :bar # name `:foo` |
| 5836 | * |
| 5837 | * abc = 123 # name `:abc` |
| 5838 | */ |
| 5839 | pm_constant_id_t name; |
| 5840 | |
| 5841 | /** |
| 5842 | * LocalVariableWriteNode#depth |
| 5843 | * |
| 5844 | * The number of semantic scopes we have to traverse to find the declaration of this variable. |
| 5845 | * |
| 5846 | * foo = 1 # depth 0 |
| 5847 | * |
| 5848 | * tap { foo = 1 } # depth 1 |
| 5849 | * |
| 5850 | * The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md). |
| 5851 | */ |
| 5852 | uint32_t depth; |
| 5853 | |
| 5854 | /** |
| 5855 | * LocalVariableWriteNode#name_loc |
| 5856 | * |
| 5857 | * The location of the variable name. |
| 5858 | * |
| 5859 | * foo = :bar |
| 5860 | * ^^^ |
| 5861 | */ |
| 5862 | pm_location_t name_loc; |
| 5863 | |
| 5864 | /** |
| 5865 | * LocalVariableWriteNode#value |
| 5866 | * |
| 5867 | * The value to write to the local variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 5868 | * |
| 5869 | * foo = :bar |
| 5870 | * ^^^^ |
| 5871 | * |
| 5872 | * abc = 1234 |
| 5873 | * ^^^^ |
| 5874 | * |
| 5875 | * Note that since the name of a local variable is known before the value is parsed, it is valid for a local variable to appear within the value of its own write. |
| 5876 | * |
| 5877 | * foo = foo |
| 5878 | */ |
| 5879 | struct pm_node *value; |
| 5880 | |
| 5881 | /** |
| 5882 | * LocalVariableWriteNode#operator_loc |
| 5883 | * |
| 5884 | * The location of the `=` operator. |
| 5885 | * |
| 5886 | * x = :y |
| 5887 | * ^ |
| 5888 | */ |
| 5889 | pm_location_t operator_loc; |
| 5890 | } pm_local_variable_write_node_t; |
| 5891 | |
| 5892 | /** |
| 5893 | * MatchLastLineNode |
| 5894 | * |
| 5895 | * Represents a regular expression literal used in the predicate of a conditional to implicitly match against the last line read by an IO object. |
| 5896 | * |
| 5897 | * if /foo/i then end |
| 5898 | * ^^^^^^ |
| 5899 | * |
| 5900 | * Type: ::PM_MATCH_LAST_LINE_NODE |
| 5901 | |
| 5902 | * Flags (#pm_regular_expression_flags): |
| 5903 | * * ::PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE |
| 5904 | * * ::PM_REGULAR_EXPRESSION_FLAGS_EXTENDED |
| 5905 | * * ::PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE |
| 5906 | * * ::PM_REGULAR_EXPRESSION_FLAGS_ONCE |
| 5907 | * * ::PM_REGULAR_EXPRESSION_FLAGS_EUC_JP |
| 5908 | * * ::PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT |
| 5909 | * * ::PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J |
| 5910 | * * ::PM_REGULAR_EXPRESSION_FLAGS_UTF_8 |
| 5911 | * * ::PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING |
| 5912 | * * ::PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING |
| 5913 | * * ::PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING |
| 5914 | * |
| 5915 | * @extends pm_node_t |
| 5916 | */ |
| 5917 | typedef struct pm_match_last_line_node { |
| 5918 | /** The embedded base node. */ |
| 5919 | pm_node_t base; |
| 5920 | |
| 5921 | |
| 5922 | /** |
| 5923 | * MatchLastLineNode#opening_loc |
| 5924 | */ |
| 5925 | pm_location_t opening_loc; |
| 5926 | |
| 5927 | /** |
| 5928 | * MatchLastLineNode#content_loc |
| 5929 | */ |
| 5930 | pm_location_t content_loc; |
| 5931 | |
| 5932 | /** |
| 5933 | * MatchLastLineNode#closing_loc |
| 5934 | */ |
| 5935 | pm_location_t closing_loc; |
| 5936 | |
| 5937 | /** |
| 5938 | * MatchLastLineNode#unescaped |
| 5939 | */ |
| 5940 | pm_string_t unescaped; |
| 5941 | } pm_match_last_line_node_t; |
| 5942 | |
| 5943 | /** |
| 5944 | * MatchPredicateNode |
| 5945 | * |
| 5946 | * Represents the use of the modifier `in` operator. |
| 5947 | * |
| 5948 | * foo in bar |
| 5949 | * ^^^^^^^^^^ |
| 5950 | * |
| 5951 | * Type: ::PM_MATCH_PREDICATE_NODE |
| 5952 | * |
| 5953 | * @extends pm_node_t |
| 5954 | */ |
| 5955 | typedef struct pm_match_predicate_node { |
| 5956 | /** The embedded base node. */ |
| 5957 | pm_node_t base; |
| 5958 | |
| 5959 | |
| 5960 | /** |
| 5961 | * MatchPredicateNode#value |
| 5962 | */ |
| 5963 | struct pm_node *value; |
| 5964 | |
| 5965 | /** |
| 5966 | * MatchPredicateNode#pattern |
| 5967 | */ |
| 5968 | struct pm_node *pattern; |
| 5969 | |
| 5970 | /** |
| 5971 | * MatchPredicateNode#operator_loc |
| 5972 | */ |
| 5973 | pm_location_t operator_loc; |
| 5974 | } pm_match_predicate_node_t; |
| 5975 | |
| 5976 | /** |
| 5977 | * MatchRequiredNode |
| 5978 | * |
| 5979 | * Represents the use of the `=>` operator. |
| 5980 | * |
| 5981 | * foo => bar |
| 5982 | * ^^^^^^^^^^ |
| 5983 | * |
| 5984 | * Type: ::PM_MATCH_REQUIRED_NODE |
| 5985 | * |
| 5986 | * @extends pm_node_t |
| 5987 | */ |
| 5988 | typedef struct pm_match_required_node { |
| 5989 | /** The embedded base node. */ |
| 5990 | pm_node_t base; |
| 5991 | |
| 5992 | |
| 5993 | /** |
| 5994 | * MatchRequiredNode#value |
| 5995 | * |
| 5996 | * Represents the left-hand side of the operator. |
| 5997 | * |
| 5998 | * foo => bar |
| 5999 | * ^^^ |
| 6000 | */ |
| 6001 | struct pm_node *value; |
| 6002 | |
| 6003 | /** |
| 6004 | * MatchRequiredNode#pattern |
| 6005 | * |
| 6006 | * Represents the right-hand side of the operator. The type of the node depends on the expression. |
| 6007 | * |
| 6008 | * Anything that looks like a local variable name (including `_`) will result in a `LocalVariableTargetNode`. |
| 6009 | * |
| 6010 | * foo => a # This is equivalent to writing `a = foo` |
| 6011 | * ^ |
| 6012 | * |
| 6013 | * Using an explicit `Array` or combining expressions with `,` will result in a `ArrayPatternNode`. This can be preceded by a constant. |
| 6014 | * |
| 6015 | * foo => [a] |
| 6016 | * ^^^ |
| 6017 | * |
| 6018 | * foo => a, b |
| 6019 | * ^^^^ |
| 6020 | * |
| 6021 | * foo => Bar[a, b] |
| 6022 | * ^^^^^^^^^ |
| 6023 | * |
| 6024 | * If the array pattern contains at least two wildcard matches, a `FindPatternNode` is created instead. |
| 6025 | * |
| 6026 | * foo => *, 1, *a |
| 6027 | * ^^^^^ |
| 6028 | * |
| 6029 | * Using an explicit `Hash` or a constant with square brackets and hash keys in the square brackets will result in a `HashPatternNode`. |
| 6030 | * |
| 6031 | * foo => { a: 1, b: } |
| 6032 | * |
| 6033 | * foo => Bar[a: 1, b:] |
| 6034 | * |
| 6035 | * foo => Bar[**] |
| 6036 | * |
| 6037 | * To use any variable that needs run time evaluation, pinning is required. This results in a `PinnedVariableNode` |
| 6038 | * |
| 6039 | * foo => ^a |
| 6040 | * ^^ |
| 6041 | * |
| 6042 | * Similar, any expression can be used with pinning. This results in a `PinnedExpressionNode`. |
| 6043 | * |
| 6044 | * foo => ^(a + 1) |
| 6045 | * |
| 6046 | * Anything else will result in the regular node for that expression, for example a `ConstantReadNode`. |
| 6047 | * |
| 6048 | * foo => CONST |
| 6049 | */ |
| 6050 | struct pm_node *pattern; |
| 6051 | |
| 6052 | /** |
| 6053 | * MatchRequiredNode#operator_loc |
| 6054 | * |
| 6055 | * The location of the operator. |
| 6056 | * |
| 6057 | * foo => bar |
| 6058 | * ^^ |
| 6059 | */ |
| 6060 | pm_location_t operator_loc; |
| 6061 | } pm_match_required_node_t; |
| 6062 | |
| 6063 | /** |
| 6064 | * MatchWriteNode |
| 6065 | * |
| 6066 | * Represents writing local variables using a regular expression match with named capture groups. |
| 6067 | * |
| 6068 | * /(?<foo>bar)/ =~ baz |
| 6069 | * ^^^^^^^^^^^^^^^^^^^^ |
| 6070 | * |
| 6071 | * Type: ::PM_MATCH_WRITE_NODE |
| 6072 | * |
| 6073 | * @extends pm_node_t |
| 6074 | */ |
| 6075 | typedef struct pm_match_write_node { |
| 6076 | /** The embedded base node. */ |
| 6077 | pm_node_t base; |
| 6078 | |
| 6079 | |
| 6080 | /** |
| 6081 | * MatchWriteNode#call |
| 6082 | */ |
| 6083 | struct pm_call_node *call; |
| 6084 | |
| 6085 | /** |
| 6086 | * MatchWriteNode#targets |
| 6087 | */ |
| 6088 | struct pm_node_list targets; |
| 6089 | } pm_match_write_node_t; |
| 6090 | |
| 6091 | /** |
| 6092 | * MissingNode |
| 6093 | * |
| 6094 | * Represents a node that is missing from the source and results in a syntax error. |
| 6095 | * |
| 6096 | * Type: ::PM_MISSING_NODE |
| 6097 | * |
| 6098 | * @extends pm_node_t |
| 6099 | */ |
| 6100 | typedef struct pm_missing_node { |
| 6101 | /** The embedded base node. */ |
| 6102 | pm_node_t base; |
| 6103 | |
| 6104 | } pm_missing_node_t; |
| 6105 | |
| 6106 | /** |
| 6107 | * ModuleNode |
| 6108 | * |
| 6109 | * Represents a module declaration involving the `module` keyword. |
| 6110 | * |
| 6111 | * module Foo end |
| 6112 | * ^^^^^^^^^^^^^^ |
| 6113 | * |
| 6114 | * Type: ::PM_MODULE_NODE |
| 6115 | * |
| 6116 | * @extends pm_node_t |
| 6117 | */ |
| 6118 | typedef struct pm_module_node { |
| 6119 | /** The embedded base node. */ |
| 6120 | pm_node_t base; |
| 6121 | |
| 6122 | |
| 6123 | /** |
| 6124 | * ModuleNode#locals |
| 6125 | */ |
| 6126 | pm_constant_id_list_t locals; |
| 6127 | |
| 6128 | /** |
| 6129 | * ModuleNode#module_keyword_loc |
| 6130 | */ |
| 6131 | pm_location_t module_keyword_loc; |
| 6132 | |
| 6133 | /** |
| 6134 | * ModuleNode#constant_path |
| 6135 | */ |
| 6136 | struct pm_node *constant_path; |
| 6137 | |
| 6138 | /** |
| 6139 | * ModuleNode#body |
| 6140 | */ |
| 6141 | struct pm_node *body; |
| 6142 | |
| 6143 | /** |
| 6144 | * ModuleNode#end_keyword_loc |
| 6145 | */ |
| 6146 | pm_location_t end_keyword_loc; |
| 6147 | |
| 6148 | /** |
| 6149 | * ModuleNode#name |
| 6150 | */ |
| 6151 | pm_constant_id_t name; |
| 6152 | } pm_module_node_t; |
| 6153 | |
| 6154 | /** |
| 6155 | * MultiTargetNode |
| 6156 | * |
| 6157 | * Represents a multi-target expression. |
| 6158 | * |
| 6159 | * a, (b, c) = 1, 2, 3 |
| 6160 | * ^^^^^^ |
| 6161 | * |
| 6162 | * This can be a part of `MultiWriteNode` as above, or the target of a `for` loop |
| 6163 | * |
| 6164 | * for a, b in [[1, 2], [3, 4]] |
| 6165 | * ^^^^ |
| 6166 | * |
| 6167 | * Type: ::PM_MULTI_TARGET_NODE |
| 6168 | * |
| 6169 | * @extends pm_node_t |
| 6170 | */ |
| 6171 | typedef struct pm_multi_target_node { |
| 6172 | /** The embedded base node. */ |
| 6173 | pm_node_t base; |
| 6174 | |
| 6175 | |
| 6176 | /** |
| 6177 | * MultiTargetNode#lefts |
| 6178 | * |
| 6179 | * Represents the targets expressions before a splat node. |
| 6180 | * |
| 6181 | * a, (b, c, *) = 1, 2, 3, 4, 5 |
| 6182 | * ^^^^ |
| 6183 | * |
| 6184 | * The splat node can be absent, in that case all target expressions are in the left field. |
| 6185 | * |
| 6186 | * a, (b, c) = 1, 2, 3, 4, 5 |
| 6187 | * ^^^^ |
| 6188 | */ |
| 6189 | struct pm_node_list lefts; |
| 6190 | |
| 6191 | /** |
| 6192 | * MultiTargetNode#rest |
| 6193 | * |
| 6194 | * Represents a splat node in the target expression. |
| 6195 | * |
| 6196 | * a, (b, *c) = 1, 2, 3, 4 |
| 6197 | * ^^ |
| 6198 | * |
| 6199 | * The variable can be empty, this results in a `SplatNode` with a `nil` expression field. |
| 6200 | * |
| 6201 | * a, (b, *) = 1, 2, 3, 4 |
| 6202 | * ^ |
| 6203 | * |
| 6204 | * If the `*` is omitted, this field will contain an `ImplicitRestNode` |
| 6205 | * |
| 6206 | * a, (b,) = 1, 2, 3, 4 |
| 6207 | * ^ |
| 6208 | */ |
| 6209 | struct pm_node *rest; |
| 6210 | |
| 6211 | /** |
| 6212 | * MultiTargetNode#rights |
| 6213 | * |
| 6214 | * Represents the targets expressions after a splat node. |
| 6215 | * |
| 6216 | * a, (*, b, c) = 1, 2, 3, 4, 5 |
| 6217 | * ^^^^ |
| 6218 | */ |
| 6219 | struct pm_node_list rights; |
| 6220 | |
| 6221 | /** |
| 6222 | * MultiTargetNode#lparen_loc |
| 6223 | * |
| 6224 | * The location of the opening parenthesis. |
| 6225 | * |
| 6226 | * a, (b, c) = 1, 2, 3 |
| 6227 | * ^ |
| 6228 | */ |
| 6229 | pm_location_t lparen_loc; |
| 6230 | |
| 6231 | /** |
| 6232 | * MultiTargetNode#rparen_loc |
| 6233 | * |
| 6234 | * The location of the closing parenthesis. |
| 6235 | * |
| 6236 | * a, (b, c) = 1, 2, 3 |
| 6237 | * ^ |
| 6238 | */ |
| 6239 | pm_location_t rparen_loc; |
| 6240 | } pm_multi_target_node_t; |
| 6241 | |
| 6242 | /** |
| 6243 | * MultiWriteNode |
| 6244 | * |
| 6245 | * Represents a write to a multi-target expression. |
| 6246 | * |
| 6247 | * a, b, c = 1, 2, 3 |
| 6248 | * ^^^^^^^^^^^^^^^^^ |
| 6249 | * |
| 6250 | * Type: ::PM_MULTI_WRITE_NODE |
| 6251 | * |
| 6252 | * @extends pm_node_t |
| 6253 | */ |
| 6254 | typedef struct pm_multi_write_node { |
| 6255 | /** The embedded base node. */ |
| 6256 | pm_node_t base; |
| 6257 | |
| 6258 | |
| 6259 | /** |
| 6260 | * MultiWriteNode#lefts |
| 6261 | * |
| 6262 | * Represents the targets expressions before a splat node. |
| 6263 | * |
| 6264 | * a, b, * = 1, 2, 3, 4, 5 |
| 6265 | * ^^^^ |
| 6266 | * |
| 6267 | * The splat node can be absent, in that case all target expressions are in the left field. |
| 6268 | * |
| 6269 | * a, b, c = 1, 2, 3, 4, 5 |
| 6270 | * ^^^^^^^ |
| 6271 | */ |
| 6272 | struct pm_node_list lefts; |
| 6273 | |
| 6274 | /** |
| 6275 | * MultiWriteNode#rest |
| 6276 | * |
| 6277 | * Represents a splat node in the target expression. |
| 6278 | * |
| 6279 | * a, b, *c = 1, 2, 3, 4 |
| 6280 | * ^^ |
| 6281 | * |
| 6282 | * The variable can be empty, this results in a `SplatNode` with a `nil` expression field. |
| 6283 | * |
| 6284 | * a, b, * = 1, 2, 3, 4 |
| 6285 | * ^ |
| 6286 | * |
| 6287 | * If the `*` is omitted, this field will contain an `ImplicitRestNode` |
| 6288 | * |
| 6289 | * a, b, = 1, 2, 3, 4 |
| 6290 | * ^ |
| 6291 | */ |
| 6292 | struct pm_node *rest; |
| 6293 | |
| 6294 | /** |
| 6295 | * MultiWriteNode#rights |
| 6296 | * |
| 6297 | * Represents the targets expressions after a splat node. |
| 6298 | * |
| 6299 | * a, *, b, c = 1, 2, 3, 4, 5 |
| 6300 | * ^^^^ |
| 6301 | */ |
| 6302 | struct pm_node_list rights; |
| 6303 | |
| 6304 | /** |
| 6305 | * MultiWriteNode#lparen_loc |
| 6306 | * |
| 6307 | * The location of the opening parenthesis. |
| 6308 | * |
| 6309 | * (a, b, c) = 1, 2, 3 |
| 6310 | * ^ |
| 6311 | */ |
| 6312 | pm_location_t lparen_loc; |
| 6313 | |
| 6314 | /** |
| 6315 | * MultiWriteNode#rparen_loc |
| 6316 | * |
| 6317 | * The location of the closing parenthesis. |
| 6318 | * |
| 6319 | * (a, b, c) = 1, 2, 3 |
| 6320 | * ^ |
| 6321 | */ |
| 6322 | pm_location_t rparen_loc; |
| 6323 | |
| 6324 | /** |
| 6325 | * MultiWriteNode#operator_loc |
| 6326 | * |
| 6327 | * The location of the operator. |
| 6328 | * |
| 6329 | * a, b, c = 1, 2, 3 |
| 6330 | * ^ |
| 6331 | */ |
| 6332 | pm_location_t operator_loc; |
| 6333 | |
| 6334 | /** |
| 6335 | * MultiWriteNode#value |
| 6336 | * |
| 6337 | * The value to write to the targets. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 6338 | * |
| 6339 | * a, b, c = 1, 2, 3 |
| 6340 | * ^^^^^^^ |
| 6341 | */ |
| 6342 | struct pm_node *value; |
| 6343 | } pm_multi_write_node_t; |
| 6344 | |
| 6345 | /** |
| 6346 | * NextNode |
| 6347 | * |
| 6348 | * Represents the use of the `next` keyword. |
| 6349 | * |
| 6350 | * next 1 |
| 6351 | * ^^^^^^ |
| 6352 | * |
| 6353 | * Type: ::PM_NEXT_NODE |
| 6354 | * |
| 6355 | * @extends pm_node_t |
| 6356 | */ |
| 6357 | typedef struct pm_next_node { |
| 6358 | /** The embedded base node. */ |
| 6359 | pm_node_t base; |
| 6360 | |
| 6361 | |
| 6362 | /** |
| 6363 | * NextNode#arguments |
| 6364 | */ |
| 6365 | struct pm_arguments_node *arguments; |
| 6366 | |
| 6367 | /** |
| 6368 | * NextNode#keyword_loc |
| 6369 | */ |
| 6370 | pm_location_t keyword_loc; |
| 6371 | } pm_next_node_t; |
| 6372 | |
| 6373 | /** |
| 6374 | * NilNode |
| 6375 | * |
| 6376 | * Represents the use of the `nil` keyword. |
| 6377 | * |
| 6378 | * nil |
| 6379 | * ^^^ |
| 6380 | * |
| 6381 | * Type: ::PM_NIL_NODE |
| 6382 | * |
| 6383 | * @extends pm_node_t |
| 6384 | */ |
| 6385 | typedef struct pm_nil_node { |
| 6386 | /** The embedded base node. */ |
| 6387 | pm_node_t base; |
| 6388 | |
| 6389 | } pm_nil_node_t; |
| 6390 | |
| 6391 | /** |
| 6392 | * NoKeywordsParameterNode |
| 6393 | * |
| 6394 | * Represents the use of `**nil` inside method arguments. |
| 6395 | * |
| 6396 | * def a(**nil) |
| 6397 | * ^^^^^ |
| 6398 | * end |
| 6399 | * |
| 6400 | * Type: ::PM_NO_KEYWORDS_PARAMETER_NODE |
| 6401 | * |
| 6402 | * @extends pm_node_t |
| 6403 | */ |
| 6404 | typedef struct pm_no_keywords_parameter_node { |
| 6405 | /** The embedded base node. */ |
| 6406 | pm_node_t base; |
| 6407 | |
| 6408 | |
| 6409 | /** |
| 6410 | * NoKeywordsParameterNode#operator_loc |
| 6411 | */ |
| 6412 | pm_location_t operator_loc; |
| 6413 | |
| 6414 | /** |
| 6415 | * NoKeywordsParameterNode#keyword_loc |
| 6416 | */ |
| 6417 | pm_location_t keyword_loc; |
| 6418 | } pm_no_keywords_parameter_node_t; |
| 6419 | |
| 6420 | /** |
| 6421 | * NumberedParametersNode |
| 6422 | * |
| 6423 | * Represents an implicit set of parameters through the use of numbered parameters within a block or lambda. |
| 6424 | * |
| 6425 | * -> { _1 + _2 } |
| 6426 | * ^^^^^^^^^^^^^^ |
| 6427 | * |
| 6428 | * Type: ::PM_NUMBERED_PARAMETERS_NODE |
| 6429 | * |
| 6430 | * @extends pm_node_t |
| 6431 | */ |
| 6432 | typedef struct pm_numbered_parameters_node { |
| 6433 | /** The embedded base node. */ |
| 6434 | pm_node_t base; |
| 6435 | |
| 6436 | |
| 6437 | /** |
| 6438 | * NumberedParametersNode#maximum |
| 6439 | */ |
| 6440 | uint8_t maximum; |
| 6441 | } pm_numbered_parameters_node_t; |
| 6442 | |
| 6443 | /** |
| 6444 | * NumberedReferenceReadNode |
| 6445 | * |
| 6446 | * Represents reading a numbered reference to a capture in the previous match. |
| 6447 | * |
| 6448 | * $1 |
| 6449 | * ^^ |
| 6450 | * |
| 6451 | * Type: ::PM_NUMBERED_REFERENCE_READ_NODE |
| 6452 | * |
| 6453 | * @extends pm_node_t |
| 6454 | */ |
| 6455 | typedef struct pm_numbered_reference_read_node { |
| 6456 | /** The embedded base node. */ |
| 6457 | pm_node_t base; |
| 6458 | |
| 6459 | |
| 6460 | /** |
| 6461 | * NumberedReferenceReadNode#number |
| 6462 | * |
| 6463 | * The (1-indexed, from the left) number of the capture group. Numbered references that are too large result in this value being `0`. |
| 6464 | * |
| 6465 | * $1 # number `1` |
| 6466 | * |
| 6467 | * $5432 # number `5432` |
| 6468 | * |
| 6469 | * $4294967296 # number `0` |
| 6470 | */ |
| 6471 | uint32_t number; |
| 6472 | } pm_numbered_reference_read_node_t; |
| 6473 | |
| 6474 | /** |
| 6475 | * OptionalKeywordParameterNode |
| 6476 | * |
| 6477 | * Represents an optional keyword parameter to a method, block, or lambda definition. |
| 6478 | * |
| 6479 | * def a(b: 1) |
| 6480 | * ^^^^ |
| 6481 | * end |
| 6482 | * |
| 6483 | * Type: ::PM_OPTIONAL_KEYWORD_PARAMETER_NODE |
| 6484 | |
| 6485 | * Flags (#pm_parameter_flags): |
| 6486 | * * ::PM_PARAMETER_FLAGS_REPEATED_PARAMETER |
| 6487 | * |
| 6488 | * @extends pm_node_t |
| 6489 | */ |
| 6490 | typedef struct pm_optional_keyword_parameter_node { |
| 6491 | /** The embedded base node. */ |
| 6492 | pm_node_t base; |
| 6493 | |
| 6494 | |
| 6495 | /** |
| 6496 | * OptionalKeywordParameterNode#name |
| 6497 | */ |
| 6498 | pm_constant_id_t name; |
| 6499 | |
| 6500 | /** |
| 6501 | * OptionalKeywordParameterNode#name_loc |
| 6502 | */ |
| 6503 | pm_location_t name_loc; |
| 6504 | |
| 6505 | /** |
| 6506 | * OptionalKeywordParameterNode#value |
| 6507 | */ |
| 6508 | struct pm_node *value; |
| 6509 | } pm_optional_keyword_parameter_node_t; |
| 6510 | |
| 6511 | /** |
| 6512 | * OptionalParameterNode |
| 6513 | * |
| 6514 | * Represents an optional parameter to a method, block, or lambda definition. |
| 6515 | * |
| 6516 | * def a(b = 1) |
| 6517 | * ^^^^^ |
| 6518 | * end |
| 6519 | * |
| 6520 | * Type: ::PM_OPTIONAL_PARAMETER_NODE |
| 6521 | |
| 6522 | * Flags (#pm_parameter_flags): |
| 6523 | * * ::PM_PARAMETER_FLAGS_REPEATED_PARAMETER |
| 6524 | * |
| 6525 | * @extends pm_node_t |
| 6526 | */ |
| 6527 | typedef struct pm_optional_parameter_node { |
| 6528 | /** The embedded base node. */ |
| 6529 | pm_node_t base; |
| 6530 | |
| 6531 | |
| 6532 | /** |
| 6533 | * OptionalParameterNode#name |
| 6534 | */ |
| 6535 | pm_constant_id_t name; |
| 6536 | |
| 6537 | /** |
| 6538 | * OptionalParameterNode#name_loc |
| 6539 | */ |
| 6540 | pm_location_t name_loc; |
| 6541 | |
| 6542 | /** |
| 6543 | * OptionalParameterNode#operator_loc |
| 6544 | */ |
| 6545 | pm_location_t operator_loc; |
| 6546 | |
| 6547 | /** |
| 6548 | * OptionalParameterNode#value |
| 6549 | */ |
| 6550 | struct pm_node *value; |
| 6551 | } pm_optional_parameter_node_t; |
| 6552 | |
| 6553 | /** |
| 6554 | * OrNode |
| 6555 | * |
| 6556 | * Represents the use of the `||` operator or the `or` keyword. |
| 6557 | * |
| 6558 | * left or right |
| 6559 | * ^^^^^^^^^^^^^ |
| 6560 | * |
| 6561 | * Type: ::PM_OR_NODE |
| 6562 | * |
| 6563 | * @extends pm_node_t |
| 6564 | */ |
| 6565 | typedef struct pm_or_node { |
| 6566 | /** The embedded base node. */ |
| 6567 | pm_node_t base; |
| 6568 | |
| 6569 | |
| 6570 | /** |
| 6571 | * OrNode#left |
| 6572 | * |
| 6573 | * Represents the left side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 6574 | * |
| 6575 | * left or right |
| 6576 | * ^^^^ |
| 6577 | * |
| 6578 | * 1 || 2 |
| 6579 | * ^ |
| 6580 | */ |
| 6581 | struct pm_node *left; |
| 6582 | |
| 6583 | /** |
| 6584 | * OrNode#right |
| 6585 | * |
| 6586 | * Represents the right side of the expression. |
| 6587 | * |
| 6588 | * left || right |
| 6589 | * ^^^^^ |
| 6590 | * |
| 6591 | * 1 or 2 |
| 6592 | * ^ |
| 6593 | */ |
| 6594 | struct pm_node *right; |
| 6595 | |
| 6596 | /** |
| 6597 | * OrNode#operator_loc |
| 6598 | * |
| 6599 | * The location of the `or` keyword or the `||` operator. |
| 6600 | * |
| 6601 | * left or right |
| 6602 | * ^^ |
| 6603 | */ |
| 6604 | pm_location_t operator_loc; |
| 6605 | } pm_or_node_t; |
| 6606 | |
| 6607 | /** |
| 6608 | * ParametersNode |
| 6609 | * |
| 6610 | * Represents the list of parameters on a method, block, or lambda definition. |
| 6611 | * |
| 6612 | * def a(b, c, d) |
| 6613 | * ^^^^^^^ |
| 6614 | * end |
| 6615 | * |
| 6616 | * Type: ::PM_PARAMETERS_NODE |
| 6617 | * |
| 6618 | * @extends pm_node_t |
| 6619 | */ |
| 6620 | typedef struct pm_parameters_node { |
| 6621 | /** The embedded base node. */ |
| 6622 | pm_node_t base; |
| 6623 | |
| 6624 | |
| 6625 | /** |
| 6626 | * ParametersNode#requireds |
| 6627 | */ |
| 6628 | struct pm_node_list requireds; |
| 6629 | |
| 6630 | /** |
| 6631 | * ParametersNode#optionals |
| 6632 | */ |
| 6633 | struct pm_node_list optionals; |
| 6634 | |
| 6635 | /** |
| 6636 | * ParametersNode#rest |
| 6637 | */ |
| 6638 | struct pm_node *rest; |
| 6639 | |
| 6640 | /** |
| 6641 | * ParametersNode#posts |
| 6642 | */ |
| 6643 | struct pm_node_list posts; |
| 6644 | |
| 6645 | /** |
| 6646 | * ParametersNode#keywords |
| 6647 | */ |
| 6648 | struct pm_node_list keywords; |
| 6649 | |
| 6650 | /** |
| 6651 | * ParametersNode#keyword_rest |
| 6652 | */ |
| 6653 | struct pm_node *keyword_rest; |
| 6654 | |
| 6655 | /** |
| 6656 | * ParametersNode#block |
| 6657 | */ |
| 6658 | struct pm_block_parameter_node *block; |
| 6659 | } pm_parameters_node_t; |
| 6660 | |
| 6661 | /** |
| 6662 | * ParenthesesNode |
| 6663 | * |
| 6664 | * Represents a parenthesized expression |
| 6665 | * |
| 6666 | * (10 + 34) |
| 6667 | * ^^^^^^^^^ |
| 6668 | * |
| 6669 | * Type: ::PM_PARENTHESES_NODE |
| 6670 | |
| 6671 | * Flags (#pm_parentheses_node_flags): |
| 6672 | * * ::PM_PARENTHESES_NODE_FLAGS_MULTIPLE_STATEMENTS |
| 6673 | * |
| 6674 | * @extends pm_node_t |
| 6675 | */ |
| 6676 | typedef struct pm_parentheses_node { |
| 6677 | /** The embedded base node. */ |
| 6678 | pm_node_t base; |
| 6679 | |
| 6680 | |
| 6681 | /** |
| 6682 | * ParenthesesNode#body |
| 6683 | */ |
| 6684 | struct pm_node *body; |
| 6685 | |
| 6686 | /** |
| 6687 | * ParenthesesNode#opening_loc |
| 6688 | */ |
| 6689 | pm_location_t opening_loc; |
| 6690 | |
| 6691 | /** |
| 6692 | * ParenthesesNode#closing_loc |
| 6693 | */ |
| 6694 | pm_location_t closing_loc; |
| 6695 | } pm_parentheses_node_t; |
| 6696 | |
| 6697 | /** |
| 6698 | * PinnedExpressionNode |
| 6699 | * |
| 6700 | * Represents the use of the `^` operator for pinning an expression in a pattern matching expression. |
| 6701 | * |
| 6702 | * foo in ^(bar) |
| 6703 | * ^^^^^^ |
| 6704 | * |
| 6705 | * Type: ::PM_PINNED_EXPRESSION_NODE |
| 6706 | * |
| 6707 | * @extends pm_node_t |
| 6708 | */ |
| 6709 | typedef struct pm_pinned_expression_node { |
| 6710 | /** The embedded base node. */ |
| 6711 | pm_node_t base; |
| 6712 | |
| 6713 | |
| 6714 | /** |
| 6715 | * PinnedExpressionNode#expression |
| 6716 | * |
| 6717 | * The expression used in the pinned expression |
| 6718 | * |
| 6719 | * foo in ^(bar) |
| 6720 | * ^^^ |
| 6721 | */ |
| 6722 | struct pm_node *expression; |
| 6723 | |
| 6724 | /** |
| 6725 | * PinnedExpressionNode#operator_loc |
| 6726 | * |
| 6727 | * The location of the `^` operator |
| 6728 | * |
| 6729 | * foo in ^(bar) |
| 6730 | * ^ |
| 6731 | */ |
| 6732 | pm_location_t operator_loc; |
| 6733 | |
| 6734 | /** |
| 6735 | * PinnedExpressionNode#lparen_loc |
| 6736 | * |
| 6737 | * The location of the opening parenthesis. |
| 6738 | * |
| 6739 | * foo in ^(bar) |
| 6740 | * ^ |
| 6741 | */ |
| 6742 | pm_location_t lparen_loc; |
| 6743 | |
| 6744 | /** |
| 6745 | * PinnedExpressionNode#rparen_loc |
| 6746 | * |
| 6747 | * The location of the closing parenthesis. |
| 6748 | * |
| 6749 | * foo in ^(bar) |
| 6750 | * ^ |
| 6751 | */ |
| 6752 | pm_location_t rparen_loc; |
| 6753 | } pm_pinned_expression_node_t; |
| 6754 | |
| 6755 | /** |
| 6756 | * PinnedVariableNode |
| 6757 | * |
| 6758 | * Represents the use of the `^` operator for pinning a variable in a pattern matching expression. |
| 6759 | * |
| 6760 | * foo in ^bar |
| 6761 | * ^^^^ |
| 6762 | * |
| 6763 | * Type: ::PM_PINNED_VARIABLE_NODE |
| 6764 | * |
| 6765 | * @extends pm_node_t |
| 6766 | */ |
| 6767 | typedef struct pm_pinned_variable_node { |
| 6768 | /** The embedded base node. */ |
| 6769 | pm_node_t base; |
| 6770 | |
| 6771 | |
| 6772 | /** |
| 6773 | * PinnedVariableNode#variable |
| 6774 | * |
| 6775 | * The variable used in the pinned expression |
| 6776 | * |
| 6777 | * foo in ^bar |
| 6778 | * ^^^ |
| 6779 | */ |
| 6780 | struct pm_node *variable; |
| 6781 | |
| 6782 | /** |
| 6783 | * PinnedVariableNode#operator_loc |
| 6784 | * |
| 6785 | * The location of the `^` operator |
| 6786 | * |
| 6787 | * foo in ^bar |
| 6788 | * ^ |
| 6789 | */ |
| 6790 | pm_location_t operator_loc; |
| 6791 | } pm_pinned_variable_node_t; |
| 6792 | |
| 6793 | /** |
| 6794 | * PostExecutionNode |
| 6795 | * |
| 6796 | * Represents the use of the `END` keyword. |
| 6797 | * |
| 6798 | * END { foo } |
| 6799 | * ^^^^^^^^^^^ |
| 6800 | * |
| 6801 | * Type: ::PM_POST_EXECUTION_NODE |
| 6802 | * |
| 6803 | * @extends pm_node_t |
| 6804 | */ |
| 6805 | typedef struct pm_post_execution_node { |
| 6806 | /** The embedded base node. */ |
| 6807 | pm_node_t base; |
| 6808 | |
| 6809 | |
| 6810 | /** |
| 6811 | * PostExecutionNode#statements |
| 6812 | */ |
| 6813 | struct pm_statements_node *statements; |
| 6814 | |
| 6815 | /** |
| 6816 | * PostExecutionNode#keyword_loc |
| 6817 | */ |
| 6818 | pm_location_t keyword_loc; |
| 6819 | |
| 6820 | /** |
| 6821 | * PostExecutionNode#opening_loc |
| 6822 | */ |
| 6823 | pm_location_t opening_loc; |
| 6824 | |
| 6825 | /** |
| 6826 | * PostExecutionNode#closing_loc |
| 6827 | */ |
| 6828 | pm_location_t closing_loc; |
| 6829 | } pm_post_execution_node_t; |
| 6830 | |
| 6831 | /** |
| 6832 | * PreExecutionNode |
| 6833 | * |
| 6834 | * Represents the use of the `BEGIN` keyword. |
| 6835 | * |
| 6836 | * BEGIN { foo } |
| 6837 | * ^^^^^^^^^^^^^ |
| 6838 | * |
| 6839 | * Type: ::PM_PRE_EXECUTION_NODE |
| 6840 | * |
| 6841 | * @extends pm_node_t |
| 6842 | */ |
| 6843 | typedef struct pm_pre_execution_node { |
| 6844 | /** The embedded base node. */ |
| 6845 | pm_node_t base; |
| 6846 | |
| 6847 | |
| 6848 | /** |
| 6849 | * PreExecutionNode#statements |
| 6850 | */ |
| 6851 | struct pm_statements_node *statements; |
| 6852 | |
| 6853 | /** |
| 6854 | * PreExecutionNode#keyword_loc |
| 6855 | */ |
| 6856 | pm_location_t keyword_loc; |
| 6857 | |
| 6858 | /** |
| 6859 | * PreExecutionNode#opening_loc |
| 6860 | */ |
| 6861 | pm_location_t opening_loc; |
| 6862 | |
| 6863 | /** |
| 6864 | * PreExecutionNode#closing_loc |
| 6865 | */ |
| 6866 | pm_location_t closing_loc; |
| 6867 | } pm_pre_execution_node_t; |
| 6868 | |
| 6869 | /** |
| 6870 | * ProgramNode |
| 6871 | * |
| 6872 | * The top level node of any parse tree. |
| 6873 | * |
| 6874 | * Type: ::PM_PROGRAM_NODE |
| 6875 | * |
| 6876 | * @extends pm_node_t |
| 6877 | */ |
| 6878 | typedef struct pm_program_node { |
| 6879 | /** The embedded base node. */ |
| 6880 | pm_node_t base; |
| 6881 | |
| 6882 | |
| 6883 | /** |
| 6884 | * ProgramNode#locals |
| 6885 | */ |
| 6886 | pm_constant_id_list_t locals; |
| 6887 | |
| 6888 | /** |
| 6889 | * ProgramNode#statements |
| 6890 | */ |
| 6891 | struct pm_statements_node *statements; |
| 6892 | } pm_program_node_t; |
| 6893 | |
| 6894 | /** |
| 6895 | * RangeNode |
| 6896 | * |
| 6897 | * Represents the use of the `..` or `...` operators. |
| 6898 | * |
| 6899 | * 1..2 |
| 6900 | * ^^^^ |
| 6901 | * |
| 6902 | * c if a =~ /left/ ... b =~ /right/ |
| 6903 | * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 6904 | * |
| 6905 | * Type: ::PM_RANGE_NODE |
| 6906 | |
| 6907 | * Flags (#pm_range_flags): |
| 6908 | * * ::PM_RANGE_FLAGS_EXCLUDE_END |
| 6909 | * |
| 6910 | * @extends pm_node_t |
| 6911 | */ |
| 6912 | typedef struct pm_range_node { |
| 6913 | /** The embedded base node. */ |
| 6914 | pm_node_t base; |
| 6915 | |
| 6916 | |
| 6917 | /** |
| 6918 | * RangeNode#left |
| 6919 | * |
| 6920 | * The left-hand side of the range, if present. It can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 6921 | * |
| 6922 | * 1... |
| 6923 | * ^ |
| 6924 | * |
| 6925 | * hello...goodbye |
| 6926 | * ^^^^^ |
| 6927 | */ |
| 6928 | struct pm_node *left; |
| 6929 | |
| 6930 | /** |
| 6931 | * RangeNode#right |
| 6932 | * |
| 6933 | * The right-hand side of the range, if present. It can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 6934 | * |
| 6935 | * ..5 |
| 6936 | * ^ |
| 6937 | * |
| 6938 | * 1...foo |
| 6939 | * ^^^ |
| 6940 | * If neither right-hand or left-hand side was included, this will be a MissingNode. |
| 6941 | */ |
| 6942 | struct pm_node *right; |
| 6943 | |
| 6944 | /** |
| 6945 | * RangeNode#operator_loc |
| 6946 | * |
| 6947 | * The location of the `..` or `...` operator. |
| 6948 | */ |
| 6949 | pm_location_t operator_loc; |
| 6950 | } pm_range_node_t; |
| 6951 | |
| 6952 | /** |
| 6953 | * RationalNode |
| 6954 | * |
| 6955 | * Represents a rational number literal. |
| 6956 | * |
| 6957 | * 1.0r |
| 6958 | * ^^^^ |
| 6959 | * |
| 6960 | * Type: ::PM_RATIONAL_NODE |
| 6961 | |
| 6962 | * Flags (#pm_integer_base_flags): |
| 6963 | * * ::PM_INTEGER_BASE_FLAGS_BINARY |
| 6964 | * * ::PM_INTEGER_BASE_FLAGS_DECIMAL |
| 6965 | * * ::PM_INTEGER_BASE_FLAGS_OCTAL |
| 6966 | * * ::PM_INTEGER_BASE_FLAGS_HEXADECIMAL |
| 6967 | * |
| 6968 | * @extends pm_node_t |
| 6969 | */ |
| 6970 | typedef struct pm_rational_node { |
| 6971 | /** The embedded base node. */ |
| 6972 | pm_node_t base; |
| 6973 | |
| 6974 | |
| 6975 | /** |
| 6976 | * RationalNode#numerator |
| 6977 | * |
| 6978 | * The numerator of the rational number. |
| 6979 | * |
| 6980 | * 1.5r # numerator 3 |
| 6981 | */ |
| 6982 | pm_integer_t numerator; |
| 6983 | |
| 6984 | /** |
| 6985 | * RationalNode#denominator |
| 6986 | * |
| 6987 | * The denominator of the rational number. |
| 6988 | * |
| 6989 | * 1.5r # denominator 2 |
| 6990 | */ |
| 6991 | pm_integer_t denominator; |
| 6992 | } pm_rational_node_t; |
| 6993 | |
| 6994 | /** |
| 6995 | * RedoNode |
| 6996 | * |
| 6997 | * Represents the use of the `redo` keyword. |
| 6998 | * |
| 6999 | * redo |
| 7000 | * ^^^^ |
| 7001 | * |
| 7002 | * Type: ::PM_REDO_NODE |
| 7003 | * |
| 7004 | * @extends pm_node_t |
| 7005 | */ |
| 7006 | typedef struct pm_redo_node { |
| 7007 | /** The embedded base node. */ |
| 7008 | pm_node_t base; |
| 7009 | |
| 7010 | } pm_redo_node_t; |
| 7011 | |
| 7012 | /** |
| 7013 | * RegularExpressionNode |
| 7014 | * |
| 7015 | * Represents a regular expression literal with no interpolation. |
| 7016 | * |
| 7017 | * /foo/i |
| 7018 | * ^^^^^^ |
| 7019 | * |
| 7020 | * Type: ::PM_REGULAR_EXPRESSION_NODE |
| 7021 | |
| 7022 | * Flags (#pm_regular_expression_flags): |
| 7023 | * * ::PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE |
| 7024 | * * ::PM_REGULAR_EXPRESSION_FLAGS_EXTENDED |
| 7025 | * * ::PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE |
| 7026 | * * ::PM_REGULAR_EXPRESSION_FLAGS_ONCE |
| 7027 | * * ::PM_REGULAR_EXPRESSION_FLAGS_EUC_JP |
| 7028 | * * ::PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT |
| 7029 | * * ::PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J |
| 7030 | * * ::PM_REGULAR_EXPRESSION_FLAGS_UTF_8 |
| 7031 | * * ::PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING |
| 7032 | * * ::PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING |
| 7033 | * * ::PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING |
| 7034 | * |
| 7035 | * @extends pm_node_t |
| 7036 | */ |
| 7037 | typedef struct pm_regular_expression_node { |
| 7038 | /** The embedded base node. */ |
| 7039 | pm_node_t base; |
| 7040 | |
| 7041 | |
| 7042 | /** |
| 7043 | * RegularExpressionNode#opening_loc |
| 7044 | */ |
| 7045 | pm_location_t opening_loc; |
| 7046 | |
| 7047 | /** |
| 7048 | * RegularExpressionNode#content_loc |
| 7049 | */ |
| 7050 | pm_location_t content_loc; |
| 7051 | |
| 7052 | /** |
| 7053 | * RegularExpressionNode#closing_loc |
| 7054 | */ |
| 7055 | pm_location_t closing_loc; |
| 7056 | |
| 7057 | /** |
| 7058 | * RegularExpressionNode#unescaped |
| 7059 | */ |
| 7060 | pm_string_t unescaped; |
| 7061 | } pm_regular_expression_node_t; |
| 7062 | |
| 7063 | /** |
| 7064 | * RequiredKeywordParameterNode |
| 7065 | * |
| 7066 | * Represents a required keyword parameter to a method, block, or lambda definition. |
| 7067 | * |
| 7068 | * def a(b: ) |
| 7069 | * ^^ |
| 7070 | * end |
| 7071 | * |
| 7072 | * Type: ::PM_REQUIRED_KEYWORD_PARAMETER_NODE |
| 7073 | |
| 7074 | * Flags (#pm_parameter_flags): |
| 7075 | * * ::PM_PARAMETER_FLAGS_REPEATED_PARAMETER |
| 7076 | * |
| 7077 | * @extends pm_node_t |
| 7078 | */ |
| 7079 | typedef struct pm_required_keyword_parameter_node { |
| 7080 | /** The embedded base node. */ |
| 7081 | pm_node_t base; |
| 7082 | |
| 7083 | |
| 7084 | /** |
| 7085 | * RequiredKeywordParameterNode#name |
| 7086 | */ |
| 7087 | pm_constant_id_t name; |
| 7088 | |
| 7089 | /** |
| 7090 | * RequiredKeywordParameterNode#name_loc |
| 7091 | */ |
| 7092 | pm_location_t name_loc; |
| 7093 | } pm_required_keyword_parameter_node_t; |
| 7094 | |
| 7095 | /** |
| 7096 | * RequiredParameterNode |
| 7097 | * |
| 7098 | * Represents a required parameter to a method, block, or lambda definition. |
| 7099 | * |
| 7100 | * def a(b) |
| 7101 | * ^ |
| 7102 | * end |
| 7103 | * |
| 7104 | * Type: ::PM_REQUIRED_PARAMETER_NODE |
| 7105 | |
| 7106 | * Flags (#pm_parameter_flags): |
| 7107 | * * ::PM_PARAMETER_FLAGS_REPEATED_PARAMETER |
| 7108 | * |
| 7109 | * @extends pm_node_t |
| 7110 | */ |
| 7111 | typedef struct pm_required_parameter_node { |
| 7112 | /** The embedded base node. */ |
| 7113 | pm_node_t base; |
| 7114 | |
| 7115 | |
| 7116 | /** |
| 7117 | * RequiredParameterNode#name |
| 7118 | */ |
| 7119 | pm_constant_id_t name; |
| 7120 | } pm_required_parameter_node_t; |
| 7121 | |
| 7122 | /** |
| 7123 | * RescueModifierNode |
| 7124 | * |
| 7125 | * Represents an expression modified with a rescue. |
| 7126 | * |
| 7127 | * foo rescue nil |
| 7128 | * ^^^^^^^^^^^^^^ |
| 7129 | * |
| 7130 | * Type: ::PM_RESCUE_MODIFIER_NODE |
| 7131 | * |
| 7132 | * @extends pm_node_t |
| 7133 | */ |
| 7134 | typedef struct pm_rescue_modifier_node { |
| 7135 | /** The embedded base node. */ |
| 7136 | pm_node_t base; |
| 7137 | |
| 7138 | |
| 7139 | /** |
| 7140 | * RescueModifierNode#expression |
| 7141 | */ |
| 7142 | struct pm_node *expression; |
| 7143 | |
| 7144 | /** |
| 7145 | * RescueModifierNode#keyword_loc |
| 7146 | */ |
| 7147 | pm_location_t keyword_loc; |
| 7148 | |
| 7149 | /** |
| 7150 | * RescueModifierNode#rescue_expression |
| 7151 | */ |
| 7152 | struct pm_node *rescue_expression; |
| 7153 | } pm_rescue_modifier_node_t; |
| 7154 | |
| 7155 | /** |
| 7156 | * RescueNode |
| 7157 | * |
| 7158 | * Represents a rescue statement. |
| 7159 | * |
| 7160 | * begin |
| 7161 | * rescue Foo, *splat, Bar => ex |
| 7162 | * foo |
| 7163 | * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 7164 | * end |
| 7165 | * |
| 7166 | * `Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `reference` field. |
| 7167 | * |
| 7168 | * Type: ::PM_RESCUE_NODE |
| 7169 | * |
| 7170 | * @extends pm_node_t |
| 7171 | */ |
| 7172 | typedef struct pm_rescue_node { |
| 7173 | /** The embedded base node. */ |
| 7174 | pm_node_t base; |
| 7175 | |
| 7176 | |
| 7177 | /** |
| 7178 | * RescueNode#keyword_loc |
| 7179 | */ |
| 7180 | pm_location_t keyword_loc; |
| 7181 | |
| 7182 | /** |
| 7183 | * RescueNode#exceptions |
| 7184 | */ |
| 7185 | struct pm_node_list exceptions; |
| 7186 | |
| 7187 | /** |
| 7188 | * RescueNode#operator_loc |
| 7189 | */ |
| 7190 | pm_location_t operator_loc; |
| 7191 | |
| 7192 | /** |
| 7193 | * RescueNode#reference |
| 7194 | */ |
| 7195 | struct pm_node *reference; |
| 7196 | |
| 7197 | /** |
| 7198 | * RescueNode#then_keyword_loc |
| 7199 | */ |
| 7200 | pm_location_t then_keyword_loc; |
| 7201 | |
| 7202 | /** |
| 7203 | * RescueNode#statements |
| 7204 | */ |
| 7205 | struct pm_statements_node *statements; |
| 7206 | |
| 7207 | /** |
| 7208 | * RescueNode#subsequent |
| 7209 | */ |
| 7210 | struct pm_rescue_node *subsequent; |
| 7211 | } pm_rescue_node_t; |
| 7212 | |
| 7213 | /** |
| 7214 | * RestParameterNode |
| 7215 | * |
| 7216 | * Represents a rest parameter to a method, block, or lambda definition. |
| 7217 | * |
| 7218 | * def a(*b) |
| 7219 | * ^^ |
| 7220 | * end |
| 7221 | * |
| 7222 | * Type: ::PM_REST_PARAMETER_NODE |
| 7223 | |
| 7224 | * Flags (#pm_parameter_flags): |
| 7225 | * * ::PM_PARAMETER_FLAGS_REPEATED_PARAMETER |
| 7226 | * |
| 7227 | * @extends pm_node_t |
| 7228 | */ |
| 7229 | typedef struct pm_rest_parameter_node { |
| 7230 | /** The embedded base node. */ |
| 7231 | pm_node_t base; |
| 7232 | |
| 7233 | |
| 7234 | /** |
| 7235 | * RestParameterNode#name |
| 7236 | */ |
| 7237 | pm_constant_id_t name; |
| 7238 | |
| 7239 | /** |
| 7240 | * RestParameterNode#name_loc |
| 7241 | */ |
| 7242 | pm_location_t name_loc; |
| 7243 | |
| 7244 | /** |
| 7245 | * RestParameterNode#operator_loc |
| 7246 | */ |
| 7247 | pm_location_t operator_loc; |
| 7248 | } pm_rest_parameter_node_t; |
| 7249 | |
| 7250 | /** |
| 7251 | * RetryNode |
| 7252 | * |
| 7253 | * Represents the use of the `retry` keyword. |
| 7254 | * |
| 7255 | * retry |
| 7256 | * ^^^^^ |
| 7257 | * |
| 7258 | * Type: ::PM_RETRY_NODE |
| 7259 | * |
| 7260 | * @extends pm_node_t |
| 7261 | */ |
| 7262 | typedef struct pm_retry_node { |
| 7263 | /** The embedded base node. */ |
| 7264 | pm_node_t base; |
| 7265 | |
| 7266 | } pm_retry_node_t; |
| 7267 | |
| 7268 | /** |
| 7269 | * ReturnNode |
| 7270 | * |
| 7271 | * Represents the use of the `return` keyword. |
| 7272 | * |
| 7273 | * return 1 |
| 7274 | * ^^^^^^^^ |
| 7275 | * |
| 7276 | * Type: ::PM_RETURN_NODE |
| 7277 | * |
| 7278 | * @extends pm_node_t |
| 7279 | */ |
| 7280 | typedef struct pm_return_node { |
| 7281 | /** The embedded base node. */ |
| 7282 | pm_node_t base; |
| 7283 | |
| 7284 | |
| 7285 | /** |
| 7286 | * ReturnNode#keyword_loc |
| 7287 | */ |
| 7288 | pm_location_t keyword_loc; |
| 7289 | |
| 7290 | /** |
| 7291 | * ReturnNode#arguments |
| 7292 | */ |
| 7293 | struct pm_arguments_node *arguments; |
| 7294 | } pm_return_node_t; |
| 7295 | |
| 7296 | /** |
| 7297 | * SelfNode |
| 7298 | * |
| 7299 | * Represents the `self` keyword. |
| 7300 | * |
| 7301 | * self |
| 7302 | * ^^^^ |
| 7303 | * |
| 7304 | * Type: ::PM_SELF_NODE |
| 7305 | * |
| 7306 | * @extends pm_node_t |
| 7307 | */ |
| 7308 | typedef struct pm_self_node { |
| 7309 | /** The embedded base node. */ |
| 7310 | pm_node_t base; |
| 7311 | |
| 7312 | } pm_self_node_t; |
| 7313 | |
| 7314 | /** |
| 7315 | * ShareableConstantNode |
| 7316 | * |
| 7317 | * This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified. |
| 7318 | * |
| 7319 | * # shareable_constant_value: literal |
| 7320 | * C = { a: 1 } |
| 7321 | * ^^^^^^^^^^^^ |
| 7322 | * |
| 7323 | * Type: ::PM_SHAREABLE_CONSTANT_NODE |
| 7324 | |
| 7325 | * Flags (#pm_shareable_constant_node_flags): |
| 7326 | * * ::PM_SHAREABLE_CONSTANT_NODE_FLAGS_LITERAL |
| 7327 | * * ::PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_EVERYTHING |
| 7328 | * * ::PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_COPY |
| 7329 | * |
| 7330 | * @extends pm_node_t |
| 7331 | */ |
| 7332 | typedef struct pm_shareable_constant_node { |
| 7333 | /** The embedded base node. */ |
| 7334 | pm_node_t base; |
| 7335 | |
| 7336 | |
| 7337 | /** |
| 7338 | * ShareableConstantNode#write |
| 7339 | * |
| 7340 | * The constant write that should be modified with the shareability state. |
| 7341 | */ |
| 7342 | struct pm_node *write; |
| 7343 | } pm_shareable_constant_node_t; |
| 7344 | |
| 7345 | /** |
| 7346 | * SingletonClassNode |
| 7347 | * |
| 7348 | * Represents a singleton class declaration involving the `class` keyword. |
| 7349 | * |
| 7350 | * class << self end |
| 7351 | * ^^^^^^^^^^^^^^^^^ |
| 7352 | * |
| 7353 | * Type: ::PM_SINGLETON_CLASS_NODE |
| 7354 | * |
| 7355 | * @extends pm_node_t |
| 7356 | */ |
| 7357 | typedef struct pm_singleton_class_node { |
| 7358 | /** The embedded base node. */ |
| 7359 | pm_node_t base; |
| 7360 | |
| 7361 | |
| 7362 | /** |
| 7363 | * SingletonClassNode#locals |
| 7364 | */ |
| 7365 | pm_constant_id_list_t locals; |
| 7366 | |
| 7367 | /** |
| 7368 | * SingletonClassNode#class_keyword_loc |
| 7369 | */ |
| 7370 | pm_location_t class_keyword_loc; |
| 7371 | |
| 7372 | /** |
| 7373 | * SingletonClassNode#operator_loc |
| 7374 | */ |
| 7375 | pm_location_t operator_loc; |
| 7376 | |
| 7377 | /** |
| 7378 | * SingletonClassNode#expression |
| 7379 | */ |
| 7380 | struct pm_node *expression; |
| 7381 | |
| 7382 | /** |
| 7383 | * SingletonClassNode#body |
| 7384 | */ |
| 7385 | struct pm_node *body; |
| 7386 | |
| 7387 | /** |
| 7388 | * SingletonClassNode#end_keyword_loc |
| 7389 | */ |
| 7390 | pm_location_t end_keyword_loc; |
| 7391 | } pm_singleton_class_node_t; |
| 7392 | |
| 7393 | /** |
| 7394 | * SourceEncodingNode |
| 7395 | * |
| 7396 | * Represents the use of the `__ENCODING__` keyword. |
| 7397 | * |
| 7398 | * __ENCODING__ |
| 7399 | * ^^^^^^^^^^^^ |
| 7400 | * |
| 7401 | * Type: ::PM_SOURCE_ENCODING_NODE |
| 7402 | * |
| 7403 | * @extends pm_node_t |
| 7404 | */ |
| 7405 | typedef struct pm_source_encoding_node { |
| 7406 | /** The embedded base node. */ |
| 7407 | pm_node_t base; |
| 7408 | |
| 7409 | } pm_source_encoding_node_t; |
| 7410 | |
| 7411 | /** |
| 7412 | * SourceFileNode |
| 7413 | * |
| 7414 | * Represents the use of the `__FILE__` keyword. |
| 7415 | * |
| 7416 | * __FILE__ |
| 7417 | * ^^^^^^^^ |
| 7418 | * |
| 7419 | * Type: ::PM_SOURCE_FILE_NODE |
| 7420 | |
| 7421 | * Flags (#pm_string_flags): |
| 7422 | * * ::PM_STRING_FLAGS_FORCED_UTF8_ENCODING |
| 7423 | * * ::PM_STRING_FLAGS_FORCED_BINARY_ENCODING |
| 7424 | * * ::PM_STRING_FLAGS_FROZEN |
| 7425 | * * ::PM_STRING_FLAGS_MUTABLE |
| 7426 | * |
| 7427 | * @extends pm_node_t |
| 7428 | */ |
| 7429 | typedef struct pm_source_file_node { |
| 7430 | /** The embedded base node. */ |
| 7431 | pm_node_t base; |
| 7432 | |
| 7433 | |
| 7434 | /** |
| 7435 | * SourceFileNode#filepath |
| 7436 | * |
| 7437 | * Represents the file path being parsed. This corresponds directly to the `filepath` option given to the various `Prism::parse*` APIs. |
| 7438 | */ |
| 7439 | pm_string_t filepath; |
| 7440 | } pm_source_file_node_t; |
| 7441 | |
| 7442 | /** |
| 7443 | * SourceLineNode |
| 7444 | * |
| 7445 | * Represents the use of the `__LINE__` keyword. |
| 7446 | * |
| 7447 | * __LINE__ |
| 7448 | * ^^^^^^^^ |
| 7449 | * |
| 7450 | * Type: ::PM_SOURCE_LINE_NODE |
| 7451 | * |
| 7452 | * @extends pm_node_t |
| 7453 | */ |
| 7454 | typedef struct pm_source_line_node { |
| 7455 | /** The embedded base node. */ |
| 7456 | pm_node_t base; |
| 7457 | |
| 7458 | } pm_source_line_node_t; |
| 7459 | |
| 7460 | /** |
| 7461 | * SplatNode |
| 7462 | * |
| 7463 | * Represents the use of the splat operator. |
| 7464 | * |
| 7465 | * [*a] |
| 7466 | * ^^ |
| 7467 | * |
| 7468 | * Type: ::PM_SPLAT_NODE |
| 7469 | * |
| 7470 | * @extends pm_node_t |
| 7471 | */ |
| 7472 | typedef struct pm_splat_node { |
| 7473 | /** The embedded base node. */ |
| 7474 | pm_node_t base; |
| 7475 | |
| 7476 | |
| 7477 | /** |
| 7478 | * SplatNode#operator_loc |
| 7479 | */ |
| 7480 | pm_location_t operator_loc; |
| 7481 | |
| 7482 | /** |
| 7483 | * SplatNode#expression |
| 7484 | */ |
| 7485 | struct pm_node *expression; |
| 7486 | } pm_splat_node_t; |
| 7487 | |
| 7488 | /** |
| 7489 | * StatementsNode |
| 7490 | * |
| 7491 | * Represents a set of statements contained within some scope. |
| 7492 | * |
| 7493 | * foo; bar; baz |
| 7494 | * ^^^^^^^^^^^^^ |
| 7495 | * |
| 7496 | * Type: ::PM_STATEMENTS_NODE |
| 7497 | * |
| 7498 | * @extends pm_node_t |
| 7499 | */ |
| 7500 | typedef struct pm_statements_node { |
| 7501 | /** The embedded base node. */ |
| 7502 | pm_node_t base; |
| 7503 | |
| 7504 | |
| 7505 | /** |
| 7506 | * StatementsNode#body |
| 7507 | */ |
| 7508 | struct pm_node_list body; |
| 7509 | } pm_statements_node_t; |
| 7510 | |
| 7511 | /** |
| 7512 | * StringNode |
| 7513 | * |
| 7514 | * Represents a string literal, a string contained within a `%w` list, or plain string content within an interpolated string. |
| 7515 | * |
| 7516 | * "foo" |
| 7517 | * ^^^^^ |
| 7518 | * |
| 7519 | * %w[foo] |
| 7520 | * ^^^ |
| 7521 | * |
| 7522 | * "foo #{bar} baz" |
| 7523 | * ^^^^ ^^^^ |
| 7524 | * |
| 7525 | * Type: ::PM_STRING_NODE |
| 7526 | |
| 7527 | * Flags (#pm_string_flags): |
| 7528 | * * ::PM_STRING_FLAGS_FORCED_UTF8_ENCODING |
| 7529 | * * ::PM_STRING_FLAGS_FORCED_BINARY_ENCODING |
| 7530 | * * ::PM_STRING_FLAGS_FROZEN |
| 7531 | * * ::PM_STRING_FLAGS_MUTABLE |
| 7532 | * |
| 7533 | * @extends pm_node_t |
| 7534 | */ |
| 7535 | typedef struct pm_string_node { |
| 7536 | /** The embedded base node. */ |
| 7537 | pm_node_t base; |
| 7538 | |
| 7539 | |
| 7540 | /** |
| 7541 | * StringNode#opening_loc |
| 7542 | */ |
| 7543 | pm_location_t opening_loc; |
| 7544 | |
| 7545 | /** |
| 7546 | * StringNode#content_loc |
| 7547 | */ |
| 7548 | pm_location_t content_loc; |
| 7549 | |
| 7550 | /** |
| 7551 | * StringNode#closing_loc |
| 7552 | */ |
| 7553 | pm_location_t closing_loc; |
| 7554 | |
| 7555 | /** |
| 7556 | * StringNode#unescaped |
| 7557 | */ |
| 7558 | pm_string_t unescaped; |
| 7559 | } pm_string_node_t; |
| 7560 | |
| 7561 | /** |
| 7562 | * SuperNode |
| 7563 | * |
| 7564 | * Represents the use of the `super` keyword with parentheses or arguments. |
| 7565 | * |
| 7566 | * super() |
| 7567 | * ^^^^^^^ |
| 7568 | * |
| 7569 | * super foo, bar |
| 7570 | * ^^^^^^^^^^^^^^ |
| 7571 | * |
| 7572 | * If no arguments are provided (except for a block), it would be a `ForwardingSuperNode` instead. |
| 7573 | * |
| 7574 | * Type: ::PM_SUPER_NODE |
| 7575 | * |
| 7576 | * @extends pm_node_t |
| 7577 | */ |
| 7578 | typedef struct pm_super_node { |
| 7579 | /** The embedded base node. */ |
| 7580 | pm_node_t base; |
| 7581 | |
| 7582 | |
| 7583 | /** |
| 7584 | * SuperNode#keyword_loc |
| 7585 | */ |
| 7586 | pm_location_t keyword_loc; |
| 7587 | |
| 7588 | /** |
| 7589 | * SuperNode#lparen_loc |
| 7590 | */ |
| 7591 | pm_location_t lparen_loc; |
| 7592 | |
| 7593 | /** |
| 7594 | * SuperNode#arguments |
| 7595 | * |
| 7596 | * Can be only `nil` when there are empty parentheses, like `super()`. |
| 7597 | */ |
| 7598 | struct pm_arguments_node *arguments; |
| 7599 | |
| 7600 | /** |
| 7601 | * SuperNode#rparen_loc |
| 7602 | */ |
| 7603 | pm_location_t rparen_loc; |
| 7604 | |
| 7605 | /** |
| 7606 | * SuperNode#block |
| 7607 | */ |
| 7608 | struct pm_node *block; |
| 7609 | } pm_super_node_t; |
| 7610 | |
| 7611 | /** |
| 7612 | * SymbolNode |
| 7613 | * |
| 7614 | * Represents a symbol literal or a symbol contained within a `%i` list. |
| 7615 | * |
| 7616 | * :foo |
| 7617 | * ^^^^ |
| 7618 | * |
| 7619 | * %i[foo] |
| 7620 | * ^^^ |
| 7621 | * |
| 7622 | * Type: ::PM_SYMBOL_NODE |
| 7623 | |
| 7624 | * Flags (#pm_symbol_flags): |
| 7625 | * * ::PM_SYMBOL_FLAGS_FORCED_UTF8_ENCODING |
| 7626 | * * ::PM_SYMBOL_FLAGS_FORCED_BINARY_ENCODING |
| 7627 | * * ::PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING |
| 7628 | * |
| 7629 | * @extends pm_node_t |
| 7630 | */ |
| 7631 | typedef struct pm_symbol_node { |
| 7632 | /** The embedded base node. */ |
| 7633 | pm_node_t base; |
| 7634 | |
| 7635 | |
| 7636 | /** |
| 7637 | * SymbolNode#opening_loc |
| 7638 | */ |
| 7639 | pm_location_t opening_loc; |
| 7640 | |
| 7641 | /** |
| 7642 | * SymbolNode#value_loc |
| 7643 | */ |
| 7644 | pm_location_t value_loc; |
| 7645 | |
| 7646 | /** |
| 7647 | * SymbolNode#closing_loc |
| 7648 | */ |
| 7649 | pm_location_t closing_loc; |
| 7650 | |
| 7651 | /** |
| 7652 | * SymbolNode#unescaped |
| 7653 | */ |
| 7654 | pm_string_t unescaped; |
| 7655 | } pm_symbol_node_t; |
| 7656 | |
| 7657 | /** |
| 7658 | * TrueNode |
| 7659 | * |
| 7660 | * Represents the use of the literal `true` keyword. |
| 7661 | * |
| 7662 | * true |
| 7663 | * ^^^^ |
| 7664 | * |
| 7665 | * Type: ::PM_TRUE_NODE |
| 7666 | * |
| 7667 | * @extends pm_node_t |
| 7668 | */ |
| 7669 | typedef struct pm_true_node { |
| 7670 | /** The embedded base node. */ |
| 7671 | pm_node_t base; |
| 7672 | |
| 7673 | } pm_true_node_t; |
| 7674 | |
| 7675 | /** |
| 7676 | * UndefNode |
| 7677 | * |
| 7678 | * Represents the use of the `undef` keyword. |
| 7679 | * |
| 7680 | * undef :foo, :bar, :baz |
| 7681 | * ^^^^^^^^^^^^^^^^^^^^^^ |
| 7682 | * |
| 7683 | * Type: ::PM_UNDEF_NODE |
| 7684 | * |
| 7685 | * @extends pm_node_t |
| 7686 | */ |
| 7687 | typedef struct pm_undef_node { |
| 7688 | /** The embedded base node. */ |
| 7689 | pm_node_t base; |
| 7690 | |
| 7691 | |
| 7692 | /** |
| 7693 | * UndefNode#names |
| 7694 | */ |
| 7695 | struct pm_node_list names; |
| 7696 | |
| 7697 | /** |
| 7698 | * UndefNode#keyword_loc |
| 7699 | */ |
| 7700 | pm_location_t keyword_loc; |
| 7701 | } pm_undef_node_t; |
| 7702 | |
| 7703 | /** |
| 7704 | * UnlessNode |
| 7705 | * |
| 7706 | * Represents the use of the `unless` keyword, either in the block form or the modifier form. |
| 7707 | * |
| 7708 | * bar unless foo |
| 7709 | * ^^^^^^^^^^^^^^ |
| 7710 | * |
| 7711 | * unless foo then bar end |
| 7712 | * ^^^^^^^^^^^^^^^^^^^^^^^ |
| 7713 | * |
| 7714 | * Type: ::PM_UNLESS_NODE |
| 7715 | * |
| 7716 | * @extends pm_node_t |
| 7717 | */ |
| 7718 | typedef struct pm_unless_node { |
| 7719 | /** The embedded base node. */ |
| 7720 | pm_node_t base; |
| 7721 | |
| 7722 | |
| 7723 | /** |
| 7724 | * UnlessNode#keyword_loc |
| 7725 | * |
| 7726 | * The location of the `unless` keyword. |
| 7727 | * |
| 7728 | * unless cond then bar end |
| 7729 | * ^^^^^^ |
| 7730 | * |
| 7731 | * bar unless cond |
| 7732 | * ^^^^^^ |
| 7733 | */ |
| 7734 | pm_location_t keyword_loc; |
| 7735 | |
| 7736 | /** |
| 7737 | * UnlessNode#predicate |
| 7738 | * |
| 7739 | * The condition to be evaluated for the unless expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). |
| 7740 | * |
| 7741 | * unless cond then bar end |
| 7742 | * ^^^^ |
| 7743 | * |
| 7744 | * bar unless cond |
| 7745 | * ^^^^ |
| 7746 | */ |
| 7747 | struct pm_node *predicate; |
| 7748 | |
| 7749 | /** |
| 7750 | * UnlessNode#then_keyword_loc |
| 7751 | * |
| 7752 | * The location of the `then` keyword, if present. |
| 7753 | * |
| 7754 | * unless cond then bar end |
| 7755 | * ^^^^ |
| 7756 | */ |
| 7757 | pm_location_t then_keyword_loc; |
| 7758 | |
| 7759 | /** |
| 7760 | * UnlessNode#statements |
| 7761 | * |
| 7762 | * The body of statements that will executed if the unless condition is |
| 7763 | * falsey. Will be `nil` if no body is provided. |
| 7764 | * |
| 7765 | * unless cond then bar end |
| 7766 | * ^^^ |
| 7767 | */ |
| 7768 | struct pm_statements_node *statements; |
| 7769 | |
| 7770 | /** |
| 7771 | * UnlessNode#else_clause |
| 7772 | * |
| 7773 | * The else clause of the unless expression, if present. |
| 7774 | * |
| 7775 | * unless cond then bar else baz end |
| 7776 | * ^^^^^^^^ |
| 7777 | */ |
| 7778 | struct pm_else_node *else_clause; |
| 7779 | |
| 7780 | /** |
| 7781 | * UnlessNode#end_keyword_loc |
| 7782 | * |
| 7783 | * The location of the `end` keyword, if present. |
| 7784 | * |
| 7785 | * unless cond then bar end |
| 7786 | * ^^^ |
| 7787 | */ |
| 7788 | pm_location_t end_keyword_loc; |
| 7789 | } pm_unless_node_t; |
| 7790 | |
| 7791 | /** |
| 7792 | * UntilNode |
| 7793 | * |
| 7794 | * Represents the use of the `until` keyword, either in the block form or the modifier form. |
| 7795 | * |
| 7796 | * bar until foo |
| 7797 | * ^^^^^^^^^^^^^ |
| 7798 | * |
| 7799 | * until foo do bar end |
| 7800 | * ^^^^^^^^^^^^^^^^^^^^ |
| 7801 | * |
| 7802 | * Type: ::PM_UNTIL_NODE |
| 7803 | |
| 7804 | * Flags (#pm_loop_flags): |
| 7805 | * * ::PM_LOOP_FLAGS_BEGIN_MODIFIER |
| 7806 | * |
| 7807 | * @extends pm_node_t |
| 7808 | */ |
| 7809 | typedef struct pm_until_node { |
| 7810 | /** The embedded base node. */ |
| 7811 | pm_node_t base; |
| 7812 | |
| 7813 | |
| 7814 | /** |
| 7815 | * UntilNode#keyword_loc |
| 7816 | */ |
| 7817 | pm_location_t keyword_loc; |
| 7818 | |
| 7819 | /** |
| 7820 | * UntilNode#do_keyword_loc |
| 7821 | */ |
| 7822 | pm_location_t do_keyword_loc; |
| 7823 | |
| 7824 | /** |
| 7825 | * UntilNode#closing_loc |
| 7826 | */ |
| 7827 | pm_location_t closing_loc; |
| 7828 | |
| 7829 | /** |
| 7830 | * UntilNode#predicate |
| 7831 | */ |
| 7832 | struct pm_node *predicate; |
| 7833 | |
| 7834 | /** |
| 7835 | * UntilNode#statements |
| 7836 | */ |
| 7837 | struct pm_statements_node *statements; |
| 7838 | } pm_until_node_t; |
| 7839 | |
| 7840 | /** |
| 7841 | * WhenNode |
| 7842 | * |
| 7843 | * Represents the use of the `when` keyword within a case statement. |
| 7844 | * |
| 7845 | * case true |
| 7846 | * when true |
| 7847 | * ^^^^^^^^^ |
| 7848 | * end |
| 7849 | * |
| 7850 | * Type: ::PM_WHEN_NODE |
| 7851 | * |
| 7852 | * @extends pm_node_t |
| 7853 | */ |
| 7854 | typedef struct pm_when_node { |
| 7855 | /** The embedded base node. */ |
| 7856 | pm_node_t base; |
| 7857 | |
| 7858 | |
| 7859 | /** |
| 7860 | * WhenNode#keyword_loc |
| 7861 | */ |
| 7862 | pm_location_t keyword_loc; |
| 7863 | |
| 7864 | /** |
| 7865 | * WhenNode#conditions |
| 7866 | */ |
| 7867 | struct pm_node_list conditions; |
| 7868 | |
| 7869 | /** |
| 7870 | * WhenNode#then_keyword_loc |
| 7871 | */ |
| 7872 | pm_location_t then_keyword_loc; |
| 7873 | |
| 7874 | /** |
| 7875 | * WhenNode#statements |
| 7876 | */ |
| 7877 | struct pm_statements_node *statements; |
| 7878 | } pm_when_node_t; |
| 7879 | |
| 7880 | /** |
| 7881 | * WhileNode |
| 7882 | * |
| 7883 | * Represents the use of the `while` keyword, either in the block form or the modifier form. |
| 7884 | * |
| 7885 | * bar while foo |
| 7886 | * ^^^^^^^^^^^^^ |
| 7887 | * |
| 7888 | * while foo do bar end |
| 7889 | * ^^^^^^^^^^^^^^^^^^^^ |
| 7890 | * |
| 7891 | * Type: ::PM_WHILE_NODE |
| 7892 | |
| 7893 | * Flags (#pm_loop_flags): |
| 7894 | * * ::PM_LOOP_FLAGS_BEGIN_MODIFIER |
| 7895 | * |
| 7896 | * @extends pm_node_t |
| 7897 | */ |
| 7898 | typedef struct pm_while_node { |
| 7899 | /** The embedded base node. */ |
| 7900 | pm_node_t base; |
| 7901 | |
| 7902 | |
| 7903 | /** |
| 7904 | * WhileNode#keyword_loc |
| 7905 | */ |
| 7906 | pm_location_t keyword_loc; |
| 7907 | |
| 7908 | /** |
| 7909 | * WhileNode#do_keyword_loc |
| 7910 | */ |
| 7911 | pm_location_t do_keyword_loc; |
| 7912 | |
| 7913 | /** |
| 7914 | * WhileNode#closing_loc |
| 7915 | */ |
| 7916 | pm_location_t closing_loc; |
| 7917 | |
| 7918 | /** |
| 7919 | * WhileNode#predicate |
| 7920 | */ |
| 7921 | struct pm_node *predicate; |
| 7922 | |
| 7923 | /** |
| 7924 | * WhileNode#statements |
| 7925 | */ |
| 7926 | struct pm_statements_node *statements; |
| 7927 | } pm_while_node_t; |
| 7928 | |
| 7929 | /** |
| 7930 | * XStringNode |
| 7931 | * |
| 7932 | * Represents an xstring literal with no interpolation. |
| 7933 | * |
| 7934 | * `foo` |
| 7935 | * ^^^^^ |
| 7936 | * |
| 7937 | * Type: ::PM_X_STRING_NODE |
| 7938 | |
| 7939 | * Flags (#pm_encoding_flags): |
| 7940 | * * ::PM_ENCODING_FLAGS_FORCED_UTF8_ENCODING |
| 7941 | * * ::PM_ENCODING_FLAGS_FORCED_BINARY_ENCODING |
| 7942 | * |
| 7943 | * @extends pm_node_t |
| 7944 | */ |
| 7945 | typedef struct pm_x_string_node { |
| 7946 | /** The embedded base node. */ |
| 7947 | pm_node_t base; |
| 7948 | |
| 7949 | |
| 7950 | /** |
| 7951 | * XStringNode#opening_loc |
| 7952 | */ |
| 7953 | pm_location_t opening_loc; |
| 7954 | |
| 7955 | /** |
| 7956 | * XStringNode#content_loc |
| 7957 | */ |
| 7958 | pm_location_t content_loc; |
| 7959 | |
| 7960 | /** |
| 7961 | * XStringNode#closing_loc |
| 7962 | */ |
| 7963 | pm_location_t closing_loc; |
| 7964 | |
| 7965 | /** |
| 7966 | * XStringNode#unescaped |
| 7967 | */ |
| 7968 | pm_string_t unescaped; |
| 7969 | } pm_x_string_node_t; |
| 7970 | |
| 7971 | /** |
| 7972 | * YieldNode |
| 7973 | * |
| 7974 | * Represents the use of the `yield` keyword. |
| 7975 | * |
| 7976 | * yield 1 |
| 7977 | * ^^^^^^^ |
| 7978 | * |
| 7979 | * Type: ::PM_YIELD_NODE |
| 7980 | * |
| 7981 | * @extends pm_node_t |
| 7982 | */ |
| 7983 | typedef struct pm_yield_node { |
| 7984 | /** The embedded base node. */ |
| 7985 | pm_node_t base; |
| 7986 | |
| 7987 | |
| 7988 | /** |
| 7989 | * YieldNode#keyword_loc |
| 7990 | */ |
| 7991 | pm_location_t keyword_loc; |
| 7992 | |
| 7993 | /** |
| 7994 | * YieldNode#lparen_loc |
| 7995 | */ |
| 7996 | pm_location_t lparen_loc; |
| 7997 | |
| 7998 | /** |
| 7999 | * YieldNode#arguments |
| 8000 | */ |
| 8001 | struct pm_arguments_node *arguments; |
| 8002 | |
| 8003 | /** |
| 8004 | * YieldNode#rparen_loc |
| 8005 | */ |
| 8006 | pm_location_t rparen_loc; |
| 8007 | } pm_yield_node_t; |
| 8008 | |
| 8009 | /** |
| 8010 | * Flags for arguments nodes. |
| 8011 | */ |
| 8012 | typedef enum pm_arguments_node_flags { |
| 8013 | /** if the arguments contain forwarding */ |
| 8014 | PM_ARGUMENTS_NODE_FLAGS_CONTAINS_FORWARDING = 4, |
| 8015 | |
| 8016 | /** if the arguments contain keywords */ |
| 8017 | PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS = 8, |
| 8018 | |
| 8019 | /** if the arguments contain a keyword splat */ |
| 8020 | PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT = 16, |
| 8021 | |
| 8022 | /** if the arguments contain a splat */ |
| 8023 | PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT = 32, |
| 8024 | |
| 8025 | /** if the arguments contain multiple splats */ |
| 8026 | PM_ARGUMENTS_NODE_FLAGS_CONTAINS_MULTIPLE_SPLATS = 64, |
| 8027 | |
| 8028 | PM_ARGUMENTS_NODE_FLAGS_LAST, |
| 8029 | } pm_arguments_node_flags_t; |
| 8030 | |
| 8031 | /** |
| 8032 | * Flags for array nodes. |
| 8033 | */ |
| 8034 | typedef enum pm_array_node_flags { |
| 8035 | /** if array contains splat nodes */ |
| 8036 | PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT = 4, |
| 8037 | |
| 8038 | PM_ARRAY_NODE_FLAGS_LAST, |
| 8039 | } pm_array_node_flags_t; |
| 8040 | |
| 8041 | /** |
| 8042 | * Flags for call nodes. |
| 8043 | */ |
| 8044 | typedef enum pm_call_node_flags { |
| 8045 | /** &. operator */ |
| 8046 | PM_CALL_NODE_FLAGS_SAFE_NAVIGATION = 4, |
| 8047 | |
| 8048 | /** a call that could have been a local variable */ |
| 8049 | PM_CALL_NODE_FLAGS_VARIABLE_CALL = 8, |
| 8050 | |
| 8051 | /** a call that is an attribute write, so the value being written should be returned */ |
| 8052 | PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE = 16, |
| 8053 | |
| 8054 | /** a call that ignores method visibility */ |
| 8055 | PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY = 32, |
| 8056 | |
| 8057 | PM_CALL_NODE_FLAGS_LAST, |
| 8058 | } pm_call_node_flags_t; |
| 8059 | |
| 8060 | /** |
| 8061 | * Flags for nodes that have unescaped content. |
| 8062 | */ |
| 8063 | typedef enum pm_encoding_flags { |
| 8064 | /** internal bytes forced the encoding to UTF-8 */ |
| 8065 | PM_ENCODING_FLAGS_FORCED_UTF8_ENCODING = 4, |
| 8066 | |
| 8067 | /** internal bytes forced the encoding to binary */ |
| 8068 | PM_ENCODING_FLAGS_FORCED_BINARY_ENCODING = 8, |
| 8069 | |
| 8070 | PM_ENCODING_FLAGS_LAST, |
| 8071 | } pm_encoding_flags_t; |
| 8072 | |
| 8073 | /** |
| 8074 | * Flags for integer nodes that correspond to the base of the integer. |
| 8075 | */ |
| 8076 | typedef enum pm_integer_base_flags { |
| 8077 | /** 0b prefix */ |
| 8078 | PM_INTEGER_BASE_FLAGS_BINARY = 4, |
| 8079 | |
| 8080 | /** 0d or no prefix */ |
| 8081 | PM_INTEGER_BASE_FLAGS_DECIMAL = 8, |
| 8082 | |
| 8083 | /** 0o or 0 prefix */ |
| 8084 | PM_INTEGER_BASE_FLAGS_OCTAL = 16, |
| 8085 | |
| 8086 | /** 0x prefix */ |
| 8087 | PM_INTEGER_BASE_FLAGS_HEXADECIMAL = 32, |
| 8088 | |
| 8089 | PM_INTEGER_BASE_FLAGS_LAST, |
| 8090 | } pm_integer_base_flags_t; |
| 8091 | |
| 8092 | /** |
| 8093 | * Flags for interpolated string nodes that indicated mutability if they are also marked as literals. |
| 8094 | */ |
| 8095 | typedef enum pm_interpolated_string_node_flags { |
| 8096 | /** frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'` */ |
| 8097 | PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN = 4, |
| 8098 | |
| 8099 | /** mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'` */ |
| 8100 | PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE = 8, |
| 8101 | |
| 8102 | PM_INTERPOLATED_STRING_NODE_FLAGS_LAST, |
| 8103 | } pm_interpolated_string_node_flags_t; |
| 8104 | |
| 8105 | /** |
| 8106 | * Flags for keyword hash nodes. |
| 8107 | */ |
| 8108 | typedef enum pm_keyword_hash_node_flags { |
| 8109 | /** a keyword hash which only has `AssocNode` elements all with symbol keys, which means the elements can be treated as keyword arguments */ |
| 8110 | PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS = 4, |
| 8111 | |
| 8112 | PM_KEYWORD_HASH_NODE_FLAGS_LAST, |
| 8113 | } pm_keyword_hash_node_flags_t; |
| 8114 | |
| 8115 | /** |
| 8116 | * Flags for while and until loop nodes. |
| 8117 | */ |
| 8118 | typedef enum pm_loop_flags { |
| 8119 | /** a loop after a begin statement, so the body is executed first before the condition */ |
| 8120 | PM_LOOP_FLAGS_BEGIN_MODIFIER = 4, |
| 8121 | |
| 8122 | PM_LOOP_FLAGS_LAST, |
| 8123 | } pm_loop_flags_t; |
| 8124 | |
| 8125 | /** |
| 8126 | * Flags for parameter nodes. |
| 8127 | */ |
| 8128 | typedef enum pm_parameter_flags { |
| 8129 | /** a parameter name that has been repeated in the method signature */ |
| 8130 | PM_PARAMETER_FLAGS_REPEATED_PARAMETER = 4, |
| 8131 | |
| 8132 | PM_PARAMETER_FLAGS_LAST, |
| 8133 | } pm_parameter_flags_t; |
| 8134 | |
| 8135 | /** |
| 8136 | * Flags for parentheses nodes. |
| 8137 | */ |
| 8138 | typedef enum pm_parentheses_node_flags { |
| 8139 | /** parentheses that contain multiple potentially void statements */ |
| 8140 | PM_PARENTHESES_NODE_FLAGS_MULTIPLE_STATEMENTS = 4, |
| 8141 | |
| 8142 | PM_PARENTHESES_NODE_FLAGS_LAST, |
| 8143 | } pm_parentheses_node_flags_t; |
| 8144 | |
| 8145 | /** |
| 8146 | * Flags for range and flip-flop nodes. |
| 8147 | */ |
| 8148 | typedef enum pm_range_flags { |
| 8149 | /** ... operator */ |
| 8150 | PM_RANGE_FLAGS_EXCLUDE_END = 4, |
| 8151 | |
| 8152 | PM_RANGE_FLAGS_LAST, |
| 8153 | } pm_range_flags_t; |
| 8154 | |
| 8155 | /** |
| 8156 | * Flags for regular expression and match last line nodes. |
| 8157 | */ |
| 8158 | typedef enum pm_regular_expression_flags { |
| 8159 | /** i - ignores the case of characters when matching */ |
| 8160 | PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE = 4, |
| 8161 | |
| 8162 | /** x - ignores whitespace and allows comments in regular expressions */ |
| 8163 | PM_REGULAR_EXPRESSION_FLAGS_EXTENDED = 8, |
| 8164 | |
| 8165 | /** m - allows $ to match the end of lines within strings */ |
| 8166 | PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE = 16, |
| 8167 | |
| 8168 | /** o - only interpolates values into the regular expression once */ |
| 8169 | PM_REGULAR_EXPRESSION_FLAGS_ONCE = 32, |
| 8170 | |
| 8171 | /** e - forces the EUC-JP encoding */ |
| 8172 | PM_REGULAR_EXPRESSION_FLAGS_EUC_JP = 64, |
| 8173 | |
| 8174 | /** n - forces the ASCII-8BIT encoding */ |
| 8175 | PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT = 128, |
| 8176 | |
| 8177 | /** s - forces the Windows-31J encoding */ |
| 8178 | PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J = 256, |
| 8179 | |
| 8180 | /** u - forces the UTF-8 encoding */ |
| 8181 | PM_REGULAR_EXPRESSION_FLAGS_UTF_8 = 512, |
| 8182 | |
| 8183 | /** internal bytes forced the encoding to UTF-8 */ |
| 8184 | PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING = 1024, |
| 8185 | |
| 8186 | /** internal bytes forced the encoding to binary */ |
| 8187 | PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING = 2048, |
| 8188 | |
| 8189 | /** internal bytes forced the encoding to US-ASCII */ |
| 8190 | PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING = 4096, |
| 8191 | |
| 8192 | PM_REGULAR_EXPRESSION_FLAGS_LAST, |
| 8193 | } pm_regular_expression_flags_t; |
| 8194 | |
| 8195 | /** |
| 8196 | * Flags for shareable constant nodes. |
| 8197 | */ |
| 8198 | typedef enum pm_shareable_constant_node_flags { |
| 8199 | /** constant writes that should be modified with shareable constant value literal */ |
| 8200 | PM_SHAREABLE_CONSTANT_NODE_FLAGS_LITERAL = 4, |
| 8201 | |
| 8202 | /** constant writes that should be modified with shareable constant value experimental everything */ |
| 8203 | PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_EVERYTHING = 8, |
| 8204 | |
| 8205 | /** constant writes that should be modified with shareable constant value experimental copy */ |
| 8206 | PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_COPY = 16, |
| 8207 | |
| 8208 | PM_SHAREABLE_CONSTANT_NODE_FLAGS_LAST, |
| 8209 | } pm_shareable_constant_node_flags_t; |
| 8210 | |
| 8211 | /** |
| 8212 | * Flags for string nodes. |
| 8213 | */ |
| 8214 | typedef enum pm_string_flags { |
| 8215 | /** internal bytes forced the encoding to UTF-8 */ |
| 8216 | PM_STRING_FLAGS_FORCED_UTF8_ENCODING = 4, |
| 8217 | |
| 8218 | /** internal bytes forced the encoding to binary */ |
| 8219 | PM_STRING_FLAGS_FORCED_BINARY_ENCODING = 8, |
| 8220 | |
| 8221 | /** frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal` */ |
| 8222 | PM_STRING_FLAGS_FROZEN = 16, |
| 8223 | |
| 8224 | /** mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal` */ |
| 8225 | PM_STRING_FLAGS_MUTABLE = 32, |
| 8226 | |
| 8227 | PM_STRING_FLAGS_LAST, |
| 8228 | } pm_string_flags_t; |
| 8229 | |
| 8230 | /** |
| 8231 | * Flags for symbol nodes. |
| 8232 | */ |
| 8233 | typedef enum pm_symbol_flags { |
| 8234 | /** internal bytes forced the encoding to UTF-8 */ |
| 8235 | PM_SYMBOL_FLAGS_FORCED_UTF8_ENCODING = 4, |
| 8236 | |
| 8237 | /** internal bytes forced the encoding to binary */ |
| 8238 | PM_SYMBOL_FLAGS_FORCED_BINARY_ENCODING = 8, |
| 8239 | |
| 8240 | /** internal bytes forced the encoding to US-ASCII */ |
| 8241 | PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING = 16, |
| 8242 | |
| 8243 | PM_SYMBOL_FLAGS_LAST, |
| 8244 | } pm_symbol_flags_t; |
| 8245 | |
| 8246 | /** |
| 8247 | * When we're serializing to Java, we want to skip serializing the location |
| 8248 | * fields as they won't be used by JRuby or TruffleRuby. This boolean allows us |
| 8249 | * to specify that through the environment. It will never be true except for in |
| 8250 | * those build systems. |
| 8251 | */ |
| 8252 | #define PRISM_SERIALIZE_ONLY_SEMANTICS_FIELDS 0 |
| 8253 | |
| 8254 | #endif |