Ruby
3.4.0dev (2024-11-22 revision 0989400a925cd201defdca9eb28eb87200b30785)
|
The abstract syntax tree. More...
#include "prism/defines.h"
#include "prism/util/pm_constant_pool.h"
#include "prism/util/pm_integer.h"
#include "prism/util/pm_string.h"
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | pm_token_t |
This struct represents a token in the Ruby source. More... | |
struct | pm_location_t |
This represents a range of bytes in the source string to which a node or token corresponds. More... | |
struct | pm_node_list |
A list of nodes in the source, most often used for lists of children. More... | |
struct | pm_node |
This is the base structure that represents a node in the syntax tree. More... | |
struct | pm_alias_global_variable_node |
AliasGlobalVariableNode. More... | |
struct | pm_alias_method_node |
AliasMethodNode. More... | |
struct | pm_alternation_pattern_node |
AlternationPatternNode. More... | |
struct | pm_and_node |
AndNode. More... | |
struct | pm_arguments_node |
ArgumentsNode. More... | |
struct | pm_array_node |
ArrayNode. More... | |
struct | pm_array_pattern_node |
ArrayPatternNode. More... | |
struct | pm_assoc_node |
AssocNode. More... | |
struct | pm_assoc_splat_node |
AssocSplatNode. More... | |
struct | pm_back_reference_read_node |
BackReferenceReadNode. More... | |
struct | pm_begin_node |
BeginNode. More... | |
struct | pm_block_argument_node |
BlockArgumentNode. More... | |
struct | pm_block_local_variable_node |
BlockLocalVariableNode. More... | |
struct | pm_block_node |
BlockNode. More... | |
struct | pm_block_parameter_node |
BlockParameterNode. More... | |
struct | pm_block_parameters_node |
BlockParametersNode. More... | |
struct | pm_break_node |
BreakNode. More... | |
struct | pm_call_and_write_node |
CallAndWriteNode. More... | |
struct | pm_call_node |
CallNode. More... | |
struct | pm_call_operator_write_node |
CallOperatorWriteNode. More... | |
struct | pm_call_or_write_node |
CallOrWriteNode. More... | |
struct | pm_call_target_node |
CallTargetNode. More... | |
struct | pm_capture_pattern_node |
CapturePatternNode. More... | |
struct | pm_case_match_node |
CaseMatchNode. More... | |
struct | pm_case_node |
CaseNode. More... | |
struct | pm_class_node |
ClassNode. More... | |
struct | pm_class_variable_and_write_node |
ClassVariableAndWriteNode. More... | |
struct | pm_class_variable_operator_write_node |
ClassVariableOperatorWriteNode. More... | |
struct | pm_class_variable_or_write_node |
ClassVariableOrWriteNode. More... | |
struct | pm_class_variable_read_node |
ClassVariableReadNode. More... | |
struct | pm_class_variable_target_node |
ClassVariableTargetNode. More... | |
struct | pm_class_variable_write_node |
ClassVariableWriteNode. More... | |
struct | pm_constant_and_write_node |
ConstantAndWriteNode. More... | |
struct | pm_constant_operator_write_node |
ConstantOperatorWriteNode. More... | |
struct | pm_constant_or_write_node |
ConstantOrWriteNode. More... | |
struct | pm_constant_path_and_write_node |
ConstantPathAndWriteNode. More... | |
struct | pm_constant_path_node |
ConstantPathNode. More... | |
struct | pm_constant_path_operator_write_node |
ConstantPathOperatorWriteNode. More... | |
struct | pm_constant_path_or_write_node |
ConstantPathOrWriteNode. More... | |
struct | pm_constant_path_target_node |
ConstantPathTargetNode. More... | |
struct | pm_constant_path_write_node |
ConstantPathWriteNode. More... | |
struct | pm_constant_read_node |
ConstantReadNode. More... | |
struct | pm_constant_target_node |
ConstantTargetNode. More... | |
struct | pm_constant_write_node |
ConstantWriteNode. More... | |
struct | pm_def_node |
DefNode. More... | |
struct | pm_defined_node |
DefinedNode. More... | |
struct | pm_else_node |
ElseNode. More... | |
struct | pm_embedded_statements_node |
EmbeddedStatementsNode. More... | |
struct | pm_embedded_variable_node |
EmbeddedVariableNode. More... | |
struct | pm_ensure_node |
EnsureNode. More... | |
struct | pm_false_node |
FalseNode. More... | |
struct | pm_find_pattern_node |
FindPatternNode. More... | |
struct | pm_flip_flop_node |
FlipFlopNode. More... | |
struct | pm_float_node |
FloatNode. More... | |
struct | pm_for_node |
ForNode. More... | |
struct | pm_forwarding_arguments_node |
ForwardingArgumentsNode. More... | |
struct | pm_forwarding_parameter_node |
ForwardingParameterNode. More... | |
struct | pm_forwarding_super_node |
ForwardingSuperNode. More... | |
struct | pm_global_variable_and_write_node |
GlobalVariableAndWriteNode. More... | |
struct | pm_global_variable_operator_write_node |
GlobalVariableOperatorWriteNode. More... | |
struct | pm_global_variable_or_write_node |
GlobalVariableOrWriteNode. More... | |
struct | pm_global_variable_read_node |
GlobalVariableReadNode. More... | |
struct | pm_global_variable_target_node |
GlobalVariableTargetNode. More... | |
struct | pm_global_variable_write_node |
GlobalVariableWriteNode. More... | |
struct | pm_hash_node |
HashNode. More... | |
struct | pm_hash_pattern_node |
HashPatternNode. More... | |
struct | pm_if_node |
IfNode. More... | |
struct | pm_imaginary_node |
ImaginaryNode. More... | |
struct | pm_implicit_node |
ImplicitNode. More... | |
struct | pm_implicit_rest_node |
ImplicitRestNode. More... | |
struct | pm_in_node |
InNode. More... | |
struct | pm_index_and_write_node |
IndexAndWriteNode. More... | |
struct | pm_index_operator_write_node |
IndexOperatorWriteNode. More... | |
struct | pm_index_or_write_node |
IndexOrWriteNode. More... | |
struct | pm_index_target_node |
IndexTargetNode. More... | |
struct | pm_instance_variable_and_write_node |
InstanceVariableAndWriteNode. More... | |
struct | pm_instance_variable_operator_write_node |
InstanceVariableOperatorWriteNode. More... | |
struct | pm_instance_variable_or_write_node |
InstanceVariableOrWriteNode. More... | |
struct | pm_instance_variable_read_node |
InstanceVariableReadNode. More... | |
struct | pm_instance_variable_target_node |
InstanceVariableTargetNode. More... | |
struct | pm_instance_variable_write_node |
InstanceVariableWriteNode. More... | |
struct | pm_integer_node |
IntegerNode. More... | |
struct | pm_interpolated_match_last_line_node |
InterpolatedMatchLastLineNode. More... | |
struct | pm_interpolated_regular_expression_node |
InterpolatedRegularExpressionNode. More... | |
struct | pm_interpolated_string_node |
InterpolatedStringNode. More... | |
struct | pm_interpolated_symbol_node |
InterpolatedSymbolNode. More... | |
struct | pm_interpolated_x_string_node |
InterpolatedXStringNode. More... | |
struct | pm_it_local_variable_read_node |
ItLocalVariableReadNode. More... | |
struct | pm_it_parameters_node |
ItParametersNode. More... | |
struct | pm_keyword_hash_node |
KeywordHashNode. More... | |
struct | pm_keyword_rest_parameter_node |
KeywordRestParameterNode. More... | |
struct | pm_lambda_node |
LambdaNode. More... | |
struct | pm_local_variable_and_write_node |
LocalVariableAndWriteNode. More... | |
struct | pm_local_variable_operator_write_node |
LocalVariableOperatorWriteNode. More... | |
struct | pm_local_variable_or_write_node |
LocalVariableOrWriteNode. More... | |
struct | pm_local_variable_read_node |
LocalVariableReadNode. More... | |
struct | pm_local_variable_target_node |
LocalVariableTargetNode. More... | |
struct | pm_local_variable_write_node |
LocalVariableWriteNode. More... | |
struct | pm_match_last_line_node |
MatchLastLineNode. More... | |
struct | pm_match_predicate_node |
MatchPredicateNode. More... | |
struct | pm_match_required_node |
MatchRequiredNode. More... | |
struct | pm_match_write_node |
MatchWriteNode. More... | |
struct | pm_missing_node |
MissingNode. More... | |
struct | pm_module_node |
ModuleNode. More... | |
struct | pm_multi_target_node |
MultiTargetNode. More... | |
struct | pm_multi_write_node |
MultiWriteNode. More... | |
struct | pm_next_node |
NextNode. More... | |
struct | pm_nil_node |
NilNode. More... | |
struct | pm_no_keywords_parameter_node |
NoKeywordsParameterNode. More... | |
struct | pm_numbered_parameters_node |
NumberedParametersNode. More... | |
struct | pm_numbered_reference_read_node |
NumberedReferenceReadNode. More... | |
struct | pm_optional_keyword_parameter_node |
OptionalKeywordParameterNode. More... | |
struct | pm_optional_parameter_node |
OptionalParameterNode. More... | |
struct | pm_or_node |
OrNode. More... | |
struct | pm_parameters_node |
ParametersNode. More... | |
struct | pm_parentheses_node |
ParenthesesNode. More... | |
struct | pm_pinned_expression_node |
PinnedExpressionNode. More... | |
struct | pm_pinned_variable_node |
PinnedVariableNode. More... | |
struct | pm_post_execution_node |
PostExecutionNode. More... | |
struct | pm_pre_execution_node |
PreExecutionNode. More... | |
struct | pm_program_node |
ProgramNode. More... | |
struct | pm_range_node |
RangeNode. More... | |
struct | pm_rational_node |
RationalNode. More... | |
struct | pm_redo_node |
RedoNode. More... | |
struct | pm_regular_expression_node |
RegularExpressionNode. More... | |
struct | pm_required_keyword_parameter_node |
RequiredKeywordParameterNode. More... | |
struct | pm_required_parameter_node |
RequiredParameterNode. More... | |
struct | pm_rescue_modifier_node |
RescueModifierNode. More... | |
struct | pm_rescue_node |
RescueNode. More... | |
struct | pm_rest_parameter_node |
RestParameterNode. More... | |
struct | pm_retry_node |
RetryNode. More... | |
struct | pm_return_node |
ReturnNode. More... | |
struct | pm_self_node |
SelfNode. More... | |
struct | pm_shareable_constant_node |
ShareableConstantNode. More... | |
struct | pm_singleton_class_node |
SingletonClassNode. More... | |
struct | pm_source_encoding_node |
SourceEncodingNode. More... | |
struct | pm_source_file_node |
SourceFileNode. More... | |
struct | pm_source_line_node |
SourceLineNode. More... | |
struct | pm_splat_node |
SplatNode. More... | |
struct | pm_statements_node |
StatementsNode. More... | |
struct | pm_string_node |
StringNode. More... | |
struct | pm_super_node |
SuperNode. More... | |
struct | pm_symbol_node |
SymbolNode. More... | |
struct | pm_true_node |
TrueNode. More... | |
struct | pm_undef_node |
UndefNode. More... | |
struct | pm_unless_node |
UnlessNode. More... | |
struct | pm_until_node |
UntilNode. More... | |
struct | pm_when_node |
WhenNode. More... | |
struct | pm_while_node |
WhileNode. More... | |
struct | pm_x_string_node |
XStringNode. More... | |
struct | pm_yield_node |
YieldNode. More... | |
Macros | |
#define | PM_NODE_TYPE(node) ((enum pm_node_type) (node)->type) |
Cast the type to an enum to allow the compiler to provide exhaustiveness checking. More... | |
#define | PM_NODE_TYPE_P(node, type) (PM_NODE_TYPE(node) == (type)) |
Return true if the type of the given node matches the given type. More... | |
#define | PM_NODE_FLAG_P(node, flag) ((((pm_node_t *)(node))->flags & (flag)) != 0) |
Return true if the given flag is set on the given node. More... | |
#define | PRISM_SERIALIZE_ONLY_SEMANTICS_FIELDS 0 |
When we're serializing to Java, we want to skip serializing the location fields as they won't be used by JRuby or TruffleRuby. More... | |
Variables | |
static const pm_node_flags_t | PM_NODE_FLAG_NEWLINE = 0x1 |
We store the flags enum in every node in the tree. More... | |
static const pm_node_flags_t | PM_NODE_FLAG_STATIC_LITERAL = 0x2 |
The abstract syntax tree.
Definition in file ast.h.
#define PM_NODE_FLAG_P | ( | node, | |
flag | |||
) | ((((pm_node_t *)(node))->flags & (flag)) != 0) |
#define PM_NODE_TYPE | ( | node | ) | ((enum pm_node_type) (node)->type) |
#define PM_NODE_TYPE_P | ( | node, | |
type | |||
) | (PM_NODE_TYPE(node) == (type)) |
#define PRISM_SERIALIZE_ONLY_SEMANTICS_FIELDS 0 |
typedef struct pm_alias_global_variable_node pm_alias_global_variable_node_t |
AliasGlobalVariableNode.
Represents the use of the alias
keyword to alias a global variable.
alias $foo $bar ^^^^^^^^^^^^^^^
typedef struct pm_alias_method_node pm_alias_method_node_t |
AliasMethodNode.
Represents the use of the alias
keyword to alias a method.
alias foo bar ^^^^^^^^^^^^^
Type: PM_ALIAS_METHOD_NODE
typedef struct pm_alternation_pattern_node pm_alternation_pattern_node_t |
AlternationPatternNode.
Represents an alternation pattern in pattern matching.
foo => bar | baz ^^^^^^^^^
typedef struct pm_and_node pm_and_node_t |
AndNode.
Represents the use of the &&
operator or the and
keyword.
left and right ^^^^^^^^^^^^^^
Type: PM_AND_NODE
typedef enum pm_arguments_node_flags pm_arguments_node_flags_t |
Flags for arguments nodes.
typedef struct pm_arguments_node pm_arguments_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):
typedef enum pm_array_node_flags pm_array_node_flags_t |
Flags for array nodes.
typedef struct pm_array_node pm_array_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):
typedef struct pm_array_pattern_node pm_array_pattern_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
typedef struct pm_assoc_node pm_assoc_node_t |
typedef struct pm_assoc_splat_node pm_assoc_splat_node_t |
typedef struct pm_back_reference_read_node pm_back_reference_read_node_t |
BackReferenceReadNode.
Represents reading a reference to a field in the previous match.
$' ^^
typedef struct pm_begin_node pm_begin_node_t |
typedef struct pm_block_argument_node pm_block_argument_node_t |
BlockArgumentNode.
Represents a block argument using &
.
bar(&args) ^^^^^^^^^^
Type: PM_BLOCK_ARGUMENT_NODE
typedef struct pm_block_local_variable_node pm_block_local_variable_node_t |
BlockLocalVariableNode.
Represents a block local variable.
a { |; b| } ^
Type: PM_BLOCK_LOCAL_VARIABLE_NODE
Flags (pm_parameter_flags):
typedef struct pm_block_node pm_block_node_t |
BlockNode.
Represents a block of ruby code.
[1, 2, 3].each { |i| puts x } ^^^^^^^^^^^^^^
Type: PM_BLOCK_NODE
typedef struct pm_block_parameter_node pm_block_parameter_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):
typedef struct pm_block_parameters_node pm_block_parameters_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
typedef struct pm_break_node pm_break_node_t |
typedef struct pm_call_and_write_node pm_call_and_write_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):
typedef enum pm_call_node_flags pm_call_node_flags_t |
Flags for call nodes.
typedef struct pm_call_node pm_call_node_t |
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):
typedef struct pm_call_operator_write_node pm_call_operator_write_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):
typedef struct pm_call_or_write_node pm_call_or_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):
typedef struct pm_call_target_node pm_call_target_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):
typedef struct pm_capture_pattern_node pm_capture_pattern_node_t |
CapturePatternNode.
Represents assigning to a local variable in pattern matching.
foo => [bar => baz] ^^^^^^^^^^^^
Type: PM_CAPTURE_PATTERN_NODE
typedef struct pm_case_match_node pm_case_match_node_t |
CaseMatchNode.
Represents the use of a case statement for pattern matching.
case true in false end ^^^^^^^^^
Type: PM_CASE_MATCH_NODE
typedef struct pm_case_node pm_case_node_t |
CaseNode.
Represents the use of a case statement.
case true when false end ^^^^^^^^^^
Type: PM_CASE_NODE
typedef struct pm_class_node pm_class_node_t |
ClassNode.
Represents a class declaration involving the class
keyword.
class Foo end ^^^^^^^^^^^^^
Type: PM_CLASS_NODE
ClassVariableAndWriteNode.
Represents the use of the &&=
operator for assignment to a class variable.
@@target &&= value ^^^^^^^^^^^^^^^^^^
ClassVariableOperatorWriteNode.
Represents assigning to a class variable using an operator that isn't =
.
@@target += value ^^^^^^^^^^^^^^^^^
typedef struct pm_class_variable_or_write_node pm_class_variable_or_write_node_t |
ClassVariableOrWriteNode.
Represents the use of the ||=
operator for assignment to a class variable.
@@target ||= value ^^^^^^^^^^^^^^^^^^
typedef struct pm_class_variable_read_node pm_class_variable_read_node_t |
ClassVariableReadNode.
Represents referencing a class variable.
@@foo ^^^^^
typedef struct pm_class_variable_target_node pm_class_variable_target_node_t |
ClassVariableTargetNode.
Represents writing to a class variable in a context that doesn't have an explicit value.
@@foo, @@bar = baz ^^^^^ ^^^^^
typedef struct pm_class_variable_write_node pm_class_variable_write_node_t |
ClassVariableWriteNode.
Represents writing to a class variable.
@@foo = 1 ^^^^^^^^^
typedef struct pm_constant_and_write_node pm_constant_and_write_node_t |
ConstantAndWriteNode.
Represents the use of the &&=
operator for assignment to a constant.
Target &&= value ^^^^^^^^^^^^^^^^
typedef struct pm_constant_operator_write_node pm_constant_operator_write_node_t |
ConstantOperatorWriteNode.
Represents assigning to a constant using an operator that isn't =
.
Target += value ^^^^^^^^^^^^^^^
typedef struct pm_constant_or_write_node pm_constant_or_write_node_t |
ConstantOrWriteNode.
Represents the use of the ||=
operator for assignment to a constant.
Target ||= value ^^^^^^^^^^^^^^^^
typedef struct pm_constant_path_and_write_node pm_constant_path_and_write_node_t |
ConstantPathAndWriteNode.
Represents the use of the &&=
operator for assignment to a constant path.
Parent::Child &&= value ^^^^^^^^^^^^^^^^^^^^^^^
typedef struct pm_constant_path_node pm_constant_path_node_t |
ConstantPathNode.
Represents accessing a constant through a path of ::
operators.
Foo::Bar ^^^^^^^^
Type: PM_CONSTANT_PATH_NODE
ConstantPathOperatorWriteNode.
Represents assigning to a constant path using an operator that isn't =
.
Parent::Child += value ^^^^^^^^^^^^^^^^^^^^^^
typedef struct pm_constant_path_or_write_node pm_constant_path_or_write_node_t |
ConstantPathOrWriteNode.
Represents the use of the ||=
operator for assignment to a constant path.
Parent::Child ||= value ^^^^^^^^^^^^^^^^^^^^^^^
typedef struct pm_constant_path_target_node pm_constant_path_target_node_t |
ConstantPathTargetNode.
Represents writing to a constant path in a context that doesn't have an explicit value.
Foo::Foo, Bar::Bar = baz ^^^^^^^^ ^^^^^^^^
typedef struct pm_constant_path_write_node pm_constant_path_write_node_t |
ConstantPathWriteNode.
Represents writing to a constant path.
::Foo = 1 ^^^^^^^^^ Foo::Bar = 1 ^^^^^^^^^^^^ ::Foo::Bar = 1 ^^^^^^^^^^^^^^
typedef struct pm_constant_read_node pm_constant_read_node_t |
typedef struct pm_constant_target_node pm_constant_target_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
typedef struct pm_constant_write_node pm_constant_write_node_t |
typedef struct pm_def_node pm_def_node_t |
typedef struct pm_defined_node pm_defined_node_t |
DefinedNode.
Represents the use of the defined?
keyword.
defined?(a) ^^^^^^^^^^^
Type: PM_DEFINED_NODE
typedef struct pm_else_node pm_else_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
typedef struct pm_embedded_statements_node pm_embedded_statements_node_t |
EmbeddedStatementsNode.
Represents an interpolated set of statements.
"foo #{bar}" ^^^^^^
typedef struct pm_embedded_variable_node pm_embedded_variable_node_t |
EmbeddedVariableNode.
Represents an interpolated variable.
"foo #@bar" ^^^^^
typedef enum pm_encoding_flags pm_encoding_flags_t |
Flags for nodes that have unescaped content.
typedef struct pm_ensure_node pm_ensure_node_t |
EnsureNode.
Represents an ensure
clause in a begin
statement.
begin foo ensure ^^^^^^ bar end
Type: PM_ENSURE_NODE
typedef struct pm_false_node pm_false_node_t |
typedef struct pm_find_pattern_node pm_find_pattern_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
typedef struct pm_flip_flop_node pm_flip_flop_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):
typedef struct pm_float_node pm_float_node_t |
typedef struct pm_for_node pm_for_node_t |
typedef struct pm_forwarding_arguments_node pm_forwarding_arguments_node_t |
ForwardingArgumentsNode.
Represents forwarding all arguments to this method to another method.
def foo(...) bar(...) ^^^ end
typedef struct pm_forwarding_parameter_node pm_forwarding_parameter_node_t |
ForwardingParameterNode.
Represents the use of the forwarding parameter in a method, block, or lambda declaration.
def foo(...) ^^^ end
typedef struct pm_forwarding_super_node pm_forwarding_super_node_t |
ForwardingSuperNode.
Represents the use of the super
keyword without parentheses or arguments.
super ^^^^^
Type: PM_FORWARDING_SUPER_NODE
GlobalVariableAndWriteNode.
Represents the use of the &&=
operator for assignment to a global variable.
$target &&= value ^^^^^^^^^^^^^^^^^
GlobalVariableOperatorWriteNode.
Represents assigning to a global variable using an operator that isn't =
.
$target += value ^^^^^^^^^^^^^^^^
GlobalVariableOrWriteNode.
Represents the use of the ||=
operator for assignment to a global variable.
$target ||= value ^^^^^^^^^^^^^^^^^
typedef struct pm_global_variable_read_node pm_global_variable_read_node_t |
GlobalVariableReadNode.
Represents referencing a global variable.
$foo ^^^^
typedef struct pm_global_variable_target_node pm_global_variable_target_node_t |
GlobalVariableTargetNode.
Represents writing to a global variable in a context that doesn't have an explicit value.
$foo, $bar = baz ^^^^ ^^^^
typedef struct pm_global_variable_write_node pm_global_variable_write_node_t |
GlobalVariableWriteNode.
Represents writing to a global variable.
$foo = 1 ^^^^^^^^
typedef struct pm_hash_node pm_hash_node_t |
typedef struct pm_hash_pattern_node pm_hash_pattern_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
typedef struct pm_if_node pm_if_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
typedef struct pm_imaginary_node pm_imaginary_node_t |
typedef struct pm_implicit_node pm_implicit_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
typedef struct pm_implicit_rest_node pm_implicit_rest_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
typedef struct pm_in_node pm_in_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
typedef struct pm_index_and_write_node pm_index_and_write_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):
typedef struct pm_index_operator_write_node pm_index_operator_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):
typedef struct pm_index_or_write_node pm_index_or_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):
typedef struct pm_index_target_node pm_index_target_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):
InstanceVariableAndWriteNode.
Represents the use of the &&=
operator for assignment to an instance variable.
@target &&= value ^^^^^^^^^^^^^^^^^
InstanceVariableOperatorWriteNode.
Represents assigning to an instance variable using an operator that isn't =
.
@target += value ^^^^^^^^^^^^^^^^
InstanceVariableOrWriteNode.
Represents the use of the ||=
operator for assignment to an instance variable.
@target ||= value ^^^^^^^^^^^^^^^^^
typedef struct pm_instance_variable_read_node pm_instance_variable_read_node_t |
InstanceVariableReadNode.
Represents referencing an instance variable.
@foo ^^^^
InstanceVariableTargetNode.
Represents writing to an instance variable in a context that doesn't have an explicit value.
@foo, @bar = baz ^^^^ ^^^^
typedef struct pm_instance_variable_write_node pm_instance_variable_write_node_t |
InstanceVariableWriteNode.
Represents writing to an instance variable.
@foo = 1 ^^^^^^^^
typedef enum pm_integer_base_flags pm_integer_base_flags_t |
Flags for integer nodes that correspond to the base of the integer.
typedef struct pm_integer_node pm_integer_node_t |
IntegerNode.
Represents an integer number literal.
1 ^
Type: PM_INTEGER_NODE
Flags (pm_integer_base_flags):
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):
InterpolatedRegularExpressionNode.
Represents a regular expression literal that contains interpolation.
/foo #{bar} baz/ ^^^^^^^^^^^^^^^^
Type: PM_INTERPOLATED_REGULAR_EXPRESSION_NODE
Flags (pm_regular_expression_flags):
Flags for interpolated string nodes that indicated mutability if they are also marked as literals.
typedef struct pm_interpolated_string_node pm_interpolated_string_node_t |
InterpolatedStringNode.
Represents a string literal that contains interpolation.
"foo #{bar} baz" ^^^^^^^^^^^^^^^^
Type: PM_INTERPOLATED_STRING_NODE
Flags (pm_interpolated_string_node_flags):
typedef struct pm_interpolated_symbol_node pm_interpolated_symbol_node_t |
InterpolatedSymbolNode.
Represents a symbol literal that contains interpolation.
:"foo #{bar} baz" ^^^^^^^^^^^^^^^^^
typedef struct pm_interpolated_x_string_node pm_interpolated_x_string_node_t |
InterpolatedXStringNode.
Represents an xstring literal that contains interpolation.
`foo #{bar} baz` ^^^^^^^^^^^^^^^^
typedef struct pm_it_local_variable_read_node pm_it_local_variable_read_node_t |
ItLocalVariableReadNode.
Represents reading from the implicit it
local variable.
-> { it } ^^
typedef struct pm_it_parameters_node pm_it_parameters_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
typedef enum pm_keyword_hash_node_flags pm_keyword_hash_node_flags_t |
Flags for keyword hash nodes.
typedef struct pm_keyword_hash_node pm_keyword_hash_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):
typedef struct pm_keyword_rest_parameter_node pm_keyword_rest_parameter_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):
typedef struct pm_lambda_node pm_lambda_node_t |
LambdaNode.
Represents using a lambda literal (not the lambda method call).
->(value) { value * 2 } ^^^^^^^^^^^^^^^^^^^^^^^
Type: PM_LAMBDA_NODE
LocalVariableAndWriteNode.
Represents the use of the &&=
operator for assignment to a local variable.
target &&= value ^^^^^^^^^^^^^^^^
LocalVariableOperatorWriteNode.
Represents assigning to a local variable using an operator that isn't =
.
target += value ^^^^^^^^^^^^^^^
typedef struct pm_local_variable_or_write_node pm_local_variable_or_write_node_t |
LocalVariableOrWriteNode.
Represents the use of the ||=
operator for assignment to a local variable.
target ||= value ^^^^^^^^^^^^^^^^
typedef struct pm_local_variable_read_node pm_local_variable_read_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 ^^^
typedef struct pm_local_variable_target_node pm_local_variable_target_node_t |
LocalVariableTargetNode.
Represents writing to a local variable in a context that doesn't have an explicit value.
foo, bar = baz ^^^ ^^^
typedef struct pm_local_variable_write_node pm_local_variable_write_node_t |
LocalVariableWriteNode.
Represents writing to a local variable.
foo = 1 ^^^^^^^
typedef enum pm_loop_flags pm_loop_flags_t |
Flags for while and until loop nodes.
typedef struct pm_match_last_line_node pm_match_last_line_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):
typedef struct pm_match_predicate_node pm_match_predicate_node_t |
MatchPredicateNode.
Represents the use of the modifier in
operator.
foo in bar ^^^^^^^^^^
Type: PM_MATCH_PREDICATE_NODE
typedef struct pm_match_required_node pm_match_required_node_t |
MatchRequiredNode.
Represents the use of the =>
operator.
foo => bar ^^^^^^^^^^
Type: PM_MATCH_REQUIRED_NODE
typedef struct pm_match_write_node pm_match_write_node_t |
MatchWriteNode.
Represents writing local variables using a regular expression match with named capture groups.
/(?<foo>bar)/ =~ baz ^^^^^^^^^^^^^^^^^^^^
Type: PM_MATCH_WRITE_NODE
typedef struct pm_missing_node pm_missing_node_t |
MissingNode.
Represents a node that is missing from the source and results in a syntax error.
Type: PM_MISSING_NODE
typedef struct pm_module_node pm_module_node_t |
ModuleNode.
Represents a module declaration involving the module
keyword.
module Foo end ^^^^^^^^^^^^^^
Type: PM_MODULE_NODE
typedef struct pm_multi_target_node pm_multi_target_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
typedef struct pm_multi_write_node pm_multi_write_node_t |
MultiWriteNode.
Represents a write to a multi-target expression.
a, b, c = 1, 2, 3 ^^^^^^^^^^^^^^^^^
Type: PM_MULTI_WRITE_NODE
typedef struct pm_next_node pm_next_node_t |
typedef struct pm_nil_node pm_nil_node_t |
typedef struct pm_no_keywords_parameter_node pm_no_keywords_parameter_node_t |
NoKeywordsParameterNode.
Represents the use of **nil
inside method arguments.
def a(**nil) ^^^^^ end
typedef uint16_t pm_node_flags_t |
typedef struct pm_node_list pm_node_list_t |
A list of nodes in the source, most often used for lists of children.
This is the base structure that represents a node in the syntax tree.
It is embedded into every node type.
typedef uint16_t pm_node_type_t |
typedef struct pm_numbered_parameters_node pm_numbered_parameters_node_t |
NumberedParametersNode.
Represents an implicit set of parameters through the use of numbered parameters within a block or lambda.
-> { _1 + _2 } ^^^^^^^^^^^^^^
typedef struct pm_numbered_reference_read_node pm_numbered_reference_read_node_t |
NumberedReferenceReadNode.
Represents reading a numbered reference to a capture in the previous match.
$1 ^^
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):
typedef struct pm_optional_parameter_node pm_optional_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):
typedef struct pm_or_node pm_or_node_t |
OrNode.
Represents the use of the ||
operator or the or
keyword.
left or right ^^^^^^^^^^^^^
Type: PM_OR_NODE
typedef enum pm_parameter_flags pm_parameter_flags_t |
Flags for parameter nodes.
typedef struct pm_parameters_node pm_parameters_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
typedef struct pm_parentheses_node pm_parentheses_node_t |
ParenthesesNode.
Represents a parenthesized expression
(10 + 34) ^^^^^^^^^
Type: PM_PARENTHESES_NODE
typedef struct pm_pinned_expression_node pm_pinned_expression_node_t |
PinnedExpressionNode.
Represents the use of the ^
operator for pinning an expression in a pattern matching expression.
foo in ^(bar) ^^^^^^
typedef struct pm_pinned_variable_node pm_pinned_variable_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
typedef struct pm_post_execution_node pm_post_execution_node_t |
PostExecutionNode.
Represents the use of the END
keyword.
END { foo } ^^^^^^^^^^^
Type: PM_POST_EXECUTION_NODE
typedef struct pm_pre_execution_node pm_pre_execution_node_t |
PreExecutionNode.
Represents the use of the BEGIN
keyword.
BEGIN { foo } ^^^^^^^^^^^^^
Type: PM_PRE_EXECUTION_NODE
typedef struct pm_program_node pm_program_node_t |
typedef enum pm_range_flags pm_range_flags_t |
Flags for range and flip-flop nodes.
typedef struct pm_range_node pm_range_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):
typedef struct pm_rational_node pm_rational_node_t |
RationalNode.
Represents a rational number literal.
1.0r ^^^^
Type: PM_RATIONAL_NODE
Flags (pm_integer_base_flags):
typedef struct pm_redo_node pm_redo_node_t |
typedef enum pm_regular_expression_flags pm_regular_expression_flags_t |
Flags for regular expression and match last line nodes.
typedef struct pm_regular_expression_node pm_regular_expression_node_t |
RegularExpressionNode.
Represents a regular expression literal with no interpolation.
/foo/i ^^^^^^
Type: PM_REGULAR_EXPRESSION_NODE
Flags (pm_regular_expression_flags):
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):
typedef struct pm_required_parameter_node pm_required_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):
typedef struct pm_rescue_modifier_node pm_rescue_modifier_node_t |
RescueModifierNode.
Represents an expression modified with a rescue.
foo rescue nil ^^^^^^^^^^^^^^
Type: PM_RESCUE_MODIFIER_NODE
typedef struct pm_rescue_node pm_rescue_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 reference
field.
Type: PM_RESCUE_NODE
typedef struct pm_rest_parameter_node pm_rest_parameter_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):
typedef struct pm_retry_node pm_retry_node_t |
typedef struct pm_return_node pm_return_node_t |
typedef struct pm_self_node pm_self_node_t |
Flags for shareable constant nodes.
typedef struct pm_shareable_constant_node pm_shareable_constant_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):
typedef struct pm_singleton_class_node pm_singleton_class_node_t |
SingletonClassNode.
Represents a singleton class declaration involving the class
keyword.
class << self end ^^^^^^^^^^^^^^^^^
Type: PM_SINGLETON_CLASS_NODE
typedef struct pm_source_encoding_node pm_source_encoding_node_t |
SourceEncodingNode.
Represents the use of the __ENCODING__
keyword.
__ENCODING__ ^^^^^^^^^^^^
Type: PM_SOURCE_ENCODING_NODE
typedef struct pm_source_file_node pm_source_file_node_t |
SourceFileNode.
Represents the use of the __FILE__
keyword.
__FILE__ ^^^^^^^^
Type: PM_SOURCE_FILE_NODE
Flags (pm_string_flags):
typedef struct pm_source_line_node pm_source_line_node_t |
SourceLineNode.
Represents the use of the __LINE__
keyword.
__LINE__ ^^^^^^^^
Type: PM_SOURCE_LINE_NODE
typedef struct pm_splat_node pm_splat_node_t |
typedef struct pm_statements_node pm_statements_node_t |
StatementsNode.
Represents a set of statements contained within some scope.
foo; bar; baz ^^^^^^^^^^^^^
Type: PM_STATEMENTS_NODE
typedef enum pm_string_flags pm_string_flags_t |
Flags for string nodes.
typedef struct pm_string_node pm_string_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):
typedef struct pm_super_node pm_super_node_t |
SuperNode.
Represents the use of the super
keyword with parentheses or arguments.
super() ^^^^^^^ super foo, bar ^^^^^^^^^^^^^^
Type: PM_SUPER_NODE
typedef enum pm_symbol_flags pm_symbol_flags_t |
Flags for symbol nodes.
typedef struct pm_symbol_node pm_symbol_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):
typedef enum pm_token_type pm_token_type_t |
This enum represents every type of token in the Ruby source.
typedef struct pm_true_node pm_true_node_t |
typedef struct pm_undef_node pm_undef_node_t |
UndefNode.
Represents the use of the undef
keyword.
undef :foo, :bar, :baz ^^^^^^^^^^^^^^^^^^^^^^
Type: PM_UNDEF_NODE
typedef struct pm_unless_node pm_unless_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
typedef struct pm_until_node pm_until_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):
typedef struct pm_when_node pm_when_node_t |
WhenNode.
Represents the use of the when
keyword within a case statement.
case true when true ^^^^^^^^^ end
Type: PM_WHEN_NODE
typedef struct pm_while_node pm_while_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):
typedef struct pm_x_string_node pm_x_string_node_t |
XStringNode.
Represents an xstring literal with no interpolation.
`foo` ^^^^^
Type: PM_X_STRING_NODE
Flags (pm_encoding_flags):
typedef struct pm_yield_node pm_yield_node_t |
Flags for arguments nodes.
enum pm_array_node_flags |
enum pm_call_node_flags |
Flags for call nodes.
enum pm_encoding_flags |
Flags for interpolated string nodes that indicated mutability if they are also marked as literals.
enum pm_loop_flags |
enum pm_node_type |
This enum represents every type of node in the Ruby syntax tree.
enum pm_parameter_flags |
enum pm_range_flags |
Flags for regular expression and match last line nodes.
Flags for shareable constant nodes.
enum pm_string_flags |
Flags for string nodes.
enum pm_symbol_flags |
enum pm_token_type |
This enum represents every type of token in the Ruby source.
|
static |