Ruby 3.4 リファレンスマニュアル

instance method Prism::Node#comments

comments -> [Prism::Comment]Ruby 3.4 から[permalink][rdoc][edit]

このノードに関連付けられた前後両方のコメントの配列を返します。 location.comments と同じです。

ノードクラスの一覧

prism の各ノードクラス(Prism::Node のサブクラス)と、そのフィールド(子ノードや値を取得するアクセサ)の名前の一覧です。 prism の config.yml(3.3= prism 0.19.0・3.4= 1.2.0・4.0= 1.7.0・4.1= 1.9.0)から機械的に生成しています。フィールドの構成が版によって異なるノードは、版ごとに行を分けています。各フィールドの意味は公式ドキュメントを参照してください。

ノードクラスフィールド
AliasGlobalVariableNodenew_name, old_name, keyword_loc
AliasMethodNodenew_name, old_name, keyword_loc
AlternationPatternNodeleft, right, operator_loc
AndNodeleft, right, operator_loc
ArgumentsNodearguments
ArrayNodeelements, opening_loc, closing_loc
ArrayPatternNodeconstant, requireds, rest, posts, opening_loc, closing_loc
AssocNodekey, value, operator_loc
AssocSplatNodevalue, operator_loc
BackReferenceReadNodename
BeginNodebegin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc
BlockArgumentNodeexpression, operator_loc
BlockLocalVariableNodename
BlockNodelocals, parameters, body, opening_loc, closing_loc
BlockParameterNodename, name_loc, operator_loc
BlockParametersNodeparameters, locals, opening_loc, closing_loc
BreakNodearguments, keyword_loc
CallAndWriteNodereceiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value
CallNodereceiver, call_operator_loc, name, message_loc, opening_loc, arguments, closing_loc, block
CallOperatorWriteNodereceiver, call_operator_loc, message_loc, read_name, write_name, binary_operator, binary_operator_loc, value
CallOrWriteNodereceiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value
CallTargetNodereceiver, call_operator_loc, name, message_loc
CapturePatternNodevalue, target, operator_loc
CaseMatchNodepredicate, conditions, else_clause, case_keyword_loc, end_keyword_loc
CaseNodepredicate, conditions, else_clause, case_keyword_loc, end_keyword_loc
ClassNodelocals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name
ClassVariableAndWriteNodename, name_loc, operator_loc, value
ClassVariableOperatorWriteNodename, name_loc, binary_operator_loc, value, binary_operator
ClassVariableOrWriteNodename, name_loc, operator_loc, value
ClassVariableReadNodename
ClassVariableTargetNodename
ClassVariableWriteNodename, name_loc, value, operator_loc
ConstantAndWriteNodename, name_loc, operator_loc, value
ConstantOperatorWriteNodename, name_loc, binary_operator_loc, value, binary_operator
ConstantOrWriteNodename, name_loc, operator_loc, value
ConstantPathAndWriteNodetarget, operator_loc, value
ConstantPathNodeparent, name, delimiter_loc, name_loc
ConstantPathOperatorWriteNodetarget, binary_operator_loc, value, binary_operator
ConstantPathOrWriteNodetarget, operator_loc, value
ConstantPathTargetNodeparent, name, delimiter_loc, name_loc
ConstantPathWriteNodetarget, operator_loc, value
ConstantReadNodename
ConstantTargetNodename
ConstantWriteNodename, name_loc, value, operator_loc
DefNodename, name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc
DefinedNodelparen_loc, value, rparen_loc, keyword_loc
ElseNodeelse_keyword_loc, statements, end_keyword_loc
EmbeddedStatementsNodeopening_loc, statements, closing_loc
EmbeddedVariableNodeoperator_loc, variable
EnsureNodeensure_keyword_loc, statements, end_keyword_loc
FalseNode(なし)
FindPatternNodeconstant, left, requireds, right, opening_loc, closing_loc
FlipFlopNodeleft, right, operator_loc
FloatNodevalue
ForNodeindex, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc
ForwardingArgumentsNode(なし)
ForwardingParameterNode(なし)
ForwardingSuperNodeblock
GlobalVariableAndWriteNodename, name_loc, operator_loc, value
GlobalVariableOperatorWriteNodename, name_loc, binary_operator_loc, value, binary_operator
GlobalVariableOrWriteNodename, name_loc, operator_loc, value
GlobalVariableReadNodename
GlobalVariableTargetNodename
GlobalVariableWriteNodename, name_loc, value, operator_loc
HashNodeopening_loc, elements, closing_loc
HashPatternNodeconstant, elements, rest, opening_loc, closing_loc
IfNodeif_keyword_loc, predicate, then_keyword_loc, statements, subsequent, end_keyword_loc
ImaginaryNodenumeric
ImplicitNodevalue
ImplicitRestNode(なし)
InNodepattern, statements, in_loc, then_loc
IndexAndWriteNodereceiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value
IndexOperatorWriteNodereceiver, call_operator_loc, opening_loc, arguments, closing_loc, block, binary_operator, binary_operator_loc, value
IndexOrWriteNodereceiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value
IndexTargetNodereceiver, opening_loc, arguments, closing_loc, block
InstanceVariableAndWriteNodename, name_loc, operator_loc, value
InstanceVariableOperatorWriteNodename, name_loc, binary_operator_loc, value, binary_operator
InstanceVariableOrWriteNodename, name_loc, operator_loc, value
InstanceVariableReadNodename
InstanceVariableTargetNodename
InstanceVariableWriteNodename, name_loc, value, operator_loc
IntegerNodevalue
InterpolatedMatchLastLineNodeopening_loc, parts, closing_loc
InterpolatedRegularExpressionNodeopening_loc, parts, closing_loc
InterpolatedStringNodeopening_loc, parts, closing_loc
InterpolatedSymbolNodeopening_loc, parts, closing_loc
InterpolatedXStringNodeopening_loc, parts, closing_loc
ItLocalVariableReadNode(なし)
ItParametersNode(なし)
KeywordHashNodeelements
KeywordRestParameterNodename, name_loc, operator_loc
LambdaNodelocals, operator_loc, opening_loc, closing_loc, parameters, body
LocalVariableAndWriteNodename_loc, operator_loc, value, name, depth
LocalVariableOperatorWriteNodename_loc, binary_operator_loc, value, name, binary_operator, depth
LocalVariableOrWriteNodename_loc, operator_loc, value, name, depth
LocalVariableReadNodename, depth
LocalVariableTargetNodename, depth
LocalVariableWriteNodename, depth, name_loc, value, operator_loc
MatchLastLineNodeopening_loc, content_loc, closing_loc, unescaped
MatchPredicateNodevalue, pattern, operator_loc
MatchRequiredNodevalue, pattern, operator_loc
MatchWriteNodecall, targets
MissingNode(なし)
ModuleNodelocals, module_keyword_loc, constant_path, body, end_keyword_loc, name
MultiTargetNodelefts, rest, rights, lparen_loc, rparen_loc
MultiWriteNodelefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value
NextNodearguments, keyword_loc
NilNode(なし)
NoKeywordsParameterNodeoperator_loc, keyword_loc
NumberedParametersNodemaximum
NumberedReferenceReadNodenumber
OptionalKeywordParameterNodename, name_loc, value
OptionalParameterNodename, name_loc, operator_loc, value
OrNodeleft, right, operator_loc
ParametersNoderequireds, optionals, rest, posts, keywords, keyword_rest, block
ParenthesesNodebody, opening_loc, closing_loc
PinnedExpressionNodeexpression, operator_loc, lparen_loc, rparen_loc
PinnedVariableNodevariable, operator_loc
PostExecutionNodestatements, keyword_loc, opening_loc, closing_loc
PreExecutionNodestatements, keyword_loc, opening_loc, closing_loc
ProgramNodelocals, statements
RangeNodeleft, right, operator_loc
RationalNodenumerator, denominator
RedoNode(なし)
RegularExpressionNodeopening_loc, content_loc, closing_loc, unescaped
RequiredKeywordParameterNodename, name_loc
RequiredParameterNodename
RescueModifierNodeexpression, keyword_loc, rescue_expression
RescueNodekeyword_loc, exceptions, operator_loc, reference, statements, subsequent
RestParameterNodename, name_loc, operator_loc
RetryNode(なし)
ReturnNodekeyword_loc, arguments
SelfNode(なし)
ShareableConstantNodewrite
SingletonClassNodelocals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc
SourceEncodingNode(なし)
SourceFileNodefilepath
SourceLineNode(なし)
SplatNodeoperator_loc, expression
StatementsNodebody
StringNodeopening_loc, content_loc, closing_loc, unescaped
SuperNodekeyword_loc, lparen_loc, arguments, rparen_loc, block
SymbolNodeopening_loc, value_loc, closing_loc, unescaped
TrueNode(なし)
UndefNodenames, keyword_loc
UnlessNodekeyword_loc, predicate, then_keyword_loc, statements, else_clause, end_keyword_loc
UntilNodekeyword_loc, closing_loc, predicate, statements
WhenNodekeyword_loc, conditions, then_keyword_loc, statements
WhileNodekeyword_loc, closing_loc, predicate, statements
XStringNodeopening_loc, content_loc, closing_loc, unescaped
YieldNodekeyword_loc, lparen_loc, arguments, rparen_loc