include/prism/ast.h in prism-0.30.0 vs include/prism/ast.h in prism-1.0.0

- old
+ new

@@ -1,12 +1,12 @@ -/******************************************************************************/ +/*----------------------------------------------------------------------------*/ /* This file is generated by the templates/template.rb script and should not */ /* be modified manually. See */ /* templates/include/prism/ast.h.erb */ /* if you are looking to modify the */ /* template */ -/******************************************************************************/ +/*----------------------------------------------------------------------------*/ /** * @file ast.h * * The abstract syntax tree. @@ -1041,16 +1041,13 @@ /** * We store the flags enum in every node in the tree. Some flags are common to * all nodes (the ones listed below). Others are specific to certain node types. */ -#define PM_NODE_FLAG_BITS (sizeof(pm_node_flags_t) * 8) +static const pm_node_flags_t PM_NODE_FLAG_NEWLINE = 0x1; +static const pm_node_flags_t PM_NODE_FLAG_STATIC_LITERAL = 0x2; -static const pm_node_flags_t PM_NODE_FLAG_NEWLINE = (1 << (PM_NODE_FLAG_BITS - 1)); -static const pm_node_flags_t PM_NODE_FLAG_STATIC_LITERAL = (1 << (PM_NODE_FLAG_BITS - 2)); -static const pm_node_flags_t PM_NODE_FLAG_COMMON_MASK = (1 << (PM_NODE_FLAG_BITS - 1)) | (1 << (PM_NODE_FLAG_BITS - 2)); - /** * Cast the type to an enum to allow the compiler to provide exhaustiveness * checking. */ #define PM_NODE_TYPE(node) ((enum pm_node_type) (node)->type) @@ -1081,19 +1078,30 @@ * some are specific to the type of node. */ pm_node_flags_t flags; /** + * The unique identifier for this node, which is deterministic based on the + * source. It is used to identify unique nodes across parses. + */ + uint32_t node_id; + + /** * This is the location of the node in the source. It's a range of bytes * containing a start and an end. */ pm_location_t location; } pm_node_t; /** * AliasGlobalVariableNode * + * Represents the use of the `alias` keyword to alias a global variable. + * + * alias $foo $bar + * ^^^^^^^^^^^^^^^ + * * Type: PM_ALIAS_GLOBAL_VARIABLE_NODE * * @extends pm_node_t */ typedef struct pm_alias_global_variable_node { @@ -1101,21 +1109,21 @@ pm_node_t base; /** * AliasGlobalVariableNode#new_name * - * Represents the new name of the global variable that can be used after aliasing. This can be either a global variable, a back reference, or a numbered reference. + * Represents the new name of the global variable that can be used after aliasing. * * alias $foo $bar * ^^^^ */ struct pm_node *new_name; /** * AliasGlobalVariableNode#old_name * - * Represents the old name of the global variable that could be used before aliasing. This can be either a global variable, a back reference, or a numbered reference. + * Represents the old name of the global variable that can be used before aliasing. * * alias $foo $bar * ^^^^ */ struct pm_node *old_name; @@ -1132,10 +1140,15 @@ } pm_alias_global_variable_node_t; /** * AliasMethodNode * + * Represents the use of the `alias` keyword to alias a method. + * + * alias foo bar + * ^^^^^^^^^^^^^ + * * Type: PM_ALIAS_METHOD_NODE * * @extends pm_node_t */ typedef struct pm_alias_method_node { @@ -1159,10 +1172,15 @@ } pm_alias_method_node_t; /** * AlternationPatternNode * + * Represents an alternation pattern in pattern matching. + * + * foo => bar | baz + * ^^^^^^^^^ + * * Type: PM_ALTERNATION_PATTERN_NODE * * @extends pm_node_t */ typedef struct pm_alternation_pattern_node { @@ -1186,10 +1204,15 @@ } pm_alternation_pattern_node_t; /** * AndNode * + * Represents the use of the `&&` operator or the `and` keyword. + * + * left and right + * ^^^^^^^^^^^^^^ + * * Type: PM_AND_NODE * * @extends pm_node_t */ typedef struct pm_and_node { @@ -1234,14 +1257,20 @@ } pm_and_node_t; /** * ArgumentsNode * + * Represents a set of arguments to a method or a keyword. + * + * return foo, bar, baz + * ^^^^^^^^^^^^^ + * * Type: PM_ARGUMENTS_NODE * Flags: * PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS * PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT + * PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT * * @extends pm_node_t */ typedef struct pm_arguments_node { /** The embedded base node. */ @@ -1254,10 +1283,15 @@ } pm_arguments_node_t; /** * ArrayNode * + * Represents an array literal. This can be a regular array using brackets or a special array using % like %w or %i. + * + * [1, 2, 3] + * ^^^^^^^^^ + * * Type: PM_ARRAY_NODE * Flags: * PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT * * @extends pm_node_t @@ -1299,10 +1333,27 @@ } pm_array_node_t; /** * ArrayPatternNode * + * Represents an array pattern in pattern matching. + * + * foo in 1, 2 + * ^^^^^^^^^^^ + * + * foo in [1, 2] + * ^^^^^^^^^^^^^ + * + * foo in *1 + * ^^^^^^^^^ + * + * foo in Bar[] + * ^^^^^^^^^^^^ + * + * foo in Bar[1, 2, 3] + * ^^^^^^^^^^^^^^^^^^^ + * * Type: PM_ARRAY_PATTERN_NODE * * @extends pm_node_t */ typedef struct pm_array_pattern_node { @@ -1341,10 +1392,15 @@ } pm_array_pattern_node_t; /** * AssocNode * + * Represents a hash key/value pair. + * + * { a => b } + * ^^^^^^ + * * Type: PM_ASSOC_NODE * * @extends pm_node_t */ typedef struct pm_assoc_node { @@ -1392,10 +1448,15 @@ } pm_assoc_node_t; /** * AssocSplatNode * + * Represents a splat in a hash literal. + * + * { **foo } + * ^^^^^ + * * Type: PM_ASSOC_SPLAT_NODE * * @extends pm_node_t */ typedef struct pm_assoc_splat_node { @@ -1424,10 +1485,15 @@ } pm_assoc_splat_node_t; /** * BackReferenceReadNode * + * Represents reading a reference to a field in the previous match. + * + * $' + * ^^ + * * Type: PM_BACK_REFERENCE_READ_NODE * * @extends pm_node_t */ typedef struct pm_back_reference_read_node { @@ -1447,10 +1513,17 @@ } pm_back_reference_read_node_t; /** * BeginNode * + * Represents a begin statement. + * + * begin + * foo + * end + * ^^^^^ + * * Type: PM_BEGIN_NODE * * @extends pm_node_t */ typedef struct pm_begin_node { @@ -1489,10 +1562,15 @@ } pm_begin_node_t; /** * BlockArgumentNode * + * Represents a block argument using `&`. + * + * bar(&args) + * ^^^^^^^^^^ + * * Type: PM_BLOCK_ARGUMENT_NODE * * @extends pm_node_t */ typedef struct pm_block_argument_node { @@ -1511,10 +1589,15 @@ } pm_block_argument_node_t; /** * BlockLocalVariableNode * + * Represents a block local variable. + * + * a { |; b| } + * ^ + * * Type: PM_BLOCK_LOCAL_VARIABLE_NODE * Flags: * PM_PARAMETER_FLAGS_REPEATED_PARAMETER * * @extends pm_node_t @@ -1530,10 +1613,15 @@ } pm_block_local_variable_node_t; /** * BlockNode * + * Represents a block of ruby code. + * + * [1, 2, 3].each { |i| puts x } + * ^^^^^^^^^^^^^^ + * * Type: PM_BLOCK_NODE * * @extends pm_node_t */ typedef struct pm_block_node { @@ -1567,10 +1655,16 @@ } pm_block_node_t; /** * BlockParameterNode * + * Represents a block parameter of a method, block, or lambda definition. + * + * def a(&b) + * ^^ + * end + * * Type: PM_BLOCK_PARAMETER_NODE * Flags: * PM_PARAMETER_FLAGS_REPEATED_PARAMETER * * @extends pm_node_t @@ -1596,10 +1690,19 @@ } pm_block_parameter_node_t; /** * BlockParametersNode * + * Represents a block's parameters declaration. + * + * -> (a, b = 1; local) { } + * ^^^^^^^^^^^^^^^^^ + * + * foo do |a, b = 1; local| + * ^^^^^^^^^^^^^^^^^ + * end + * * Type: PM_BLOCK_PARAMETERS_NODE * * @extends pm_node_t */ typedef struct pm_block_parameters_node { @@ -1628,10 +1731,15 @@ } pm_block_parameters_node_t; /** * BreakNode * + * Represents the use of the `break` keyword. + * + * break foo + * ^^^^^^^^^ + * * Type: PM_BREAK_NODE * * @extends pm_node_t */ typedef struct pm_break_node { @@ -1660,10 +1768,15 @@ } pm_break_node_t; /** * CallAndWriteNode * + * Represents the use of the `&&=` operator on a call. + * + * foo.bar &&= value + * ^^^^^^^^^^^^^^^^^ + * * Type: PM_CALL_AND_WRITE_NODE * Flags: * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION * PM_CALL_NODE_FLAGS_VARIABLE_CALL * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE @@ -1712,10 +1825,30 @@ } pm_call_and_write_node_t; /** * CallNode * + * Represents a method call, in all of the various forms that can take. + * + * foo + * ^^^ + * + * foo() + * ^^^^^ + * + * +foo + * ^^^^ + * + * foo + bar + * ^^^^^^^^^ + * + * foo.bar + * ^^^^^^^ + * + * foo&.bar + * ^^^^^^^^ + * * Type: PM_CALL_NODE * Flags: * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION * PM_CALL_NODE_FLAGS_VARIABLE_CALL * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE @@ -1780,10 +1913,15 @@ } pm_call_node_t; /** * CallOperatorWriteNode * + * Represents the use of an assignment operator on a call. + * + * foo.bar += baz + * ^^^^^^^^^^^^^^ + * * Type: PM_CALL_OPERATOR_WRITE_NODE * Flags: * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION * PM_CALL_NODE_FLAGS_VARIABLE_CALL * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE @@ -1837,10 +1975,15 @@ } pm_call_operator_write_node_t; /** * CallOrWriteNode * + * Represents the use of the `||=` operator on a call. + * + * foo.bar ||= value + * ^^^^^^^^^^^^^^^^^ + * * Type: PM_CALL_OR_WRITE_NODE * Flags: * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION * PM_CALL_NODE_FLAGS_VARIABLE_CALL * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE @@ -1889,10 +2032,23 @@ } pm_call_or_write_node_t; /** * CallTargetNode * + * Represents assigning to a method call. + * + * foo.bar, = 1 + * ^^^^^^^ + * + * begin + * rescue => foo.bar + * ^^^^^^^ + * end + * + * for foo.bar in baz do end + * ^^^^^^^ + * * Type: PM_CALL_TARGET_NODE * Flags: * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION * PM_CALL_NODE_FLAGS_VARIABLE_CALL * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE @@ -1926,10 +2082,15 @@ } pm_call_target_node_t; /** * CapturePatternNode * + * Represents assigning to a local variable in pattern matching. + * + * foo => [bar => baz] + * ^^^^^^^^^^^^ + * * Type: PM_CAPTURE_PATTERN_NODE * * @extends pm_node_t */ typedef struct pm_capture_pattern_node { @@ -1953,10 +2114,17 @@ } pm_capture_pattern_node_t; /** * CaseMatchNode * + * Represents the use of a case statement for pattern matching. + * + * case true + * in false + * end + * ^^^^^^^^^ + * * Type: PM_CASE_MATCH_NODE * * @extends pm_node_t */ typedef struct pm_case_match_node { @@ -1972,13 +2140,13 @@ * CaseMatchNode#conditions */ struct pm_node_list conditions; /** - * CaseMatchNode#consequent + * CaseMatchNode#else_clause */ - struct pm_else_node *consequent; + struct pm_else_node *else_clause; /** * CaseMatchNode#case_keyword_loc */ pm_location_t case_keyword_loc; @@ -1990,10 +2158,17 @@ } pm_case_match_node_t; /** * CaseNode * + * Represents the use of a case statement. + * + * case true + * when false + * end + * ^^^^^^^^^^ + * * Type: PM_CASE_NODE * * @extends pm_node_t */ typedef struct pm_case_node { @@ -2009,13 +2184,13 @@ * CaseNode#conditions */ struct pm_node_list conditions; /** - * CaseNode#consequent + * CaseNode#else_clause */ - struct pm_else_node *consequent; + struct pm_else_node *else_clause; /** * CaseNode#case_keyword_loc */ pm_location_t case_keyword_loc; @@ -2027,10 +2202,15 @@ } pm_case_node_t; /** * ClassNode * + * Represents a class declaration involving the `class` keyword. + * + * class Foo end + * ^^^^^^^^^^^^^ + * * Type: PM_CLASS_NODE * * @extends pm_node_t */ typedef struct pm_class_node { @@ -2079,10 +2259,15 @@ } pm_class_node_t; /** * ClassVariableAndWriteNode * + * Represents the use of the `&&=` operator for assignment to a class variable. + * + * @@target &&= value + * ^^^^^^^^^^^^^^^^^^ + * * Type: PM_CLASS_VARIABLE_AND_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_class_variable_and_write_node { @@ -2111,10 +2296,15 @@ } pm_class_variable_and_write_node_t; /** * ClassVariableOperatorWriteNode * + * Represents assigning to a class variable using an operator that isn't `=`. + * + * @@target += value + * ^^^^^^^^^^^^^^^^^ + * * Type: PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_class_variable_operator_write_node { @@ -2148,10 +2338,15 @@ } pm_class_variable_operator_write_node_t; /** * ClassVariableOrWriteNode * + * Represents the use of the `||=` operator for assignment to a class variable. + * + * @@target ||= value + * ^^^^^^^^^^^^^^^^^^ + * * Type: PM_CLASS_VARIABLE_OR_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_class_variable_or_write_node { @@ -2180,10 +2375,15 @@ } pm_class_variable_or_write_node_t; /** * ClassVariableReadNode * + * Represents referencing a class variable. + * + * @@foo + * ^^^^^ + * * Type: PM_CLASS_VARIABLE_READ_NODE * * @extends pm_node_t */ typedef struct pm_class_variable_read_node { @@ -2203,10 +2403,15 @@ } pm_class_variable_read_node_t; /** * ClassVariableTargetNode * + * Represents writing to a class variable in a context that doesn't have an explicit value. + * + * @@foo, @@bar = baz + * ^^^^^ ^^^^^ + * * Type: PM_CLASS_VARIABLE_TARGET_NODE * * @extends pm_node_t */ typedef struct pm_class_variable_target_node { @@ -2220,10 +2425,15 @@ } pm_class_variable_target_node_t; /** * ClassVariableWriteNode * + * Represents writing to a class variable. + * + * @@foo = 1 + * ^^^^^^^^^ + * * Type: PM_CLASS_VARIABLE_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_class_variable_write_node { @@ -2276,10 +2486,15 @@ } pm_class_variable_write_node_t; /** * ConstantAndWriteNode * + * Represents the use of the `&&=` operator for assignment to a constant. + * + * Target &&= value + * ^^^^^^^^^^^^^^^^ + * * Type: PM_CONSTANT_AND_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_constant_and_write_node { @@ -2308,10 +2523,15 @@ } pm_constant_and_write_node_t; /** * ConstantOperatorWriteNode * + * Represents assigning to a constant using an operator that isn't `=`. + * + * Target += value + * ^^^^^^^^^^^^^^^ + * * Type: PM_CONSTANT_OPERATOR_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_constant_operator_write_node { @@ -2345,10 +2565,15 @@ } pm_constant_operator_write_node_t; /** * ConstantOrWriteNode * + * Represents the use of the `||=` operator for assignment to a constant. + * + * Target ||= value + * ^^^^^^^^^^^^^^^^ + * * Type: PM_CONSTANT_OR_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_constant_or_write_node { @@ -2377,10 +2602,15 @@ } pm_constant_or_write_node_t; /** * ConstantPathAndWriteNode * + * Represents the use of the `&&=` operator for assignment to a constant path. + * + * Parent::Child &&= value + * ^^^^^^^^^^^^^^^^^^^^^^^ + * * Type: PM_CONSTANT_PATH_AND_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_constant_path_and_write_node { @@ -2404,10 +2634,15 @@ } pm_constant_path_and_write_node_t; /** * ConstantPathNode * + * Represents accessing a constant through a path of `::` operators. + * + * Foo::Bar + * ^^^^^^^^ + * * Type: PM_CONSTANT_PATH_NODE * * @extends pm_node_t */ typedef struct pm_constant_path_node { @@ -2465,10 +2700,15 @@ } pm_constant_path_node_t; /** * ConstantPathOperatorWriteNode * + * Represents assigning to a constant path using an operator that isn't `=`. + * + * Parent::Child += value + * ^^^^^^^^^^^^^^^^^^^^^^ + * * Type: PM_CONSTANT_PATH_OPERATOR_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_constant_path_operator_write_node { @@ -2497,10 +2737,15 @@ } pm_constant_path_operator_write_node_t; /** * ConstantPathOrWriteNode * + * Represents the use of the `||=` operator for assignment to a constant path. + * + * Parent::Child ||= value + * ^^^^^^^^^^^^^^^^^^^^^^^ + * * Type: PM_CONSTANT_PATH_OR_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_constant_path_or_write_node { @@ -2524,10 +2769,15 @@ } pm_constant_path_or_write_node_t; /** * ConstantPathTargetNode * + * Represents writing to a constant path in a context that doesn't have an explicit value. + * + * Foo::Foo, Bar::Bar = baz + * ^^^^^^^^ ^^^^^^^^ + * * Type: PM_CONSTANT_PATH_TARGET_NODE * * @extends pm_node_t */ typedef struct pm_constant_path_target_node { @@ -2556,10 +2806,21 @@ } pm_constant_path_target_node_t; /** * ConstantPathWriteNode * + * Represents writing to a constant path. + * + * ::Foo = 1 + * ^^^^^^^^^ + * + * Foo::Bar = 1 + * ^^^^^^^^^^^^ + * + * ::Foo::Bar = 1 + * ^^^^^^^^^^^^^^ + * * Type: PM_CONSTANT_PATH_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_constant_path_write_node { @@ -2601,10 +2862,15 @@ } pm_constant_path_write_node_t; /** * ConstantReadNode * + * Represents referencing a constant. + * + * Foo + * ^^^ + * * Type: PM_CONSTANT_READ_NODE * * @extends pm_node_t */ typedef struct pm_constant_read_node { @@ -2624,10 +2890,15 @@ } pm_constant_read_node_t; /** * ConstantTargetNode * + * Represents writing to a constant in a context that doesn't have an explicit value. + * + * Foo, Bar = baz + * ^^^ ^^^ + * * Type: PM_CONSTANT_TARGET_NODE * * @extends pm_node_t */ typedef struct pm_constant_target_node { @@ -2641,10 +2912,15 @@ } pm_constant_target_node_t; /** * ConstantWriteNode * + * Represents writing to a constant. + * + * Foo = 1 + * ^^^^^^^ + * * Type: PM_CONSTANT_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_constant_write_node { @@ -2697,10 +2973,16 @@ } pm_constant_write_node_t; /** * DefNode * + * Represents a method definition. + * + * def method + * end + * ^^^^^^^^^^ + * * Type: PM_DEF_NODE * * @extends pm_node_t */ typedef struct pm_def_node { @@ -2769,10 +3051,15 @@ } pm_def_node_t; /** * DefinedNode * + * Represents the use of the `defined?` keyword. + * + * defined?(a) + * ^^^^^^^^^^^ + * * Type: PM_DEFINED_NODE * * @extends pm_node_t */ typedef struct pm_defined_node { @@ -2801,10 +3088,15 @@ } pm_defined_node_t; /** * ElseNode * + * Represents an `else` clause in a `case`, `if`, or `unless` statement. + * + * if a then b else c end + * ^^^^^^^^^^ + * * Type: PM_ELSE_NODE * * @extends pm_node_t */ typedef struct pm_else_node { @@ -2828,10 +3120,15 @@ } pm_else_node_t; /** * EmbeddedStatementsNode * + * Represents an interpolated set of statements. + * + * "foo #{bar}" + * ^^^^^^ + * * Type: PM_EMBEDDED_STATEMENTS_NODE * * @extends pm_node_t */ typedef struct pm_embedded_statements_node { @@ -2855,10 +3152,15 @@ } pm_embedded_statements_node_t; /** * EmbeddedVariableNode * + * Represents an interpolated variable. + * + * "foo #@bar" + * ^^^^^ + * * Type: PM_EMBEDDED_VARIABLE_NODE * * @extends pm_node_t */ typedef struct pm_embedded_variable_node { @@ -2877,10 +3179,19 @@ } pm_embedded_variable_node_t; /** * EnsureNode * + * Represents an `ensure` clause in a `begin` statement. + * + * begin + * foo + * ensure + * ^^^^^^ + * bar + * end + * * Type: PM_ENSURE_NODE * * @extends pm_node_t */ typedef struct pm_ensure_node { @@ -2904,10 +3215,15 @@ } pm_ensure_node_t; /** * FalseNode * + * Represents the use of the literal `false` keyword. + * + * false + * ^^^^^ + * * Type: PM_FALSE_NODE * * @extends pm_node_t */ typedef struct pm_false_node { @@ -2916,10 +3232,21 @@ } pm_false_node_t; /** * FindPatternNode * + * Represents a find pattern in pattern matching. + * + * foo in *bar, baz, *qux + * ^^^^^^^^^^^^^^^ + * + * foo in [*bar, baz, *qux] + * ^^^^^^^^^^^^^^^^^ + * + * foo in Foo(*bar, baz, *qux) + * ^^^^^^^^^^^^^^^^^^^^ + * * Type: PM_FIND_PATTERN_NODE * * @extends pm_node_t */ typedef struct pm_find_pattern_node { @@ -2958,10 +3285,15 @@ } pm_find_pattern_node_t; /** * FlipFlopNode * + * Represents the use of the `..` or `...` operators to create flip flops. + * + * baz if foo .. bar + * ^^^^^^^^^^ + * * Type: PM_FLIP_FLOP_NODE * Flags: * PM_RANGE_FLAGS_EXCLUDE_END * * @extends pm_node_t @@ -2987,10 +3319,15 @@ } pm_flip_flop_node_t; /** * FloatNode * + * Represents a floating point number literal. + * + * 1.0 + * ^^^ + * * Type: PM_FLOAT_NODE * * @extends pm_node_t */ typedef struct pm_float_node { @@ -3006,10 +3343,15 @@ } pm_float_node_t; /** * ForNode * + * Represents the use of the `for` keyword. + * + * for i in a end + * ^^^^^^^^^^^^^^ + * * Type: PM_FOR_NODE * * @extends pm_node_t */ typedef struct pm_for_node { @@ -3090,10 +3432,17 @@ } pm_for_node_t; /** * ForwardingArgumentsNode * + * Represents forwarding all arguments to this method to another method. + * + * def foo(...) + * bar(...) + * ^^^ + * end + * * Type: PM_FORWARDING_ARGUMENTS_NODE * * @extends pm_node_t */ typedef struct pm_forwarding_arguments_node { @@ -3102,10 +3451,16 @@ } pm_forwarding_arguments_node_t; /** * ForwardingParameterNode * + * Represents the use of the forwarding parameter in a method, block, or lambda declaration. + * + * def foo(...) + * ^^^ + * end + * * Type: PM_FORWARDING_PARAMETER_NODE * * @extends pm_node_t */ typedef struct pm_forwarding_parameter_node { @@ -3114,10 +3469,15 @@ } pm_forwarding_parameter_node_t; /** * ForwardingSuperNode * + * Represents the use of the `super` keyword without parentheses or arguments. + * + * super + * ^^^^^ + * * Type: PM_FORWARDING_SUPER_NODE * * @extends pm_node_t */ typedef struct pm_forwarding_super_node { @@ -3131,10 +3491,15 @@ } pm_forwarding_super_node_t; /** * GlobalVariableAndWriteNode * + * Represents the use of the `&&=` operator for assignment to a global variable. + * + * $target &&= value + * ^^^^^^^^^^^^^^^^^ + * * Type: PM_GLOBAL_VARIABLE_AND_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_global_variable_and_write_node { @@ -3163,10 +3528,15 @@ } pm_global_variable_and_write_node_t; /** * GlobalVariableOperatorWriteNode * + * Represents assigning to a global variable using an operator that isn't `=`. + * + * $target += value + * ^^^^^^^^^^^^^^^^ + * * Type: PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_global_variable_operator_write_node { @@ -3200,10 +3570,15 @@ } pm_global_variable_operator_write_node_t; /** * GlobalVariableOrWriteNode * + * Represents the use of the `||=` operator for assignment to a global variable. + * + * $target ||= value + * ^^^^^^^^^^^^^^^^^ + * * Type: PM_GLOBAL_VARIABLE_OR_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_global_variable_or_write_node { @@ -3232,10 +3607,15 @@ } pm_global_variable_or_write_node_t; /** * GlobalVariableReadNode * + * Represents referencing a global variable. + * + * $foo + * ^^^^ + * * Type: PM_GLOBAL_VARIABLE_READ_NODE * * @extends pm_node_t */ typedef struct pm_global_variable_read_node { @@ -3255,10 +3635,15 @@ } pm_global_variable_read_node_t; /** * GlobalVariableTargetNode * + * Represents writing to a global variable in a context that doesn't have an explicit value. + * + * $foo, $bar = baz + * ^^^^ ^^^^ + * * Type: PM_GLOBAL_VARIABLE_TARGET_NODE * * @extends pm_node_t */ typedef struct pm_global_variable_target_node { @@ -3272,10 +3657,15 @@ } pm_global_variable_target_node_t; /** * GlobalVariableWriteNode * + * Represents writing to a global variable. + * + * $foo = 1 + * ^^^^^^^^ + * * Type: PM_GLOBAL_VARIABLE_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_global_variable_write_node { @@ -3328,10 +3718,15 @@ } pm_global_variable_write_node_t; /** * HashNode * + * Represents a hash literal. + * + * { a => b } + * ^^^^^^^^^^ + * * Type: PM_HASH_NODE * * @extends pm_node_t */ typedef struct pm_hash_node { @@ -3373,10 +3768,18 @@ } pm_hash_node_t; /** * HashPatternNode * + * Represents a hash pattern in pattern matching. + * + * foo => { a: 1, b: 2 } + * ^^^^^^^^^^^^^^ + * + * foo => { a: 1, b: 2, **c } + * ^^^^^^^^^^^^^^^^^^^ + * * Type: PM_HASH_PATTERN_NODE * * @extends pm_node_t */ typedef struct pm_hash_pattern_node { @@ -3410,10 +3813,21 @@ } pm_hash_pattern_node_t; /** * IfNode * + * Represents the use of the `if` keyword, either in the block form or the modifier form, or a ternary expression. + * + * bar if foo + * ^^^^^^^^^^ + * + * if foo then bar end + * ^^^^^^^^^^^^^^^^^^^ + * + * foo ? bar : baz + * ^^^^^^^^^^^^^^^ + * * Type: PM_IF_NODE * * @extends pm_node_t */ typedef struct pm_if_node { @@ -3476,11 +3890,11 @@ * end */ struct pm_statements_node *statements; /** - * IfNode#consequent + * IfNode#subsequent * * Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement. * * if foo * bar @@ -3492,11 +3906,11 @@ * ^^^ * * if foo then bar else baz end * ^^^^^^^^^^^^ */ - struct pm_node *consequent; + struct pm_node *subsequent; /** * IfNode#end_keyword_loc * * The location of the `end` keyword if present, `nil` otherwise. @@ -3510,10 +3924,15 @@ } pm_if_node_t; /** * ImaginaryNode * + * Represents an imaginary number literal. + * + * 1.0i + * ^^^^ + * * Type: PM_IMAGINARY_NODE * * @extends pm_node_t */ typedef struct pm_imaginary_node { @@ -3527,10 +3946,21 @@ } pm_imaginary_node_t; /** * ImplicitNode * + * Represents a node that is implicitly being added to the tree but doesn't correspond directly to a node in the source. + * + * { foo: } + * ^^^^ + * + * { Foo: } + * ^^^^ + * + * foo in { bar: } + * ^^^^ + * * Type: PM_IMPLICIT_NODE * * @extends pm_node_t */ typedef struct pm_implicit_node { @@ -3544,10 +3974,24 @@ } pm_implicit_node_t; /** * ImplicitRestNode * + * Represents using a trailing comma to indicate an implicit rest parameter. + * + * foo { |bar,| } + * ^ + * + * foo in [bar,] + * ^ + * + * for foo, in bar do end + * ^ + * + * foo, = bar + * ^ + * * Type: PM_IMPLICIT_REST_NODE * * @extends pm_node_t */ typedef struct pm_implicit_rest_node { @@ -3556,10 +4000,15 @@ } pm_implicit_rest_node_t; /** * InNode * + * Represents the use of the `in` keyword in a case statement. + * + * case a; in b then c end + * ^^^^^^^^^^^ + * * Type: PM_IN_NODE * * @extends pm_node_t */ typedef struct pm_in_node { @@ -3588,10 +4037,15 @@ } pm_in_node_t; /** * IndexAndWriteNode * + * Represents the use of the `&&=` operator on a call to the `[]` method. + * + * foo.bar[baz] &&= value + * ^^^^^^^^^^^^^^^^^^^^^^ + * * Type: PM_INDEX_AND_WRITE_NODE * Flags: * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION * PM_CALL_NODE_FLAGS_VARIABLE_CALL * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE @@ -3645,10 +4099,15 @@ } pm_index_and_write_node_t; /** * IndexOperatorWriteNode * + * Represents the use of an assignment operator on a call to `[]`. + * + * foo.bar[baz] += value + * ^^^^^^^^^^^^^^^^^^^^^ + * * Type: PM_INDEX_OPERATOR_WRITE_NODE * Flags: * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION * PM_CALL_NODE_FLAGS_VARIABLE_CALL * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE @@ -3707,10 +4166,15 @@ } pm_index_operator_write_node_t; /** * IndexOrWriteNode * + * Represents the use of the `||=` operator on a call to `[]`. + * + * foo.bar[baz] ||= value + * ^^^^^^^^^^^^^^^^^^^^^^ + * * Type: PM_INDEX_OR_WRITE_NODE * Flags: * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION * PM_CALL_NODE_FLAGS_VARIABLE_CALL * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE @@ -3764,10 +4228,23 @@ } pm_index_or_write_node_t; /** * IndexTargetNode * + * Represents assigning to an index. + * + * foo[bar], = 1 + * ^^^^^^^^ + * + * begin + * rescue => foo[bar] + * ^^^^^^^^ + * end + * + * for foo[bar] in baz do end + * ^^^^^^^^ + * * Type: PM_INDEX_TARGET_NODE * Flags: * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION * PM_CALL_NODE_FLAGS_VARIABLE_CALL * PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE @@ -3806,10 +4283,15 @@ } pm_index_target_node_t; /** * InstanceVariableAndWriteNode * + * Represents the use of the `&&=` operator for assignment to an instance variable. + * + * @target &&= value + * ^^^^^^^^^^^^^^^^^ + * * Type: PM_INSTANCE_VARIABLE_AND_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_instance_variable_and_write_node { @@ -3838,10 +4320,15 @@ } pm_instance_variable_and_write_node_t; /** * InstanceVariableOperatorWriteNode * + * Represents assigning to an instance variable using an operator that isn't `=`. + * + * @target += value + * ^^^^^^^^^^^^^^^^ + * * Type: PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_instance_variable_operator_write_node { @@ -3875,10 +4362,15 @@ } pm_instance_variable_operator_write_node_t; /** * InstanceVariableOrWriteNode * + * Represents the use of the `||=` operator for assignment to an instance variable. + * + * @target ||= value + * ^^^^^^^^^^^^^^^^^ + * * Type: PM_INSTANCE_VARIABLE_OR_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_instance_variable_or_write_node { @@ -3907,10 +4399,15 @@ } pm_instance_variable_or_write_node_t; /** * InstanceVariableReadNode * + * Represents referencing an instance variable. + * + * @foo + * ^^^^ + * * Type: PM_INSTANCE_VARIABLE_READ_NODE * * @extends pm_node_t */ typedef struct pm_instance_variable_read_node { @@ -3930,10 +4427,15 @@ } pm_instance_variable_read_node_t; /** * InstanceVariableTargetNode * + * Represents writing to an instance variable in a context that doesn't have an explicit value. + * + * @foo, @bar = baz + * ^^^^ ^^^^ + * * Type: PM_INSTANCE_VARIABLE_TARGET_NODE * * @extends pm_node_t */ typedef struct pm_instance_variable_target_node { @@ -3947,10 +4449,15 @@ } pm_instance_variable_target_node_t; /** * InstanceVariableWriteNode * + * Represents writing to an instance variable. + * + * @foo = 1 + * ^^^^^^^^ + * * Type: PM_INSTANCE_VARIABLE_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_instance_variable_write_node { @@ -4003,10 +4510,15 @@ } pm_instance_variable_write_node_t; /** * IntegerNode * + * Represents an integer number literal. + * + * 1 + * ^ + * * Type: PM_INTEGER_NODE * Flags: * PM_INTEGER_BASE_FLAGS_BINARY * PM_INTEGER_BASE_FLAGS_DECIMAL * PM_INTEGER_BASE_FLAGS_OCTAL @@ -4027,10 +4539,15 @@ } pm_integer_node_t; /** * InterpolatedMatchLastLineNode * + * 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. + * + * if /foo #{bar} baz/ then end + * ^^^^^^^^^^^^^^^^ + * * Type: PM_INTERPOLATED_MATCH_LAST_LINE_NODE * Flags: * PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE * PM_REGULAR_EXPRESSION_FLAGS_EXTENDED * PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE @@ -4066,10 +4583,15 @@ } pm_interpolated_match_last_line_node_t; /** * InterpolatedRegularExpressionNode * + * Represents a regular expression literal that contains interpolation. + * + * /foo #{bar} baz/ + * ^^^^^^^^^^^^^^^^ + * * Type: PM_INTERPOLATED_REGULAR_EXPRESSION_NODE * Flags: * PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE * PM_REGULAR_EXPRESSION_FLAGS_EXTENDED * PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE @@ -4105,10 +4627,15 @@ } pm_interpolated_regular_expression_node_t; /** * InterpolatedStringNode * + * Represents a string literal that contains interpolation. + * + * "foo #{bar} baz" + * ^^^^^^^^^^^^^^^^ + * * Type: PM_INTERPOLATED_STRING_NODE * Flags: * PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN * PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE * @@ -4135,10 +4662,15 @@ } pm_interpolated_string_node_t; /** * InterpolatedSymbolNode * + * Represents a symbol literal that contains interpolation. + * + * :"foo #{bar} baz" + * ^^^^^^^^^^^^^^^^^ + * * Type: PM_INTERPOLATED_SYMBOL_NODE * * @extends pm_node_t */ typedef struct pm_interpolated_symbol_node { @@ -4162,10 +4694,15 @@ } pm_interpolated_symbol_node_t; /** * InterpolatedXStringNode * + * Represents an xstring literal that contains interpolation. + * + * `foo #{bar} baz` + * ^^^^^^^^^^^^^^^^ + * * Type: PM_INTERPOLATED_X_STRING_NODE * * @extends pm_node_t */ typedef struct pm_interpolated_x_string_node { @@ -4189,10 +4726,15 @@ } pm_interpolated_x_string_node_t; /** * ItLocalVariableReadNode * + * Represents reading from the implicit `it` local variable. + * + * -> { it } + * ^^ + * * Type: PM_IT_LOCAL_VARIABLE_READ_NODE * * @extends pm_node_t */ typedef struct pm_it_local_variable_read_node { @@ -4201,10 +4743,15 @@ } pm_it_local_variable_read_node_t; /** * ItParametersNode * + * Represents an implicit set of parameters through the use of the `it` keyword within a block or lambda. + * + * -> { it + it } + * ^^^^^^^^^^^^^^ + * * Type: PM_IT_PARAMETERS_NODE * * @extends pm_node_t */ typedef struct pm_it_parameters_node { @@ -4213,10 +4760,15 @@ } pm_it_parameters_node_t; /** * KeywordHashNode * + * Represents a hash literal without opening and closing braces. + * + * foo(a: b) + * ^^^^ + * * Type: PM_KEYWORD_HASH_NODE * Flags: * PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS * * @extends pm_node_t @@ -4232,10 +4784,16 @@ } pm_keyword_hash_node_t; /** * KeywordRestParameterNode * + * Represents a keyword rest parameter to a method, block, or lambda definition. + * + * def a(**b) + * ^^^ + * end + * * Type: PM_KEYWORD_REST_PARAMETER_NODE * Flags: * PM_PARAMETER_FLAGS_REPEATED_PARAMETER * * @extends pm_node_t @@ -4261,10 +4819,15 @@ } pm_keyword_rest_parameter_node_t; /** * LambdaNode * + * Represents using a lambda literal (not the lambda method call). + * + * ->(value) { value * 2 } + * ^^^^^^^^^^^^^^^^^^^^^^^ + * * Type: PM_LAMBDA_NODE * * @extends pm_node_t */ typedef struct pm_lambda_node { @@ -4303,10 +4866,15 @@ } pm_lambda_node_t; /** * LocalVariableAndWriteNode * + * Represents the use of the `&&=` operator for assignment to a local variable. + * + * target &&= value + * ^^^^^^^^^^^^^^^^ + * * Type: PM_LOCAL_VARIABLE_AND_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_local_variable_and_write_node { @@ -4340,10 +4908,15 @@ } pm_local_variable_and_write_node_t; /** * LocalVariableOperatorWriteNode * + * Represents assigning to a local variable using an operator that isn't `=`. + * + * target += value + * ^^^^^^^^^^^^^^^ + * * Type: PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_local_variable_operator_write_node { @@ -4382,10 +4955,15 @@ } pm_local_variable_operator_write_node_t; /** * LocalVariableOrWriteNode * + * Represents the use of the `||=` operator for assignment to a local variable. + * + * target ||= value + * ^^^^^^^^^^^^^^^^ + * * Type: PM_LOCAL_VARIABLE_OR_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_local_variable_or_write_node { @@ -4419,10 +4997,15 @@ } pm_local_variable_or_write_node_t; /** * LocalVariableReadNode * + * 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. + * + * foo + * ^^^ + * * Type: PM_LOCAL_VARIABLE_READ_NODE * * @extends pm_node_t */ typedef struct pm_local_variable_read_node { @@ -4459,10 +5042,15 @@ } pm_local_variable_read_node_t; /** * LocalVariableTargetNode * + * Represents writing to a local variable in a context that doesn't have an explicit value. + * + * foo, bar = baz + * ^^^ ^^^ + * * Type: PM_LOCAL_VARIABLE_TARGET_NODE * * @extends pm_node_t */ typedef struct pm_local_variable_target_node { @@ -4481,10 +5069,15 @@ } pm_local_variable_target_node_t; /** * LocalVariableWriteNode * + * Represents writing to a local variable. + * + * foo = 1 + * ^^^^^^^ + * * Type: PM_LOCAL_VARIABLE_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_local_variable_write_node { @@ -4554,10 +5147,15 @@ } pm_local_variable_write_node_t; /** * MatchLastLineNode * + * Represents a regular expression literal used in the predicate of a conditional to implicitly match against the last line read by an IO object. + * + * if /foo/i then end + * ^^^^^^ + * * Type: PM_MATCH_LAST_LINE_NODE * Flags: * PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE * PM_REGULAR_EXPRESSION_FLAGS_EXTENDED * PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE @@ -4598,10 +5196,15 @@ } pm_match_last_line_node_t; /** * MatchPredicateNode * + * Represents the use of the modifier `in` operator. + * + * foo in bar + * ^^^^^^^^^^ + * * Type: PM_MATCH_PREDICATE_NODE * * @extends pm_node_t */ typedef struct pm_match_predicate_node { @@ -4625,10 +5228,15 @@ } pm_match_predicate_node_t; /** * MatchRequiredNode * + * Represents the use of the `=>` operator. + * + * foo => bar + * ^^^^^^^^^^ + * * Type: PM_MATCH_REQUIRED_NODE * * @extends pm_node_t */ typedef struct pm_match_required_node { @@ -4652,10 +5260,15 @@ } pm_match_required_node_t; /** * MatchWriteNode * + * Represents writing local variables using a regular expression match with named capture groups. + * + * /(?<foo>bar)/ =~ baz + * ^^^^^^^^^^^^^^^^^^^^ + * * Type: PM_MATCH_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_match_write_node { @@ -4674,10 +5287,12 @@ } pm_match_write_node_t; /** * MissingNode * + * Represents a node that is missing from the source and results in a syntax error. + * * Type: PM_MISSING_NODE * * @extends pm_node_t */ typedef struct pm_missing_node { @@ -4686,10 +5301,15 @@ } pm_missing_node_t; /** * ModuleNode * + * Represents a module declaration involving the `module` keyword. + * + * module Foo end + * ^^^^^^^^^^^^^^ + * * Type: PM_MODULE_NODE * * @extends pm_node_t */ typedef struct pm_module_node { @@ -4728,94 +5348,204 @@ } pm_module_node_t; /** * MultiTargetNode * + * Represents a multi-target expression. + * + * a, (b, c) = 1, 2, 3 + * ^^^^^^ + * + * This can be a part of `MultiWriteNode` as above, or the target of a `for` loop + * + * for a, b in [[1, 2], [3, 4]] + * ^^^^ + * * Type: PM_MULTI_TARGET_NODE * * @extends pm_node_t */ typedef struct pm_multi_target_node { /** The embedded base node. */ pm_node_t base; /** * MultiTargetNode#lefts + * + * Represents the targets expressions before a splat node. + * + * a, (b, c, *) = 1, 2, 3, 4, 5 + * ^^^^ + * + * The splat node can be absent, in that case all target expressions are in the left field. + * + * a, (b, c) = 1, 2, 3, 4, 5 + * ^^^^ */ struct pm_node_list lefts; /** * MultiTargetNode#rest + * + * Represents a splat node in the target expression. + * + * a, (b, *c) = 1, 2, 3, 4 + * ^^ + * + * The variable can be empty, this results in a `SplatNode` with a `nil` expression field. + * + * a, (b, *) = 1, 2, 3, 4 + * ^ + * + * If the `*` is omitted, the field will containt an `ImplicitRestNode` + * + * a, (b,) = 1, 2, 3, 4 + * ^ */ struct pm_node *rest; /** * MultiTargetNode#rights + * + * Represents the targets expressions after a splat node. + * + * a, (*, b, c) = 1, 2, 3, 4, 5 + * ^^^^ */ struct pm_node_list rights; /** * MultiTargetNode#lparen_loc + * + * The location of the opening parenthesis. + * + * a, (b, c) = 1, 2, 3 + * ^ */ pm_location_t lparen_loc; /** * MultiTargetNode#rparen_loc + * + * The location of the closing parenthesis. + * + * a, (b, c) = 1, 2, 3 + * ^ */ pm_location_t rparen_loc; } pm_multi_target_node_t; /** * MultiWriteNode * + * Represents a write to a multi-target expression. + * + * a, b, c = 1, 2, 3 + * ^^^^^^^^^^^^^^^^^ + * * Type: PM_MULTI_WRITE_NODE * * @extends pm_node_t */ typedef struct pm_multi_write_node { /** The embedded base node. */ pm_node_t base; /** * MultiWriteNode#lefts + * + * Represents the targets expressions before a splat node. + * + * a, b, * = 1, 2, 3, 4, 5 + * ^^^^ + * + * The splat node can be absent, in that case all target expressions are in the left field. + * + * a, b, c = 1, 2, 3, 4, 5 + * ^^^^^^^ */ struct pm_node_list lefts; /** * MultiWriteNode#rest + * + * Represents a splat node in the target expression. + * + * a, b, *c = 1, 2, 3, 4 + * ^^ + * + * The variable can be empty, this results in a `SplatNode` with a `nil` expression field. + * + * a, b, * = 1, 2, 3, 4 + * ^ + * + * If the `*` is omitted, the field will containt an `ImplicitRestNode` + * + * a, b, = 1, 2, 3, 4 + * ^ */ struct pm_node *rest; /** * MultiWriteNode#rights + * + * Represents the targets expressions after a splat node. + * + * a, *, b, c = 1, 2, 3, 4, 5 + * ^^^^ */ struct pm_node_list rights; /** * MultiWriteNode#lparen_loc + * + * The location of the opening parenthesis. + * + * (a, b, c) = 1, 2, 3 + * ^ */ pm_location_t lparen_loc; /** * MultiWriteNode#rparen_loc + * + * The location of the closing parenthesis. + * + * (a, b, c) = 1, 2, 3 + * ^ */ pm_location_t rparen_loc; /** * MultiWriteNode#operator_loc + * + * The location of the operator. + * + * a, b, c = 1, 2, 3 + * ^ */ pm_location_t operator_loc; /** * MultiWriteNode#value + * + * 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). + * + * a, b, c = 1, 2, 3 + * ^^^^^^^ */ struct pm_node *value; } pm_multi_write_node_t; /** * NextNode * + * Represents the use of the `next` keyword. + * + * next 1 + * ^^^^^^ + * * Type: PM_NEXT_NODE * * @extends pm_node_t */ typedef struct pm_next_node { @@ -4834,10 +5564,15 @@ } pm_next_node_t; /** * NilNode * + * Represents the use of the `nil` keyword. + * + * nil + * ^^^ + * * Type: PM_NIL_NODE * * @extends pm_node_t */ typedef struct pm_nil_node { @@ -4846,10 +5581,16 @@ } pm_nil_node_t; /** * NoKeywordsParameterNode * + * Represents the use of `**nil` inside method arguments. + * + * def a(**nil) + * ^^^^^ + * end + * * Type: PM_NO_KEYWORDS_PARAMETER_NODE * * @extends pm_node_t */ typedef struct pm_no_keywords_parameter_node { @@ -4868,10 +5609,15 @@ } pm_no_keywords_parameter_node_t; /** * NumberedParametersNode * + * Represents an implicit set of parameters through the use of numbered parameters within a block or lambda. + * + * -> { _1 + _2 } + * ^^^^^^^^^^^^^^ + * * Type: PM_NUMBERED_PARAMETERS_NODE * * @extends pm_node_t */ typedef struct pm_numbered_parameters_node { @@ -4885,10 +5631,15 @@ } pm_numbered_parameters_node_t; /** * NumberedReferenceReadNode * + * Represents reading a numbered reference to a capture in the previous match. + * + * $1 + * ^^ + * * Type: PM_NUMBERED_REFERENCE_READ_NODE * * @extends pm_node_t */ typedef struct pm_numbered_reference_read_node { @@ -4910,10 +5661,16 @@ } pm_numbered_reference_read_node_t; /** * OptionalKeywordParameterNode * + * Represents an optional keyword parameter to a method, block, or lambda definition. + * + * def a(b: 1) + * ^^^^ + * end + * * Type: PM_OPTIONAL_KEYWORD_PARAMETER_NODE * Flags: * PM_PARAMETER_FLAGS_REPEATED_PARAMETER * * @extends pm_node_t @@ -4939,10 +5696,16 @@ } pm_optional_keyword_parameter_node_t; /** * OptionalParameterNode * + * Represents an optional parameter to a method, block, or lambda definition. + * + * def a(b = 1) + * ^^^^^ + * end + * * Type: PM_OPTIONAL_PARAMETER_NODE * Flags: * PM_PARAMETER_FLAGS_REPEATED_PARAMETER * * @extends pm_node_t @@ -4973,10 +5736,15 @@ } pm_optional_parameter_node_t; /** * OrNode * + * Represents the use of the `||` operator or the `or` keyword. + * + * left or right + * ^^^^^^^^^^^^^ + * * Type: PM_OR_NODE * * @extends pm_node_t */ typedef struct pm_or_node { @@ -5021,10 +5789,16 @@ } pm_or_node_t; /** * ParametersNode * + * Represents the list of parameters on a method, block, or lambda definition. + * + * def a(b, c, d) + * ^^^^^^^ + * end + * * Type: PM_PARAMETERS_NODE * * @extends pm_node_t */ typedef struct pm_parameters_node { @@ -5068,10 +5842,15 @@ } pm_parameters_node_t; /** * ParenthesesNode * + * Represents a parenthesized expression + * + * (10 + 34) + * ^^^^^^^^^ + * * Type: PM_PARENTHESES_NODE * * @extends pm_node_t */ typedef struct pm_parentheses_node { @@ -5095,10 +5874,15 @@ } pm_parentheses_node_t; /** * PinnedExpressionNode * + * Represents the use of the `^` operator for pinning an expression in a pattern matching expression. + * + * foo in ^(bar) + * ^^^^^^ + * * Type: PM_PINNED_EXPRESSION_NODE * * @extends pm_node_t */ typedef struct pm_pinned_expression_node { @@ -5127,10 +5911,15 @@ } pm_pinned_expression_node_t; /** * PinnedVariableNode * + * Represents the use of the `^` operator for pinning a variable in a pattern matching expression. + * + * foo in ^bar + * ^^^^ + * * Type: PM_PINNED_VARIABLE_NODE * * @extends pm_node_t */ typedef struct pm_pinned_variable_node { @@ -5149,10 +5938,15 @@ } pm_pinned_variable_node_t; /** * PostExecutionNode * + * Represents the use of the `END` keyword. + * + * END { foo } + * ^^^^^^^^^^^ + * * Type: PM_POST_EXECUTION_NODE * * @extends pm_node_t */ typedef struct pm_post_execution_node { @@ -5181,10 +5975,15 @@ } pm_post_execution_node_t; /** * PreExecutionNode * + * Represents the use of the `BEGIN` keyword. + * + * BEGIN { foo } + * ^^^^^^^^^^^^^ + * * Type: PM_PRE_EXECUTION_NODE * * @extends pm_node_t */ typedef struct pm_pre_execution_node { @@ -5213,10 +6012,12 @@ } pm_pre_execution_node_t; /** * ProgramNode * + * The top level node of any parse tree. + * * Type: PM_PROGRAM_NODE * * @extends pm_node_t */ typedef struct pm_program_node { @@ -5235,10 +6036,18 @@ } pm_program_node_t; /** * RangeNode * + * Represents the use of the `..` or `...` operators. + * + * 1..2 + * ^^^^ + * + * c if a =~ /left/ ... b =~ /right/ + * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + * * Type: PM_RANGE_NODE * Flags: * PM_RANGE_FLAGS_EXCLUDE_END * * @extends pm_node_t @@ -5283,10 +6092,15 @@ } pm_range_node_t; /** * RationalNode * + * Represents a rational number literal. + * + * 1.0r + * ^^^^ + * * Type: PM_RATIONAL_NODE * Flags: * PM_INTEGER_BASE_FLAGS_BINARY * PM_INTEGER_BASE_FLAGS_DECIMAL * PM_INTEGER_BASE_FLAGS_OCTAL @@ -5318,10 +6132,15 @@ } pm_rational_node_t; /** * RedoNode * + * Represents the use of the `redo` keyword. + * + * redo + * ^^^^ + * * Type: PM_REDO_NODE * * @extends pm_node_t */ typedef struct pm_redo_node { @@ -5330,10 +6149,15 @@ } pm_redo_node_t; /** * RegularExpressionNode * + * Represents a regular expression literal with no interpolation. + * + * /foo/i + * ^^^^^^ + * * Type: PM_REGULAR_EXPRESSION_NODE * Flags: * PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE * PM_REGULAR_EXPRESSION_FLAGS_EXTENDED * PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE @@ -5374,10 +6198,16 @@ } pm_regular_expression_node_t; /** * RequiredKeywordParameterNode * + * Represents a required keyword parameter to a method, block, or lambda definition. + * + * def a(b: ) + * ^^ + * end + * * Type: PM_REQUIRED_KEYWORD_PARAMETER_NODE * Flags: * PM_PARAMETER_FLAGS_REPEATED_PARAMETER * * @extends pm_node_t @@ -5398,10 +6228,16 @@ } pm_required_keyword_parameter_node_t; /** * RequiredParameterNode * + * Represents a required parameter to a method, block, or lambda definition. + * + * def a(b) + * ^ + * end + * * Type: PM_REQUIRED_PARAMETER_NODE * Flags: * PM_PARAMETER_FLAGS_REPEATED_PARAMETER * * @extends pm_node_t @@ -5417,10 +6253,15 @@ } pm_required_parameter_node_t; /** * RescueModifierNode * + * Represents an expression modified with a rescue. + * + * foo rescue nil + * ^^^^^^^^^^^^^^ + * * Type: PM_RESCUE_MODIFIER_NODE * * @extends pm_node_t */ typedef struct pm_rescue_modifier_node { @@ -5444,10 +6285,20 @@ } pm_rescue_modifier_node_t; /** * RescueNode * + * Represents a rescue statement. + * + * begin + * rescue Foo, *splat, Bar => ex + * foo + * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + * end + * + * `Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `exception` field. + * * Type: PM_RESCUE_NODE * * @extends pm_node_t */ typedef struct pm_rescue_node { @@ -5478,18 +6329,24 @@ * RescueNode#statements */ struct pm_statements_node *statements; /** - * RescueNode#consequent + * RescueNode#subsequent */ - struct pm_rescue_node *consequent; + struct pm_rescue_node *subsequent; } pm_rescue_node_t; /** * RestParameterNode * + * Represents a rest parameter to a method, block, or lambda definition. + * + * def a(*b) + * ^^ + * end + * * Type: PM_REST_PARAMETER_NODE * Flags: * PM_PARAMETER_FLAGS_REPEATED_PARAMETER * * @extends pm_node_t @@ -5515,10 +6372,15 @@ } pm_rest_parameter_node_t; /** * RetryNode * + * Represents the use of the `retry` keyword. + * + * retry + * ^^^^^ + * * Type: PM_RETRY_NODE * * @extends pm_node_t */ typedef struct pm_retry_node { @@ -5527,13 +6389,16 @@ } pm_retry_node_t; /** * ReturnNode * + * Represents the use of the `return` keyword. + * + * return 1 + * ^^^^^^^^ + * * Type: PM_RETURN_NODE - * Flags: - * PM_RETURN_NODE_FLAGS_REDUNDANT * * @extends pm_node_t */ typedef struct pm_return_node { /** The embedded base node. */ @@ -5551,10 +6416,15 @@ } pm_return_node_t; /** * SelfNode * + * Represents the `self` keyword. + * + * self + * ^^^^ + * * Type: PM_SELF_NODE * * @extends pm_node_t */ typedef struct pm_self_node { @@ -5563,10 +6433,16 @@ } pm_self_node_t; /** * ShareableConstantNode * + * This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified. + * + * # shareable_constant_value: literal + * C = { a: 1 } + * ^^^^^^^^^^^^ + * * Type: PM_SHAREABLE_CONSTANT_NODE * Flags: * PM_SHAREABLE_CONSTANT_NODE_FLAGS_LITERAL * PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_EVERYTHING * PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_COPY @@ -5586,10 +6462,15 @@ } pm_shareable_constant_node_t; /** * SingletonClassNode * + * Represents a singleton class declaration involving the `class` keyword. + * + * class << self end + * ^^^^^^^^^^^^^^^^^ + * * Type: PM_SINGLETON_CLASS_NODE * * @extends pm_node_t */ typedef struct pm_singleton_class_node { @@ -5628,10 +6509,15 @@ } pm_singleton_class_node_t; /** * SourceEncodingNode * + * Represents the use of the `__ENCODING__` keyword. + * + * __ENCODING__ + * ^^^^^^^^^^^^ + * * Type: PM_SOURCE_ENCODING_NODE * * @extends pm_node_t */ typedef struct pm_source_encoding_node { @@ -5640,10 +6526,15 @@ } pm_source_encoding_node_t; /** * SourceFileNode * + * Represents the use of the `__FILE__` keyword. + * + * __FILE__ + * ^^^^^^^^ + * * Type: PM_SOURCE_FILE_NODE * Flags: * PM_STRING_FLAGS_FORCED_UTF8_ENCODING * PM_STRING_FLAGS_FORCED_BINARY_ENCODING * PM_STRING_FLAGS_FROZEN @@ -5664,10 +6555,15 @@ } pm_source_file_node_t; /** * SourceLineNode * + * Represents the use of the `__LINE__` keyword. + * + * __LINE__ + * ^^^^^^^^ + * * Type: PM_SOURCE_LINE_NODE * * @extends pm_node_t */ typedef struct pm_source_line_node { @@ -5676,10 +6572,15 @@ } pm_source_line_node_t; /** * SplatNode * + * Represents the use of the splat operator. + * + * [*a] + * ^^ + * * Type: PM_SPLAT_NODE * * @extends pm_node_t */ typedef struct pm_splat_node { @@ -5698,10 +6599,15 @@ } pm_splat_node_t; /** * StatementsNode * + * Represents a set of statements contained within some scope. + * + * foo; bar; baz + * ^^^^^^^^^^^^^ + * * Type: PM_STATEMENTS_NODE * * @extends pm_node_t */ typedef struct pm_statements_node { @@ -5715,10 +6621,21 @@ } pm_statements_node_t; /** * StringNode * + * Represents a string literal, a string contained within a `%w` list, or plain string content within an interpolated string. + * + * "foo" + * ^^^^^ + * + * %w[foo] + * ^^^ + * + * "foo #{bar} baz" + * ^^^^ ^^^^ + * * Type: PM_STRING_NODE * Flags: * PM_STRING_FLAGS_FORCED_UTF8_ENCODING * PM_STRING_FLAGS_FORCED_BINARY_ENCODING * PM_STRING_FLAGS_FROZEN @@ -5752,10 +6669,18 @@ } pm_string_node_t; /** * SuperNode * + * Represents the use of the `super` keyword with parentheses or arguments. + * + * super() + * ^^^^^^^ + * + * super foo, bar + * ^^^^^^^^^^^^^^ + * * Type: PM_SUPER_NODE * * @extends pm_node_t */ typedef struct pm_super_node { @@ -5789,10 +6714,18 @@ } pm_super_node_t; /** * SymbolNode * + * Represents a symbol literal or a symbol contained within a `%i` list. + * + * :foo + * ^^^^ + * + * %i[foo] + * ^^^ + * * Type: PM_SYMBOL_NODE * Flags: * PM_SYMBOL_FLAGS_FORCED_UTF8_ENCODING * PM_SYMBOL_FLAGS_FORCED_BINARY_ENCODING * PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING @@ -5825,10 +6758,15 @@ } pm_symbol_node_t; /** * TrueNode * + * Represents the use of the literal `true` keyword. + * + * true + * ^^^^ + * * Type: PM_TRUE_NODE * * @extends pm_node_t */ typedef struct pm_true_node { @@ -5837,10 +6775,15 @@ } pm_true_node_t; /** * UndefNode * + * Represents the use of the `undef` keyword. + * + * undef :foo, :bar, :baz + * ^^^^^^^^^^^^^^^^^^^^^^ + * * Type: PM_UNDEF_NODE * * @extends pm_node_t */ typedef struct pm_undef_node { @@ -5859,10 +6802,18 @@ } pm_undef_node_t; /** * UnlessNode * + * Represents the use of the `unless` keyword, either in the block form or the modifier form. + * + * bar unless foo + * ^^^^^^^^^^^^^^ + * + * unless foo then bar end + * ^^^^^^^^^^^^^^^^^^^^^^^ + * * Type: PM_UNLESS_NODE * * @extends pm_node_t */ typedef struct pm_unless_node { @@ -5915,18 +6866,18 @@ * ^^^ */ struct pm_statements_node *statements; /** - * UnlessNode#consequent + * UnlessNode#else_clause * * The else clause of the unless expression, if present. * * unless cond then bar else baz end * ^^^^^^^^ */ - struct pm_else_node *consequent; + struct pm_else_node *else_clause; /** * UnlessNode#end_keyword_loc * * The location of the `end` keyword, if present. @@ -5938,10 +6889,18 @@ } pm_unless_node_t; /** * UntilNode * + * Represents the use of the `until` keyword, either in the block form or the modifier form. + * + * bar until foo + * ^^^^^^^^^^^^^ + * + * until foo do bar end + * ^^^^^^^^^^^^^^^^^^^^ + * * Type: PM_UNTIL_NODE * Flags: * PM_LOOP_FLAGS_BEGIN_MODIFIER * * @extends pm_node_t @@ -5972,10 +6931,17 @@ } pm_until_node_t; /** * WhenNode * + * Represents the use of the `when` keyword within a case statement. + * + * case true + * when true + * ^^^^^^^^^ + * end + * * Type: PM_WHEN_NODE * * @extends pm_node_t */ typedef struct pm_when_node { @@ -6004,10 +6970,18 @@ } pm_when_node_t; /** * WhileNode * + * Represents the use of the `while` keyword, either in the block form or the modifier form. + * + * bar while foo + * ^^^^^^^^^^^^^ + * + * while foo do bar end + * ^^^^^^^^^^^^^^^^^^^^ + * * Type: PM_WHILE_NODE * Flags: * PM_LOOP_FLAGS_BEGIN_MODIFIER * * @extends pm_node_t @@ -6038,10 +7012,15 @@ } pm_while_node_t; /** * XStringNode * + * Represents an xstring literal with no interpolation. + * + * `foo` + * ^^^^^ + * * Type: PM_X_STRING_NODE * Flags: * PM_ENCODING_FLAGS_FORCED_UTF8_ENCODING * PM_ENCODING_FLAGS_FORCED_BINARY_ENCODING * @@ -6073,10 +7052,15 @@ } pm_x_string_node_t; /** * YieldNode * + * Represents the use of the `yield` keyword. + * + * yield 1 + * ^^^^^^^ + * * Type: PM_YIELD_NODE * * @extends pm_node_t */ typedef struct pm_yield_node { @@ -6107,200 +7091,195 @@ /** * Flags for arguments nodes. */ typedef enum pm_arguments_node_flags { /** if arguments contain keywords */ - PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS = 1, + PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS = 4, /** if arguments contain keyword splat */ - PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT = 2, + PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT = 8, + + /** if arguments contain splat */ + PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT = 16, } pm_arguments_node_flags_t; /** * Flags for array nodes. */ typedef enum pm_array_node_flags { /** if array contains splat nodes */ - PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT = 1, + PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT = 4, } pm_array_node_flags_t; /** * Flags for call nodes. */ typedef enum pm_call_node_flags { /** &. operator */ - PM_CALL_NODE_FLAGS_SAFE_NAVIGATION = 1, + PM_CALL_NODE_FLAGS_SAFE_NAVIGATION = 4, /** a call that could have been a local variable */ - PM_CALL_NODE_FLAGS_VARIABLE_CALL = 2, + PM_CALL_NODE_FLAGS_VARIABLE_CALL = 8, /** a call that is an attribute write, so the value being written should be returned */ - PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE = 4, + PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE = 16, /** a call that ignores method visibility */ - PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY = 8, + PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY = 32, } pm_call_node_flags_t; /** * Flags for nodes that have unescaped content. */ typedef enum pm_encoding_flags { /** internal bytes forced the encoding to UTF-8 */ - PM_ENCODING_FLAGS_FORCED_UTF8_ENCODING = 1, + PM_ENCODING_FLAGS_FORCED_UTF8_ENCODING = 4, /** internal bytes forced the encoding to binary */ - PM_ENCODING_FLAGS_FORCED_BINARY_ENCODING = 2, + PM_ENCODING_FLAGS_FORCED_BINARY_ENCODING = 8, } pm_encoding_flags_t; /** * Flags for integer nodes that correspond to the base of the integer. */ typedef enum pm_integer_base_flags { /** 0b prefix */ - PM_INTEGER_BASE_FLAGS_BINARY = 1, + PM_INTEGER_BASE_FLAGS_BINARY = 4, /** 0d or no prefix */ - PM_INTEGER_BASE_FLAGS_DECIMAL = 2, + PM_INTEGER_BASE_FLAGS_DECIMAL = 8, /** 0o or 0 prefix */ - PM_INTEGER_BASE_FLAGS_OCTAL = 4, + PM_INTEGER_BASE_FLAGS_OCTAL = 16, /** 0x prefix */ - PM_INTEGER_BASE_FLAGS_HEXADECIMAL = 8, + PM_INTEGER_BASE_FLAGS_HEXADECIMAL = 32, } pm_integer_base_flags_t; /** * Flags for interpolated string nodes that indicated mutability if they are also marked as literals. */ typedef enum pm_interpolated_string_node_flags { /** frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'` */ - PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN = 1, + PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN = 4, /** mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'` */ - PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE = 2, + PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE = 8, } pm_interpolated_string_node_flags_t; /** * Flags for keyword hash nodes. */ typedef enum pm_keyword_hash_node_flags { /** a keyword hash which only has `AssocNode` elements all with symbol keys, which means the elements can be treated as keyword arguments */ - PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS = 1, + PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS = 4, } pm_keyword_hash_node_flags_t; /** * Flags for while and until loop nodes. */ typedef enum pm_loop_flags { /** a loop after a begin statement, so the body is executed first before the condition */ - PM_LOOP_FLAGS_BEGIN_MODIFIER = 1, + PM_LOOP_FLAGS_BEGIN_MODIFIER = 4, } pm_loop_flags_t; /** * Flags for parameter nodes. */ typedef enum pm_parameter_flags { /** a parameter name that has been repeated in the method signature */ - PM_PARAMETER_FLAGS_REPEATED_PARAMETER = 1, + PM_PARAMETER_FLAGS_REPEATED_PARAMETER = 4, } pm_parameter_flags_t; /** * Flags for range and flip-flop nodes. */ typedef enum pm_range_flags { /** ... operator */ - PM_RANGE_FLAGS_EXCLUDE_END = 1, + PM_RANGE_FLAGS_EXCLUDE_END = 4, } pm_range_flags_t; /** * Flags for regular expression and match last line nodes. */ typedef enum pm_regular_expression_flags { /** i - ignores the case of characters when matching */ - PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE = 1, + PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE = 4, /** x - ignores whitespace and allows comments in regular expressions */ - PM_REGULAR_EXPRESSION_FLAGS_EXTENDED = 2, + PM_REGULAR_EXPRESSION_FLAGS_EXTENDED = 8, /** m - allows $ to match the end of lines within strings */ - PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE = 4, + PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE = 16, /** o - only interpolates values into the regular expression once */ - PM_REGULAR_EXPRESSION_FLAGS_ONCE = 8, + PM_REGULAR_EXPRESSION_FLAGS_ONCE = 32, /** e - forces the EUC-JP encoding */ - PM_REGULAR_EXPRESSION_FLAGS_EUC_JP = 16, + PM_REGULAR_EXPRESSION_FLAGS_EUC_JP = 64, /** n - forces the ASCII-8BIT encoding */ - PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT = 32, + PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT = 128, /** s - forces the Windows-31J encoding */ - PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J = 64, + PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J = 256, /** u - forces the UTF-8 encoding */ - PM_REGULAR_EXPRESSION_FLAGS_UTF_8 = 128, + PM_REGULAR_EXPRESSION_FLAGS_UTF_8 = 512, /** internal bytes forced the encoding to UTF-8 */ - PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING = 256, + PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING = 1024, /** internal bytes forced the encoding to binary */ - PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING = 512, + PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING = 2048, /** internal bytes forced the encoding to US-ASCII */ - PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING = 1024, + PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING = 4096, } pm_regular_expression_flags_t; /** - * Flags for return nodes. - */ -typedef enum pm_return_node_flags { - /** a return statement that is redundant because it is the last statement in a method */ - PM_RETURN_NODE_FLAGS_REDUNDANT = 1, -} pm_return_node_flags_t; - -/** * Flags for shareable constant nodes. */ typedef enum pm_shareable_constant_node_flags { /** constant writes that should be modified with shareable constant value literal */ - PM_SHAREABLE_CONSTANT_NODE_FLAGS_LITERAL = 1, + PM_SHAREABLE_CONSTANT_NODE_FLAGS_LITERAL = 4, /** constant writes that should be modified with shareable constant value experimental everything */ - PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_EVERYTHING = 2, + PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_EVERYTHING = 8, /** constant writes that should be modified with shareable constant value experimental copy */ - PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_COPY = 4, + PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_COPY = 16, } pm_shareable_constant_node_flags_t; /** * Flags for string nodes. */ typedef enum pm_string_flags { /** internal bytes forced the encoding to UTF-8 */ - PM_STRING_FLAGS_FORCED_UTF8_ENCODING = 1, + PM_STRING_FLAGS_FORCED_UTF8_ENCODING = 4, /** internal bytes forced the encoding to binary */ - PM_STRING_FLAGS_FORCED_BINARY_ENCODING = 2, + PM_STRING_FLAGS_FORCED_BINARY_ENCODING = 8, /** frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal` */ - PM_STRING_FLAGS_FROZEN = 4, + PM_STRING_FLAGS_FROZEN = 16, /** mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal` */ - PM_STRING_FLAGS_MUTABLE = 8, + PM_STRING_FLAGS_MUTABLE = 32, } pm_string_flags_t; /** * Flags for symbol nodes. */ typedef enum pm_symbol_flags { /** internal bytes forced the encoding to UTF-8 */ - PM_SYMBOL_FLAGS_FORCED_UTF8_ENCODING = 1, + PM_SYMBOL_FLAGS_FORCED_UTF8_ENCODING = 4, /** internal bytes forced the encoding to binary */ - PM_SYMBOL_FLAGS_FORCED_BINARY_ENCODING = 2, + PM_SYMBOL_FLAGS_FORCED_BINARY_ENCODING = 8, /** internal bytes forced the encoding to US-ASCII */ - PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING = 4, + PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING = 16, } pm_symbol_flags_t; /** * When we're serializing to Java, we want to skip serializing the location * fields as they won't be used by JRuby or TruffleRuby. This boolean allows us