Crate ruby_prism
source ·Expand description
§ruby-prism
Rustified version of Ruby’s prism parser.
Structs§
- Represents the use of the
aliaskeyword to alias a global variable. - Represents the use of the
aliaskeyword to alias a method. - Represents an alternation pattern in pattern matching.
- Represents the use of the
&&operator or theandkeyword. - Represents a set of arguments to a method or a keyword.
- Represents an array literal. This can be a regular array using brackets or a special array using % like %w or %i.
- Represents an array pattern in pattern matching.
- Represents a hash key/value pair.
- Represents a splat in a hash literal.
- Represents reading a reference to a field in the previous match.
- Represents a begin statement.
- Represents a block argument using
&. - Represents a block local variable.
- Represents a block of ruby code.
- Represents a block parameter of a method, block, or lambda definition.
- Represents a block’s parameters declaration.
- Represents the use of the
breakkeyword. - Represents the use of the
&&=operator on a call. - Represents a method call, in all of the various forms that can take.
- Represents the use of an assignment operator on a call.
- Represents the use of the
||=operator on a call. - Represents assigning to a method call.
- Represents assigning to a local variable in pattern matching.
- Represents the use of a case statement for pattern matching.
- Represents the use of a case statement.
- Represents a class declaration involving the
classkeyword. - Represents the use of the
&&=operator for assignment to a class variable. - Represents assigning to a class variable using an operator that isn’t
=. - Represents the use of the
||=operator for assignment to a class variable. - Represents referencing a class variable.
- Represents writing to a class variable in a context that doesn’t have an explicit value.
- Represents writing to a class variable.
- A comment that was found during parsing.
- A struct created by the
commentsmethod onParseResult. It can be used to iterate over the comments in the parse result. - Represents the use of the
&&=operator for assignment to a constant. - A handle for a constant ID.
- A list of constants.
- An iterator over the constants in a list.
- Represents assigning to a constant using an operator that isn’t
=. - Represents the use of the
||=operator for assignment to a constant. - Represents the use of the
&&=operator for assignment to a constant path. - Represents accessing a constant through a path of
::operators. - Represents assigning to a constant path using an operator that isn’t
=. - Represents the use of the
||=operator for assignment to a constant path. - Represents writing to a constant path in a context that doesn’t have an explicit value.
- Represents writing to a constant path.
- Represents referencing a constant.
- Represents writing to a constant in a context that doesn’t have an explicit value.
- Represents writing to a constant.
- Represents a method definition.
- Represents the use of the
defined?keyword. - A diagnostic message that came back from the parser.
- A struct created by the
errorsorwarningsmethods onParseResult. It can be used to iterate over the diagnostics in the parse result. - Represents an
elseclause in acase,if, orunlessstatement. - Represents an interpolated set of statements.
- Represents an interpolated variable.
- Represents an
ensureclause in abeginstatement. - Represents the use of the literal
falsekeyword. - Represents a find pattern in pattern matching.
- Represents the use of the
..or...operators to create flip flops. - Represents a floating point number literal.
- Represents the use of the
forkeyword. - Represents forwarding all arguments to this method to another method.
- Represents the use of the forwarding parameter in a method, block, or lambda declaration.
- Represents the use of the
superkeyword without parentheses or arguments. - Represents the use of the
&&=operator for assignment to a global variable. - Represents assigning to a global variable using an operator that isn’t
=. - Represents the use of the
||=operator for assignment to a global variable. - Represents referencing a global variable.
- Represents writing to a global variable in a context that doesn’t have an explicit value.
- Represents writing to a global variable.
- Represents a hash literal.
- Represents a hash pattern in pattern matching.
- Represents the use of the
ifkeyword, either in the block form or the modifier form, or a ternary expression. - Represents an imaginary number literal.
- Represents a node that is implicitly being added to the tree but doesn’t correspond directly to a node in the source.
- Represents using a trailing comma to indicate an implicit rest parameter.
- Represents the use of the
inkeyword in a case statement. - Represents the use of the
&&=operator on a call to the[]method. - Represents the use of an assignment operator on a call to
[]. - Represents the use of the
||=operator on a call to[]. - Represents assigning to an index.
- Represents the use of the
&&=operator for assignment to an instance variable. - Represents assigning to an instance variable using an operator that isn’t
=. - Represents the use of the
||=operator for assignment to an instance variable. - Represents referencing an instance variable.
- Represents writing to an instance variable in a context that doesn’t have an explicit value.
- Represents writing to an instance variable.
- A handle for an arbitarily-sized integer.
- Represents an integer number literal.
- 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.
- Represents a regular expression literal that contains interpolation.
- Represents a string literal that contains interpolation.
- Represents a symbol literal that contains interpolation.
- Represents an xstring literal that contains interpolation.
- Represents reading from the implicit
itlocal variable. - Represents an implicit set of parameters through the use of the
itkeyword within a block or lambda. - Represents a hash literal without opening and closing braces.
- Represents a keyword rest parameter to a method, block, or lambda definition.
- Represents using a lambda literal (not the lambda method call).
- Represents the use of the
&&=operator for assignment to a local variable. - Represents assigning to a local variable using an operator that isn’t
=. - Represents the use of the
||=operator for assignment to a local variable. - 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.
- Represents writing to a local variable in a context that doesn’t have an explicit value.
- Represents writing to a local variable.
- A range in the source file.
- Represents a regular expression literal used in the predicate of a conditional to implicitly match against the last line read by an IO object.
- Represents the use of the modifier
inoperator. - Represents the use of the
=>operator. - Represents writing local variables using a regular expression match with named capture groups.
- Represents a node that is missing from the source and results in a syntax error.
- Represents a module declaration involving the
modulekeyword. - Represents a multi-target expression.
- Represents a write to a multi-target expression.
- Represents the use of the
nextkeyword. - Represents the use of the
nilkeyword. - Represents the use of
**nilinside method arguments. - A list of nodes.
- An iterator over the nodes in a list.
- Represents an implicit set of parameters through the use of numbered parameters within a block or lambda.
- Represents reading a numbered reference to a capture in the previous match.
- Represents an optional keyword parameter to a method, block, or lambda definition.
- Represents an optional parameter to a method, block, or lambda definition.
- Represents the use of the
||operator or theorkeyword. - Represents the list of parameters on a method, block, or lambda definition.
- Represents a parenthesized expression
- The result of parsing a source string.
- Represents the use of the
^operator for pinning an expression in a pattern matching expression. - Represents the use of the
^operator for pinning a variable in a pattern matching expression. - Represents the use of the
ENDkeyword. - Represents the use of the
BEGINkeyword. - The top level node of any parse tree.
- Represents the use of the
..or...operators. - Represents a rational number literal.
- Represents the use of the
redokeyword. - Represents a regular expression literal with no interpolation.
- Represents a required keyword parameter to a method, block, or lambda definition.
- Represents a required parameter to a method, block, or lambda definition.
- Represents an expression modified with a rescue.
- Represents a rescue statement.
- Represents a rest parameter to a method, block, or lambda definition.
- Represents the use of the
retrykeyword. - Represents the use of the
returnkeyword. - Represents the
selfkeyword. - This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified.
- Represents a singleton class declaration involving the
classkeyword. - Represents the use of the
__ENCODING__keyword. - Represents the use of the
__FILE__keyword. - Represents the use of the
__LINE__keyword. - Represents the use of the splat operator.
- Represents a set of statements contained within some scope.
- Represents a string literal, a string contained within a
%wlist, or plain string content within an interpolated string. - Represents the use of the
superkeyword with parentheses or arguments. - Represents a symbol literal or a symbol contained within a
%ilist. - Represents the use of the literal
truekeyword. - Represents the use of the
undefkeyword. - Represents the use of the
unlesskeyword, either in the block form or the modifier form. - Represents the use of the
untilkeyword, either in the block form or the modifier form. - Represents the use of the
whenkeyword within a case statement. - Represents the use of the
whilekeyword, either in the block form or the modifier form. - Represents an xstring literal with no interpolation.
- Represents the use of the
yieldkeyword.
Enums§
- An enum representing the different kinds of nodes that can be parsed.
Traits§
- A trait for visiting the AST.
Functions§
- Parses the given source string and returns a parse result.
- The default visitor implementation for a
AliasGlobalVariableNodenode. - The default visitor implementation for a
AliasMethodNodenode. - The default visitor implementation for a
AlternationPatternNodenode. - The default visitor implementation for a
AndNodenode. - The default visitor implementation for a
ArgumentsNodenode. - The default visitor implementation for a
ArrayNodenode. - The default visitor implementation for a
ArrayPatternNodenode. - The default visitor implementation for a
AssocNodenode. - The default visitor implementation for a
AssocSplatNodenode. - The default visitor implementation for a
BackReferenceReadNodenode. - The default visitor implementation for a
BeginNodenode. - The default visitor implementation for a
BlockArgumentNodenode. - The default visitor implementation for a
BlockLocalVariableNodenode. - The default visitor implementation for a
BlockNodenode. - The default visitor implementation for a
BlockParameterNodenode. - The default visitor implementation for a
BlockParametersNodenode. - The default visitor implementation for a
BreakNodenode. - The default visitor implementation for a
CallAndWriteNodenode. - The default visitor implementation for a
CallNodenode. - The default visitor implementation for a
CallOperatorWriteNodenode. - The default visitor implementation for a
CallOrWriteNodenode. - The default visitor implementation for a
CallTargetNodenode. - The default visitor implementation for a
CapturePatternNodenode. - The default visitor implementation for a
CaseMatchNodenode. - The default visitor implementation for a
CaseNodenode. - The default visitor implementation for a
ClassNodenode. - The default visitor implementation for a
ClassVariableAndWriteNodenode. - The default visitor implementation for a
ClassVariableOperatorWriteNodenode. - The default visitor implementation for a
ClassVariableOrWriteNodenode. - The default visitor implementation for a
ClassVariableReadNodenode. - The default visitor implementation for a
ClassVariableTargetNodenode. - The default visitor implementation for a
ClassVariableWriteNodenode. - The default visitor implementation for a
ConstantAndWriteNodenode. - The default visitor implementation for a
ConstantOperatorWriteNodenode. - The default visitor implementation for a
ConstantOrWriteNodenode. - The default visitor implementation for a
ConstantPathAndWriteNodenode. - The default visitor implementation for a
ConstantPathNodenode. - The default visitor implementation for a
ConstantPathOperatorWriteNodenode. - The default visitor implementation for a
ConstantPathOrWriteNodenode. - The default visitor implementation for a
ConstantPathTargetNodenode. - The default visitor implementation for a
ConstantPathWriteNodenode. - The default visitor implementation for a
ConstantReadNodenode. - The default visitor implementation for a
ConstantTargetNodenode. - The default visitor implementation for a
ConstantWriteNodenode. - The default visitor implementation for a
DefNodenode. - The default visitor implementation for a
DefinedNodenode. - The default visitor implementation for a
ElseNodenode. - The default visitor implementation for a
EmbeddedStatementsNodenode. - The default visitor implementation for a
EmbeddedVariableNodenode. - The default visitor implementation for a
EnsureNodenode. - The default visitor implementation for a
FalseNodenode. - The default visitor implementation for a
FindPatternNodenode. - The default visitor implementation for a
FlipFlopNodenode. - The default visitor implementation for a
FloatNodenode. - The default visitor implementation for a
ForNodenode. - The default visitor implementation for a
ForwardingArgumentsNodenode. - The default visitor implementation for a
ForwardingParameterNodenode. - The default visitor implementation for a
ForwardingSuperNodenode. - The default visitor implementation for a
GlobalVariableAndWriteNodenode. - The default visitor implementation for a
GlobalVariableOperatorWriteNodenode. - The default visitor implementation for a
GlobalVariableOrWriteNodenode. - The default visitor implementation for a
GlobalVariableReadNodenode. - The default visitor implementation for a
GlobalVariableTargetNodenode. - The default visitor implementation for a
GlobalVariableWriteNodenode. - The default visitor implementation for a
HashNodenode. - The default visitor implementation for a
HashPatternNodenode. - The default visitor implementation for a
IfNodenode. - The default visitor implementation for a
ImaginaryNodenode. - The default visitor implementation for a
ImplicitNodenode. - The default visitor implementation for a
ImplicitRestNodenode. - The default visitor implementation for a
InNodenode. - The default visitor implementation for a
IndexAndWriteNodenode. - The default visitor implementation for a
IndexOperatorWriteNodenode. - The default visitor implementation for a
IndexOrWriteNodenode. - The default visitor implementation for a
IndexTargetNodenode. - The default visitor implementation for a
InstanceVariableAndWriteNodenode. - The default visitor implementation for a
InstanceVariableOperatorWriteNodenode. - The default visitor implementation for a
InstanceVariableOrWriteNodenode. - The default visitor implementation for a
InstanceVariableReadNodenode. - The default visitor implementation for a
InstanceVariableTargetNodenode. - The default visitor implementation for a
InstanceVariableWriteNodenode. - The default visitor implementation for a
IntegerNodenode. - The default visitor implementation for a
InterpolatedMatchLastLineNodenode. - The default visitor implementation for a
InterpolatedRegularExpressionNodenode. - The default visitor implementation for a
InterpolatedStringNodenode. - The default visitor implementation for a
InterpolatedSymbolNodenode. - The default visitor implementation for a
InterpolatedXStringNodenode. - The default visitor implementation for a
ItLocalVariableReadNodenode. - The default visitor implementation for a
ItParametersNodenode. - The default visitor implementation for a
KeywordHashNodenode. - The default visitor implementation for a
KeywordRestParameterNodenode. - The default visitor implementation for a
LambdaNodenode. - The default visitor implementation for a
LocalVariableAndWriteNodenode. - The default visitor implementation for a
LocalVariableOperatorWriteNodenode. - The default visitor implementation for a
LocalVariableOrWriteNodenode. - The default visitor implementation for a
LocalVariableReadNodenode. - The default visitor implementation for a
LocalVariableTargetNodenode. - The default visitor implementation for a
LocalVariableWriteNodenode. - The default visitor implementation for a
MatchLastLineNodenode. - The default visitor implementation for a
MatchPredicateNodenode. - The default visitor implementation for a
MatchRequiredNodenode. - The default visitor implementation for a
MatchWriteNodenode. - The default visitor implementation for a
MissingNodenode. - The default visitor implementation for a
ModuleNodenode. - The default visitor implementation for a
MultiTargetNodenode. - The default visitor implementation for a
MultiWriteNodenode. - The default visitor implementation for a
NextNodenode. - The default visitor implementation for a
NilNodenode. - The default visitor implementation for a
NoKeywordsParameterNodenode. - The default visitor implementation for a
NumberedParametersNodenode. - The default visitor implementation for a
NumberedReferenceReadNodenode. - The default visitor implementation for a
OptionalKeywordParameterNodenode. - The default visitor implementation for a
OptionalParameterNodenode. - The default visitor implementation for a
OrNodenode. - The default visitor implementation for a
ParametersNodenode. - The default visitor implementation for a
ParenthesesNodenode. - The default visitor implementation for a
PinnedExpressionNodenode. - The default visitor implementation for a
PinnedVariableNodenode. - The default visitor implementation for a
PostExecutionNodenode. - The default visitor implementation for a
PreExecutionNodenode. - The default visitor implementation for a
ProgramNodenode. - The default visitor implementation for a
RangeNodenode. - The default visitor implementation for a
RationalNodenode. - The default visitor implementation for a
RedoNodenode. - The default visitor implementation for a
RegularExpressionNodenode. - The default visitor implementation for a
RequiredKeywordParameterNodenode. - The default visitor implementation for a
RequiredParameterNodenode. - The default visitor implementation for a
RescueModifierNodenode. - The default visitor implementation for a
RescueNodenode. - The default visitor implementation for a
RestParameterNodenode. - The default visitor implementation for a
RetryNodenode. - The default visitor implementation for a
ReturnNodenode. - The default visitor implementation for a
SelfNodenode. - The default visitor implementation for a
ShareableConstantNodenode. - The default visitor implementation for a
SingletonClassNodenode. - The default visitor implementation for a
SourceEncodingNodenode. - The default visitor implementation for a
SourceFileNodenode. - The default visitor implementation for a
SourceLineNodenode. - The default visitor implementation for a
SplatNodenode. - The default visitor implementation for a
StatementsNodenode. - The default visitor implementation for a
StringNodenode. - The default visitor implementation for a
SuperNodenode. - The default visitor implementation for a
SymbolNodenode. - The default visitor implementation for a
TrueNodenode. - The default visitor implementation for a
UndefNodenode. - The default visitor implementation for a
UnlessNodenode. - The default visitor implementation for a
UntilNodenode. - The default visitor implementation for a
WhenNodenode. - The default visitor implementation for a
WhileNodenode. - The default visitor implementation for a
XStringNodenode. - The default visitor implementation for a
YieldNodenode.