Class: Prism::InspectVisitor
- Inherits:
-
Visitor
- Object
- BasicVisitor
- Visitor
- Prism::InspectVisitor
- Defined in:
- lib/prism/inspect_visitor.rb
Overview
This visitor is responsible for composing the strings that get returned by the various #inspect methods defined on each of the nodes.
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
The list of commands that we need to execute in order to compose the final string.
-
#indent ⇒ Object
readonly
The current prefix string.
Class Method Summary collapse
-
.compose(node) ⇒ Object
Compose an inspect string for the given node.
Instance Method Summary collapse
-
#compose ⇒ Object
Compose the final string.
-
#initialize(indent = +"")) ⇒ InspectVisitor
constructor
Initializes a new instance of the InspectVisitor.
-
#visit_alias_global_variable_node(node) ⇒ Object
Inspect a AliasGlobalVariableNode node.
-
#visit_alias_method_node(node) ⇒ Object
Inspect a AliasMethodNode node.
-
#visit_alternation_pattern_node(node) ⇒ Object
Inspect a AlternationPatternNode node.
-
#visit_and_node(node) ⇒ Object
Inspect a AndNode node.
-
#visit_arguments_node(node) ⇒ Object
Inspect a ArgumentsNode node.
-
#visit_array_node(node) ⇒ Object
Inspect a ArrayNode node.
-
#visit_array_pattern_node(node) ⇒ Object
Inspect a ArrayPatternNode node.
-
#visit_assoc_node(node) ⇒ Object
Inspect a AssocNode node.
-
#visit_assoc_splat_node(node) ⇒ Object
Inspect a AssocSplatNode node.
-
#visit_back_reference_read_node(node) ⇒ Object
Inspect a BackReferenceReadNode node.
-
#visit_begin_node(node) ⇒ Object
Inspect a BeginNode node.
-
#visit_block_argument_node(node) ⇒ Object
Inspect a BlockArgumentNode node.
-
#visit_block_local_variable_node(node) ⇒ Object
Inspect a BlockLocalVariableNode node.
-
#visit_block_node(node) ⇒ Object
Inspect a BlockNode node.
-
#visit_block_parameter_node(node) ⇒ Object
Inspect a BlockParameterNode node.
-
#visit_block_parameters_node(node) ⇒ Object
Inspect a BlockParametersNode node.
-
#visit_break_node(node) ⇒ Object
Inspect a BreakNode node.
-
#visit_call_and_write_node(node) ⇒ Object
Inspect a CallAndWriteNode node.
-
#visit_call_node(node) ⇒ Object
Inspect a CallNode node.
-
#visit_call_operator_write_node(node) ⇒ Object
Inspect a CallOperatorWriteNode node.
-
#visit_call_or_write_node(node) ⇒ Object
Inspect a CallOrWriteNode node.
-
#visit_call_target_node(node) ⇒ Object
Inspect a CallTargetNode node.
-
#visit_capture_pattern_node(node) ⇒ Object
Inspect a CapturePatternNode node.
-
#visit_case_match_node(node) ⇒ Object
Inspect a CaseMatchNode node.
-
#visit_case_node(node) ⇒ Object
Inspect a CaseNode node.
-
#visit_class_node(node) ⇒ Object
Inspect a ClassNode node.
-
#visit_class_variable_and_write_node(node) ⇒ Object
Inspect a ClassVariableAndWriteNode node.
-
#visit_class_variable_operator_write_node(node) ⇒ Object
Inspect a ClassVariableOperatorWriteNode node.
-
#visit_class_variable_or_write_node(node) ⇒ Object
Inspect a ClassVariableOrWriteNode node.
-
#visit_class_variable_read_node(node) ⇒ Object
Inspect a ClassVariableReadNode node.
-
#visit_class_variable_target_node(node) ⇒ Object
Inspect a ClassVariableTargetNode node.
-
#visit_class_variable_write_node(node) ⇒ Object
Inspect a ClassVariableWriteNode node.
-
#visit_constant_and_write_node(node) ⇒ Object
Inspect a ConstantAndWriteNode node.
-
#visit_constant_operator_write_node(node) ⇒ Object
Inspect a ConstantOperatorWriteNode node.
-
#visit_constant_or_write_node(node) ⇒ Object
Inspect a ConstantOrWriteNode node.
-
#visit_constant_path_and_write_node(node) ⇒ Object
Inspect a ConstantPathAndWriteNode node.
-
#visit_constant_path_node(node) ⇒ Object
Inspect a ConstantPathNode node.
-
#visit_constant_path_operator_write_node(node) ⇒ Object
Inspect a ConstantPathOperatorWriteNode node.
-
#visit_constant_path_or_write_node(node) ⇒ Object
Inspect a ConstantPathOrWriteNode node.
-
#visit_constant_path_target_node(node) ⇒ Object
Inspect a ConstantPathTargetNode node.
-
#visit_constant_path_write_node(node) ⇒ Object
Inspect a ConstantPathWriteNode node.
-
#visit_constant_read_node(node) ⇒ Object
Inspect a ConstantReadNode node.
-
#visit_constant_target_node(node) ⇒ Object
Inspect a ConstantTargetNode node.
-
#visit_constant_write_node(node) ⇒ Object
Inspect a ConstantWriteNode node.
-
#visit_def_node(node) ⇒ Object
Inspect a DefNode node.
-
#visit_defined_node(node) ⇒ Object
Inspect a DefinedNode node.
-
#visit_else_node(node) ⇒ Object
Inspect a ElseNode node.
-
#visit_embedded_statements_node(node) ⇒ Object
Inspect a EmbeddedStatementsNode node.
-
#visit_embedded_variable_node(node) ⇒ Object
Inspect a EmbeddedVariableNode node.
-
#visit_ensure_node(node) ⇒ Object
Inspect a EnsureNode node.
-
#visit_false_node(node) ⇒ Object
Inspect a FalseNode node.
-
#visit_find_pattern_node(node) ⇒ Object
Inspect a FindPatternNode node.
-
#visit_flip_flop_node(node) ⇒ Object
Inspect a FlipFlopNode node.
-
#visit_float_node(node) ⇒ Object
Inspect a FloatNode node.
-
#visit_for_node(node) ⇒ Object
Inspect a ForNode node.
-
#visit_forwarding_arguments_node(node) ⇒ Object
Inspect a ForwardingArgumentsNode node.
-
#visit_forwarding_parameter_node(node) ⇒ Object
Inspect a ForwardingParameterNode node.
-
#visit_forwarding_super_node(node) ⇒ Object
Inspect a ForwardingSuperNode node.
-
#visit_global_variable_and_write_node(node) ⇒ Object
Inspect a GlobalVariableAndWriteNode node.
-
#visit_global_variable_operator_write_node(node) ⇒ Object
Inspect a GlobalVariableOperatorWriteNode node.
-
#visit_global_variable_or_write_node(node) ⇒ Object
Inspect a GlobalVariableOrWriteNode node.
-
#visit_global_variable_read_node(node) ⇒ Object
Inspect a GlobalVariableReadNode node.
-
#visit_global_variable_target_node(node) ⇒ Object
Inspect a GlobalVariableTargetNode node.
-
#visit_global_variable_write_node(node) ⇒ Object
Inspect a GlobalVariableWriteNode node.
-
#visit_hash_node(node) ⇒ Object
Inspect a HashNode node.
-
#visit_hash_pattern_node(node) ⇒ Object
Inspect a HashPatternNode node.
-
#visit_if_node(node) ⇒ Object
Inspect a IfNode node.
-
#visit_imaginary_node(node) ⇒ Object
Inspect a ImaginaryNode node.
-
#visit_implicit_node(node) ⇒ Object
Inspect a ImplicitNode node.
-
#visit_implicit_rest_node(node) ⇒ Object
Inspect a ImplicitRestNode node.
-
#visit_in_node(node) ⇒ Object
Inspect a InNode node.
-
#visit_index_and_write_node(node) ⇒ Object
Inspect a IndexAndWriteNode node.
-
#visit_index_operator_write_node(node) ⇒ Object
Inspect a IndexOperatorWriteNode node.
-
#visit_index_or_write_node(node) ⇒ Object
Inspect a IndexOrWriteNode node.
-
#visit_index_target_node(node) ⇒ Object
Inspect a IndexTargetNode node.
-
#visit_instance_variable_and_write_node(node) ⇒ Object
Inspect a InstanceVariableAndWriteNode node.
-
#visit_instance_variable_operator_write_node(node) ⇒ Object
Inspect a InstanceVariableOperatorWriteNode node.
-
#visit_instance_variable_or_write_node(node) ⇒ Object
Inspect a InstanceVariableOrWriteNode node.
-
#visit_instance_variable_read_node(node) ⇒ Object
Inspect a InstanceVariableReadNode node.
-
#visit_instance_variable_target_node(node) ⇒ Object
Inspect a InstanceVariableTargetNode node.
-
#visit_instance_variable_write_node(node) ⇒ Object
Inspect a InstanceVariableWriteNode node.
-
#visit_integer_node(node) ⇒ Object
Inspect a IntegerNode node.
-
#visit_interpolated_match_last_line_node(node) ⇒ Object
Inspect a InterpolatedMatchLastLineNode node.
-
#visit_interpolated_regular_expression_node(node) ⇒ Object
Inspect a InterpolatedRegularExpressionNode node.
-
#visit_interpolated_string_node(node) ⇒ Object
Inspect a InterpolatedStringNode node.
-
#visit_interpolated_symbol_node(node) ⇒ Object
Inspect a InterpolatedSymbolNode node.
-
#visit_interpolated_x_string_node(node) ⇒ Object
Inspect a InterpolatedXStringNode node.
-
#visit_it_local_variable_read_node(node) ⇒ Object
Inspect a ItLocalVariableReadNode node.
-
#visit_it_parameters_node(node) ⇒ Object
Inspect a ItParametersNode node.
-
#visit_keyword_hash_node(node) ⇒ Object
Inspect a KeywordHashNode node.
-
#visit_keyword_rest_parameter_node(node) ⇒ Object
Inspect a KeywordRestParameterNode node.
-
#visit_lambda_node(node) ⇒ Object
Inspect a LambdaNode node.
-
#visit_local_variable_and_write_node(node) ⇒ Object
Inspect a LocalVariableAndWriteNode node.
-
#visit_local_variable_operator_write_node(node) ⇒ Object
Inspect a LocalVariableOperatorWriteNode node.
-
#visit_local_variable_or_write_node(node) ⇒ Object
Inspect a LocalVariableOrWriteNode node.
-
#visit_local_variable_read_node(node) ⇒ Object
Inspect a LocalVariableReadNode node.
-
#visit_local_variable_target_node(node) ⇒ Object
Inspect a LocalVariableTargetNode node.
-
#visit_local_variable_write_node(node) ⇒ Object
Inspect a LocalVariableWriteNode node.
-
#visit_match_last_line_node(node) ⇒ Object
Inspect a MatchLastLineNode node.
-
#visit_match_predicate_node(node) ⇒ Object
Inspect a MatchPredicateNode node.
-
#visit_match_required_node(node) ⇒ Object
Inspect a MatchRequiredNode node.
-
#visit_match_write_node(node) ⇒ Object
Inspect a MatchWriteNode node.
-
#visit_missing_node(node) ⇒ Object
Inspect a MissingNode node.
-
#visit_module_node(node) ⇒ Object
Inspect a ModuleNode node.
-
#visit_multi_target_node(node) ⇒ Object
Inspect a MultiTargetNode node.
-
#visit_multi_write_node(node) ⇒ Object
Inspect a MultiWriteNode node.
-
#visit_next_node(node) ⇒ Object
Inspect a NextNode node.
-
#visit_nil_node(node) ⇒ Object
Inspect a NilNode node.
-
#visit_no_keywords_parameter_node(node) ⇒ Object
Inspect a NoKeywordsParameterNode node.
-
#visit_numbered_parameters_node(node) ⇒ Object
Inspect a NumberedParametersNode node.
-
#visit_numbered_reference_read_node(node) ⇒ Object
Inspect a NumberedReferenceReadNode node.
-
#visit_optional_keyword_parameter_node(node) ⇒ Object
Inspect a OptionalKeywordParameterNode node.
-
#visit_optional_parameter_node(node) ⇒ Object
Inspect a OptionalParameterNode node.
-
#visit_or_node(node) ⇒ Object
Inspect a OrNode node.
-
#visit_parameters_node(node) ⇒ Object
Inspect a ParametersNode node.
-
#visit_parentheses_node(node) ⇒ Object
Inspect a ParenthesesNode node.
-
#visit_pinned_expression_node(node) ⇒ Object
Inspect a PinnedExpressionNode node.
-
#visit_pinned_variable_node(node) ⇒ Object
Inspect a PinnedVariableNode node.
-
#visit_post_execution_node(node) ⇒ Object
Inspect a PostExecutionNode node.
-
#visit_pre_execution_node(node) ⇒ Object
Inspect a PreExecutionNode node.
-
#visit_program_node(node) ⇒ Object
Inspect a ProgramNode node.
-
#visit_range_node(node) ⇒ Object
Inspect a RangeNode node.
-
#visit_rational_node(node) ⇒ Object
Inspect a RationalNode node.
-
#visit_redo_node(node) ⇒ Object
Inspect a RedoNode node.
-
#visit_regular_expression_node(node) ⇒ Object
Inspect a RegularExpressionNode node.
-
#visit_required_keyword_parameter_node(node) ⇒ Object
Inspect a RequiredKeywordParameterNode node.
-
#visit_required_parameter_node(node) ⇒ Object
Inspect a RequiredParameterNode node.
-
#visit_rescue_modifier_node(node) ⇒ Object
Inspect a RescueModifierNode node.
-
#visit_rescue_node(node) ⇒ Object
Inspect a RescueNode node.
-
#visit_rest_parameter_node(node) ⇒ Object
Inspect a RestParameterNode node.
-
#visit_retry_node(node) ⇒ Object
Inspect a RetryNode node.
-
#visit_return_node(node) ⇒ Object
Inspect a ReturnNode node.
-
#visit_self_node(node) ⇒ Object
Inspect a SelfNode node.
-
#visit_shareable_constant_node(node) ⇒ Object
Inspect a ShareableConstantNode node.
-
#visit_singleton_class_node(node) ⇒ Object
Inspect a SingletonClassNode node.
-
#visit_source_encoding_node(node) ⇒ Object
Inspect a SourceEncodingNode node.
-
#visit_source_file_node(node) ⇒ Object
Inspect a SourceFileNode node.
-
#visit_source_line_node(node) ⇒ Object
Inspect a SourceLineNode node.
-
#visit_splat_node(node) ⇒ Object
Inspect a SplatNode node.
-
#visit_statements_node(node) ⇒ Object
Inspect a StatementsNode node.
-
#visit_string_node(node) ⇒ Object
Inspect a StringNode node.
-
#visit_super_node(node) ⇒ Object
Inspect a SuperNode node.
-
#visit_symbol_node(node) ⇒ Object
Inspect a SymbolNode node.
-
#visit_true_node(node) ⇒ Object
Inspect a TrueNode node.
-
#visit_undef_node(node) ⇒ Object
Inspect a UndefNode node.
-
#visit_unless_node(node) ⇒ Object
Inspect a UnlessNode node.
-
#visit_until_node(node) ⇒ Object
Inspect a UntilNode node.
-
#visit_when_node(node) ⇒ Object
Inspect a WhenNode node.
-
#visit_while_node(node) ⇒ Object
Inspect a WhileNode node.
-
#visit_x_string_node(node) ⇒ Object
Inspect a XStringNode node.
-
#visit_yield_node(node) ⇒ Object
Inspect a YieldNode node.
Methods inherited from BasicVisitor
#visit, #visit_all, #visit_child_nodes
Constructor Details
#initialize(indent = +"")) ⇒ InspectVisitor
Initializes a new instance of the InspectVisitor.
38 39 40 41 |
# File 'lib/prism/inspect_visitor.rb', line 38 def initialize(indent = +"") @indent = indent @commands = [] end |
Instance Attribute Details
#commands ⇒ Object (readonly)
The list of commands that we need to execute in order to compose the final string.
35 36 37 |
# File 'lib/prism/inspect_visitor.rb', line 35 def commands @commands end |
#indent ⇒ Object (readonly)
The current prefix string.
31 32 33 |
# File 'lib/prism/inspect_visitor.rb', line 31 def indent @indent end |
Class Method Details
.compose(node) ⇒ Object
Compose an inspect string for the given node.
44 45 46 47 48 |
# File 'lib/prism/inspect_visitor.rb', line 44 def self.compose(node) visitor = new node.accept(visitor) visitor.compose end |
Instance Method Details
#compose ⇒ Object
Compose the final string.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/prism/inspect_visitor.rb', line 51 def compose buffer = +"" replace = nil until commands.empty? # @type var command: String | node | Replace # @type var indent: String command, indent = *commands.shift case command when String buffer << (replace || indent) buffer << command replace = nil when Node visitor = InspectVisitor.new(indent) command.accept(visitor) @commands = [*visitor.commands, *@commands] when Replace replace = command.value else raise "Unknown command: #{command.inspect}" end end buffer end |
#visit_alias_global_variable_node(node) ⇒ Object
Inspect a AliasGlobalVariableNode node.
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/prism/inspect_visitor.rb', line 80 def visit_alias_global_variable_node(node) commands << [inspect_node("AliasGlobalVariableNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── new_name:\n", indent] commands << [node.new_name, "#{indent}│ "] commands << ["├── old_name:\n", indent] commands << [node.old_name, "#{indent}│ "] commands << ["└── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] end |
#visit_alias_method_node(node) ⇒ Object
Inspect a AliasMethodNode node.
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/prism/inspect_visitor.rb', line 92 def visit_alias_method_node(node) commands << [inspect_node("AliasMethodNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── new_name:\n", indent] commands << [node.new_name, "#{indent}│ "] commands << ["├── old_name:\n", indent] commands << [node.old_name, "#{indent}│ "] commands << ["└── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] end |
#visit_alternation_pattern_node(node) ⇒ Object
Inspect a AlternationPatternNode node.
104 105 106 107 108 109 110 111 112 113 |
# File 'lib/prism/inspect_visitor.rb', line 104 def visit_alternation_pattern_node(node) commands << [inspect_node("AlternationPatternNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── left:\n", indent] commands << [node.left, "#{indent}│ "] commands << ["├── right:\n", indent] commands << [node.right, "#{indent}│ "] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_and_node(node) ⇒ Object
Inspect a AndNode node.
116 117 118 119 120 121 122 123 124 125 |
# File 'lib/prism/inspect_visitor.rb', line 116 def visit_and_node(node) commands << [inspect_node("AndNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── left:\n", indent] commands << [node.left, "#{indent}│ "] commands << ["├── right:\n", indent] commands << [node.right, "#{indent}│ "] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_arguments_node(node) ⇒ Object
Inspect a ArgumentsNode node.
128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/prism/inspect_visitor.rb', line 128 def visit_arguments_node(node) commands << [inspect_node("ArgumentsNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("contains_forwarding" if node.contains_forwarding?), ("contains_keywords" if node.contains_keywords?), ("contains_keyword_splat" if node.contains_keyword_splat?), ("contains_splat" if node.contains_splat?), ("contains_multiple_splats" if node.contains_multiple_splats?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── arguments: (length: #{(arguments = node.arguments).length})\n", indent] if arguments.any? arguments[0...-1].each do |child| commands << [Replace.new("#{indent} ├── "), indent] commands << [child, "#{indent} │ "] end commands << [Replace.new("#{indent} └── "), indent] commands << [arguments[-1], "#{indent} "] end end |
#visit_array_node(node) ⇒ Object
Inspect a ArrayNode node.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/prism/inspect_visitor.rb', line 144 def visit_array_node(node) commands << [inspect_node("ArrayNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("contains_splat" if node.contains_splat?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── elements: (length: #{(elements = node.elements).length})\n", indent] if elements.any? elements[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [elements[-1], "#{indent}│ "] end commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_array_pattern_node(node) ⇒ Object
Inspect a ArrayPatternNode node.
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/prism/inspect_visitor.rb', line 162 def visit_array_pattern_node(node) commands << [inspect_node("ArrayPatternNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (constant = node.constant).nil? commands << ["├── constant: ∅\n", indent] else commands << ["├── constant:\n", indent] commands << [constant, "#{indent}│ "] end commands << ["├── requireds: (length: #{(requireds = node.requireds).length})\n", indent] if requireds.any? requireds[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [requireds[-1], "#{indent}│ "] end if (rest = node.rest).nil? commands << ["├── rest: ∅\n", indent] else commands << ["├── rest:\n", indent] commands << [rest, "#{indent}│ "] end commands << ["├── posts: (length: #{(posts = node.posts).length})\n", indent] if posts.any? posts[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [posts[-1], "#{indent}│ "] end commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_assoc_node(node) ⇒ Object
Inspect a AssocNode node.
201 202 203 204 205 206 207 208 209 210 |
# File 'lib/prism/inspect_visitor.rb', line 201 def visit_assoc_node(node) commands << [inspect_node("AssocNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── key:\n", indent] commands << [node.key, "#{indent}│ "] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_assoc_splat_node(node) ⇒ Object
Inspect a AssocSplatNode node.
213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/prism/inspect_visitor.rb', line 213 def visit_assoc_splat_node(node) commands << [inspect_node("AssocSplatNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (value = node.value).nil? commands << ["├── value: ∅\n", indent] else commands << ["├── value:\n", indent] commands << [value, "#{indent}│ "] end commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_back_reference_read_node(node) ⇒ Object
Inspect a BackReferenceReadNode node.
227 228 229 230 231 232 |
# File 'lib/prism/inspect_visitor.rb', line 227 def visit_back_reference_read_node(node) commands << [inspect_node("BackReferenceReadNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── name: #{node.name.inspect}\n", indent] end |
#visit_begin_node(node) ⇒ Object
Inspect a BeginNode node.
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File 'lib/prism/inspect_visitor.rb', line 235 def visit_begin_node(node) commands << [inspect_node("BeginNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── begin_keyword_loc: #{inspect_location(node.begin_keyword_loc)}\n", indent] if (statements = node.statements).nil? commands << ["├── statements: ∅\n", indent] else commands << ["├── statements:\n", indent] commands << [statements, "#{indent}│ "] end if (rescue_clause = node.rescue_clause).nil? commands << ["├── rescue_clause: ∅\n", indent] else commands << ["├── rescue_clause:\n", indent] commands << [rescue_clause, "#{indent}│ "] end if (else_clause = node.else_clause).nil? commands << ["├── else_clause: ∅\n", indent] else commands << ["├── else_clause:\n", indent] commands << [else_clause, "#{indent}│ "] end if (ensure_clause = node.ensure_clause).nil? commands << ["├── ensure_clause: ∅\n", indent] else commands << ["├── ensure_clause:\n", indent] commands << [ensure_clause, "#{indent}│ "] end commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent] end |
#visit_block_argument_node(node) ⇒ Object
Inspect a BlockArgumentNode node.
268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/prism/inspect_visitor.rb', line 268 def visit_block_argument_node(node) commands << [inspect_node("BlockArgumentNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (expression = node.expression).nil? commands << ["├── expression: ∅\n", indent] else commands << ["├── expression:\n", indent] commands << [expression, "#{indent}│ "] end commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_block_local_variable_node(node) ⇒ Object
Inspect a BlockLocalVariableNode node.
282 283 284 285 286 287 |
# File 'lib/prism/inspect_visitor.rb', line 282 def visit_block_local_variable_node(node) commands << [inspect_node("BlockLocalVariableNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── name: #{node.name.inspect}\n", indent] end |
#visit_block_node(node) ⇒ Object
Inspect a BlockNode node.
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/prism/inspect_visitor.rb', line 290 def visit_block_node(node) commands << [inspect_node("BlockNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── locals: #{node.locals.inspect}\n", indent] if (parameters = node.parameters).nil? commands << ["├── parameters: ∅\n", indent] else commands << ["├── parameters:\n", indent] commands << [parameters, "#{indent}│ "] end if (body = node.body).nil? commands << ["├── body: ∅\n", indent] else commands << ["├── body:\n", indent] commands << [body, "#{indent}│ "] end commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_block_parameter_node(node) ⇒ Object
Inspect a BlockParameterNode node.
312 313 314 315 316 317 318 319 320 321 322 323 |
# File 'lib/prism/inspect_visitor.rb', line 312 def visit_block_parameter_node(node) commands << [inspect_node("BlockParameterNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (name = node.name).nil? commands << ["├── name: ∅\n", indent] else commands << ["├── name: #{name.inspect}\n", indent] end commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_block_parameters_node(node) ⇒ Object
Inspect a BlockParametersNode node.
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'lib/prism/inspect_visitor.rb', line 326 def visit_block_parameters_node(node) commands << [inspect_node("BlockParametersNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (parameters = node.parameters).nil? commands << ["├── parameters: ∅\n", indent] else commands << ["├── parameters:\n", indent] commands << [parameters, "#{indent}│ "] end commands << ["├── locals: (length: #{(locals = node.locals).length})\n", indent] if locals.any? locals[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [locals[-1], "#{indent}│ "] end commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_break_node(node) ⇒ Object
Inspect a BreakNode node.
350 351 352 353 354 355 356 357 358 359 360 361 |
# File 'lib/prism/inspect_visitor.rb', line 350 def visit_break_node(node) commands << [inspect_node("BreakNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (arguments = node.arguments).nil? commands << ["├── arguments: ∅\n", indent] else commands << ["├── arguments:\n", indent] commands << [arguments, "#{indent}│ "] end commands << ["└── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] end |
#visit_call_and_write_node(node) ⇒ Object
Inspect a CallAndWriteNode node.
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'lib/prism/inspect_visitor.rb', line 364 def visit_call_and_write_node(node) commands << [inspect_node("CallAndWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (receiver = node.receiver).nil? commands << ["├── receiver: ∅\n", indent] else commands << ["├── receiver:\n", indent] commands << [receiver, "#{indent}│ "] end commands << ["├── call_operator_loc: #{inspect_location(node.call_operator_loc)}\n", indent] commands << ["├── message_loc: #{inspect_location(node.)}\n", indent] commands << ["├── read_name: #{node.read_name.inspect}\n", indent] commands << ["├── write_name: #{node.write_name.inspect}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_call_node(node) ⇒ Object
Inspect a CallNode node.
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/prism/inspect_visitor.rb', line 384 def visit_call_node(node) commands << [inspect_node("CallNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (receiver = node.receiver).nil? commands << ["├── receiver: ∅\n", indent] else commands << ["├── receiver:\n", indent] commands << [receiver, "#{indent}│ "] end commands << ["├── call_operator_loc: #{inspect_location(node.call_operator_loc)}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── message_loc: #{inspect_location(node.)}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] if (arguments = node.arguments).nil? commands << ["├── arguments: ∅\n", indent] else commands << ["├── arguments:\n", indent] commands << [arguments, "#{indent}│ "] end commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] if (block = node.block).nil? commands << ["└── block: ∅\n", indent] else commands << ["└── block:\n", indent] commands << [block, "#{indent} "] end end |
#visit_call_operator_write_node(node) ⇒ Object
Inspect a CallOperatorWriteNode node.
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/prism/inspect_visitor.rb', line 414 def visit_call_operator_write_node(node) commands << [inspect_node("CallOperatorWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (receiver = node.receiver).nil? commands << ["├── receiver: ∅\n", indent] else commands << ["├── receiver:\n", indent] commands << [receiver, "#{indent}│ "] end commands << ["├── call_operator_loc: #{inspect_location(node.call_operator_loc)}\n", indent] commands << ["├── message_loc: #{inspect_location(node.)}\n", indent] commands << ["├── read_name: #{node.read_name.inspect}\n", indent] commands << ["├── write_name: #{node.write_name.inspect}\n", indent] commands << ["├── binary_operator: #{node.binary_operator.inspect}\n", indent] commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_call_or_write_node(node) ⇒ Object
Inspect a CallOrWriteNode node.
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/prism/inspect_visitor.rb', line 435 def visit_call_or_write_node(node) commands << [inspect_node("CallOrWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (receiver = node.receiver).nil? commands << ["├── receiver: ∅\n", indent] else commands << ["├── receiver:\n", indent] commands << [receiver, "#{indent}│ "] end commands << ["├── call_operator_loc: #{inspect_location(node.call_operator_loc)}\n", indent] commands << ["├── message_loc: #{inspect_location(node.)}\n", indent] commands << ["├── read_name: #{node.read_name.inspect}\n", indent] commands << ["├── write_name: #{node.write_name.inspect}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_call_target_node(node) ⇒ Object
Inspect a CallTargetNode node.
455 456 457 458 459 460 461 462 463 464 |
# File 'lib/prism/inspect_visitor.rb', line 455 def visit_call_target_node(node) commands << [inspect_node("CallTargetNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── receiver:\n", indent] commands << [node.receiver, "#{indent}│ "] commands << ["├── call_operator_loc: #{inspect_location(node.call_operator_loc)}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["└── message_loc: #{inspect_location(node.)}\n", indent] end |
#visit_capture_pattern_node(node) ⇒ Object
Inspect a CapturePatternNode node.
467 468 469 470 471 472 473 474 475 476 |
# File 'lib/prism/inspect_visitor.rb', line 467 def visit_capture_pattern_node(node) commands << [inspect_node("CapturePatternNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["├── target:\n", indent] commands << [node.target, "#{indent}│ "] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_case_match_node(node) ⇒ Object
Inspect a CaseMatchNode node.
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 |
# File 'lib/prism/inspect_visitor.rb', line 479 def visit_case_match_node(node) commands << [inspect_node("CaseMatchNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (predicate = node.predicate).nil? commands << ["├── predicate: ∅\n", indent] else commands << ["├── predicate:\n", indent] commands << [predicate, "#{indent}│ "] end commands << ["├── conditions: (length: #{(conditions = node.conditions).length})\n", indent] if conditions.any? conditions[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [conditions[-1], "#{indent}│ "] end if (else_clause = node.else_clause).nil? commands << ["├── else_clause: ∅\n", indent] else commands << ["├── else_clause:\n", indent] commands << [else_clause, "#{indent}│ "] end commands << ["├── case_keyword_loc: #{inspect_location(node.case_keyword_loc)}\n", indent] commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent] end |
#visit_case_node(node) ⇒ Object
Inspect a CaseNode node.
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 |
# File 'lib/prism/inspect_visitor.rb', line 509 def visit_case_node(node) commands << [inspect_node("CaseNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (predicate = node.predicate).nil? commands << ["├── predicate: ∅\n", indent] else commands << ["├── predicate:\n", indent] commands << [predicate, "#{indent}│ "] end commands << ["├── conditions: (length: #{(conditions = node.conditions).length})\n", indent] if conditions.any? conditions[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [conditions[-1], "#{indent}│ "] end if (else_clause = node.else_clause).nil? commands << ["├── else_clause: ∅\n", indent] else commands << ["├── else_clause:\n", indent] commands << [else_clause, "#{indent}│ "] end commands << ["├── case_keyword_loc: #{inspect_location(node.case_keyword_loc)}\n", indent] commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent] end |
#visit_class_node(node) ⇒ Object
Inspect a ClassNode node.
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
# File 'lib/prism/inspect_visitor.rb', line 539 def visit_class_node(node) commands << [inspect_node("ClassNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── locals: #{node.locals.inspect}\n", indent] commands << ["├── class_keyword_loc: #{inspect_location(node.class_keyword_loc)}\n", indent] commands << ["├── constant_path:\n", indent] commands << [node.constant_path, "#{indent}│ "] commands << ["├── inheritance_operator_loc: #{inspect_location(node.inheritance_operator_loc)}\n", indent] if (superclass = node.superclass).nil? commands << ["├── superclass: ∅\n", indent] else commands << ["├── superclass:\n", indent] commands << [superclass, "#{indent}│ "] end if (body = node.body).nil? commands << ["├── body: ∅\n", indent] else commands << ["├── body:\n", indent] commands << [body, "#{indent}│ "] end commands << ["├── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent] commands << ["└── name: #{node.name.inspect}\n", indent] end |
#visit_class_variable_and_write_node(node) ⇒ Object
Inspect a ClassVariableAndWriteNode node.
565 566 567 568 569 570 571 572 573 574 |
# File 'lib/prism/inspect_visitor.rb', line 565 def visit_class_variable_and_write_node(node) commands << [inspect_node("ClassVariableAndWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_class_variable_operator_write_node(node) ⇒ Object
Inspect a ClassVariableOperatorWriteNode node.
577 578 579 580 581 582 583 584 585 586 587 |
# File 'lib/prism/inspect_visitor.rb', line 577 def visit_class_variable_operator_write_node(node) commands << [inspect_node("ClassVariableOperatorWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["└── binary_operator: #{node.binary_operator.inspect}\n", indent] end |
#visit_class_variable_or_write_node(node) ⇒ Object
Inspect a ClassVariableOrWriteNode node.
590 591 592 593 594 595 596 597 598 599 |
# File 'lib/prism/inspect_visitor.rb', line 590 def visit_class_variable_or_write_node(node) commands << [inspect_node("ClassVariableOrWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_class_variable_read_node(node) ⇒ Object
Inspect a ClassVariableReadNode node.
602 603 604 605 606 607 |
# File 'lib/prism/inspect_visitor.rb', line 602 def visit_class_variable_read_node(node) commands << [inspect_node("ClassVariableReadNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── name: #{node.name.inspect}\n", indent] end |
#visit_class_variable_target_node(node) ⇒ Object
Inspect a ClassVariableTargetNode node.
610 611 612 613 614 615 |
# File 'lib/prism/inspect_visitor.rb', line 610 def visit_class_variable_target_node(node) commands << [inspect_node("ClassVariableTargetNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── name: #{node.name.inspect}\n", indent] end |
#visit_class_variable_write_node(node) ⇒ Object
Inspect a ClassVariableWriteNode node.
618 619 620 621 622 623 624 625 626 627 |
# File 'lib/prism/inspect_visitor.rb', line 618 def visit_class_variable_write_node(node) commands << [inspect_node("ClassVariableWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_constant_and_write_node(node) ⇒ Object
Inspect a ConstantAndWriteNode node.
630 631 632 633 634 635 636 637 638 639 |
# File 'lib/prism/inspect_visitor.rb', line 630 def visit_constant_and_write_node(node) commands << [inspect_node("ConstantAndWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_constant_operator_write_node(node) ⇒ Object
Inspect a ConstantOperatorWriteNode node.
642 643 644 645 646 647 648 649 650 651 652 |
# File 'lib/prism/inspect_visitor.rb', line 642 def visit_constant_operator_write_node(node) commands << [inspect_node("ConstantOperatorWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["└── binary_operator: #{node.binary_operator.inspect}\n", indent] end |
#visit_constant_or_write_node(node) ⇒ Object
Inspect a ConstantOrWriteNode node.
655 656 657 658 659 660 661 662 663 664 |
# File 'lib/prism/inspect_visitor.rb', line 655 def visit_constant_or_write_node(node) commands << [inspect_node("ConstantOrWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_constant_path_and_write_node(node) ⇒ Object
Inspect a ConstantPathAndWriteNode node.
667 668 669 670 671 672 673 674 675 676 |
# File 'lib/prism/inspect_visitor.rb', line 667 def visit_constant_path_and_write_node(node) commands << [inspect_node("ConstantPathAndWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── target:\n", indent] commands << [node.target, "#{indent}│ "] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_constant_path_node(node) ⇒ Object
Inspect a ConstantPathNode node.
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 |
# File 'lib/prism/inspect_visitor.rb', line 679 def visit_constant_path_node(node) commands << [inspect_node("ConstantPathNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (parent = node.parent).nil? commands << ["├── parent: ∅\n", indent] else commands << ["├── parent:\n", indent] commands << [parent, "#{indent}│ "] end if (name = node.name).nil? commands << ["├── name: ∅\n", indent] else commands << ["├── name: #{name.inspect}\n", indent] end commands << ["├── delimiter_loc: #{inspect_location(node.delimiter_loc)}\n", indent] commands << ["└── name_loc: #{inspect_location(node.name_loc)}\n", indent] end |
#visit_constant_path_operator_write_node(node) ⇒ Object
Inspect a ConstantPathOperatorWriteNode node.
699 700 701 702 703 704 705 706 707 708 709 |
# File 'lib/prism/inspect_visitor.rb', line 699 def visit_constant_path_operator_write_node(node) commands << [inspect_node("ConstantPathOperatorWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── target:\n", indent] commands << [node.target, "#{indent}│ "] commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["└── binary_operator: #{node.binary_operator.inspect}\n", indent] end |
#visit_constant_path_or_write_node(node) ⇒ Object
Inspect a ConstantPathOrWriteNode node.
712 713 714 715 716 717 718 719 720 721 |
# File 'lib/prism/inspect_visitor.rb', line 712 def visit_constant_path_or_write_node(node) commands << [inspect_node("ConstantPathOrWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── target:\n", indent] commands << [node.target, "#{indent}│ "] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_constant_path_target_node(node) ⇒ Object
Inspect a ConstantPathTargetNode node.
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 |
# File 'lib/prism/inspect_visitor.rb', line 724 def visit_constant_path_target_node(node) commands << [inspect_node("ConstantPathTargetNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (parent = node.parent).nil? commands << ["├── parent: ∅\n", indent] else commands << ["├── parent:\n", indent] commands << [parent, "#{indent}│ "] end if (name = node.name).nil? commands << ["├── name: ∅\n", indent] else commands << ["├── name: #{name.inspect}\n", indent] end commands << ["├── delimiter_loc: #{inspect_location(node.delimiter_loc)}\n", indent] commands << ["└── name_loc: #{inspect_location(node.name_loc)}\n", indent] end |
#visit_constant_path_write_node(node) ⇒ Object
Inspect a ConstantPathWriteNode node.
744 745 746 747 748 749 750 751 752 753 |
# File 'lib/prism/inspect_visitor.rb', line 744 def visit_constant_path_write_node(node) commands << [inspect_node("ConstantPathWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── target:\n", indent] commands << [node.target, "#{indent}│ "] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_constant_read_node(node) ⇒ Object
Inspect a ConstantReadNode node.
756 757 758 759 760 761 |
# File 'lib/prism/inspect_visitor.rb', line 756 def visit_constant_read_node(node) commands << [inspect_node("ConstantReadNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── name: #{node.name.inspect}\n", indent] end |
#visit_constant_target_node(node) ⇒ Object
Inspect a ConstantTargetNode node.
764 765 766 767 768 769 |
# File 'lib/prism/inspect_visitor.rb', line 764 def visit_constant_target_node(node) commands << [inspect_node("ConstantTargetNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── name: #{node.name.inspect}\n", indent] end |
#visit_constant_write_node(node) ⇒ Object
Inspect a ConstantWriteNode node.
772 773 774 775 776 777 778 779 780 781 |
# File 'lib/prism/inspect_visitor.rb', line 772 def visit_constant_write_node(node) commands << [inspect_node("ConstantWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_def_node(node) ⇒ Object
Inspect a DefNode node.
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 |
# File 'lib/prism/inspect_visitor.rb', line 784 def visit_def_node(node) commands << [inspect_node("DefNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] if (receiver = node.receiver).nil? commands << ["├── receiver: ∅\n", indent] else commands << ["├── receiver:\n", indent] commands << [receiver, "#{indent}│ "] end if (parameters = node.parameters).nil? commands << ["├── parameters: ∅\n", indent] else commands << ["├── parameters:\n", indent] commands << [parameters, "#{indent}│ "] end if (body = node.body).nil? commands << ["├── body: ∅\n", indent] else commands << ["├── body:\n", indent] commands << [body, "#{indent}│ "] end commands << ["├── locals: #{node.locals.inspect}\n", indent] commands << ["├── def_keyword_loc: #{inspect_location(node.def_keyword_loc)}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["├── lparen_loc: #{inspect_location(node.lparen_loc)}\n", indent] commands << ["├── rparen_loc: #{inspect_location(node.rparen_loc)}\n", indent] commands << ["├── equal_loc: #{inspect_location(node.equal_loc)}\n", indent] commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent] end |
#visit_defined_node(node) ⇒ Object
Inspect a DefinedNode node.
818 819 820 821 822 823 824 825 826 827 |
# File 'lib/prism/inspect_visitor.rb', line 818 def visit_defined_node(node) commands << [inspect_node("DefinedNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── lparen_loc: #{inspect_location(node.lparen_loc)}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["├── rparen_loc: #{inspect_location(node.rparen_loc)}\n", indent] commands << ["└── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] end |
#visit_else_node(node) ⇒ Object
Inspect a ElseNode node.
830 831 832 833 834 835 836 837 838 839 840 841 842 |
# File 'lib/prism/inspect_visitor.rb', line 830 def visit_else_node(node) commands << [inspect_node("ElseNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── else_keyword_loc: #{inspect_location(node.else_keyword_loc)}\n", indent] if (statements = node.statements).nil? commands << ["├── statements: ∅\n", indent] else commands << ["├── statements:\n", indent] commands << [statements, "#{indent}│ "] end commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent] end |
#visit_embedded_statements_node(node) ⇒ Object
Inspect a EmbeddedStatementsNode node.
845 846 847 848 849 850 851 852 853 854 855 856 857 |
# File 'lib/prism/inspect_visitor.rb', line 845 def (node) commands << [inspect_node("EmbeddedStatementsNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] if (statements = node.statements).nil? commands << ["├── statements: ∅\n", indent] else commands << ["├── statements:\n", indent] commands << [statements, "#{indent}│ "] end commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_embedded_variable_node(node) ⇒ Object
Inspect a EmbeddedVariableNode node.
860 861 862 863 864 865 866 867 |
# File 'lib/prism/inspect_visitor.rb', line 860 def (node) commands << [inspect_node("EmbeddedVariableNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── variable:\n", indent] commands << [node.variable, "#{indent} "] end |
#visit_ensure_node(node) ⇒ Object
Inspect a EnsureNode node.
870 871 872 873 874 875 876 877 878 879 880 881 882 |
# File 'lib/prism/inspect_visitor.rb', line 870 def visit_ensure_node(node) commands << [inspect_node("EnsureNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── ensure_keyword_loc: #{inspect_location(node.ensure_keyword_loc)}\n", indent] if (statements = node.statements).nil? commands << ["├── statements: ∅\n", indent] else commands << ["├── statements:\n", indent] commands << [statements, "#{indent}│ "] end commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent] end |
#visit_false_node(node) ⇒ Object
Inspect a FalseNode node.
885 886 887 888 889 |
# File 'lib/prism/inspect_visitor.rb', line 885 def visit_false_node(node) commands << [inspect_node("FalseNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] end |
#visit_find_pattern_node(node) ⇒ Object
Inspect a FindPatternNode node.
892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 |
# File 'lib/prism/inspect_visitor.rb', line 892 def visit_find_pattern_node(node) commands << [inspect_node("FindPatternNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (constant = node.constant).nil? commands << ["├── constant: ∅\n", indent] else commands << ["├── constant:\n", indent] commands << [constant, "#{indent}│ "] end commands << ["├── left:\n", indent] commands << [node.left, "#{indent}│ "] commands << ["├── requireds: (length: #{(requireds = node.requireds).length})\n", indent] if requireds.any? requireds[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [requireds[-1], "#{indent}│ "] end commands << ["├── right:\n", indent] commands << [node.right, "#{indent}│ "] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_flip_flop_node(node) ⇒ Object
Inspect a FlipFlopNode node.
920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 |
# File 'lib/prism/inspect_visitor.rb', line 920 def visit_flip_flop_node(node) commands << [inspect_node("FlipFlopNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("exclude_end" if node.exclude_end?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (left = node.left).nil? commands << ["├── left: ∅\n", indent] else commands << ["├── left:\n", indent] commands << [left, "#{indent}│ "] end if (right = node.right).nil? commands << ["├── right: ∅\n", indent] else commands << ["├── right:\n", indent] commands << [right, "#{indent}│ "] end commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_float_node(node) ⇒ Object
Inspect a FloatNode node.
940 941 942 943 944 945 |
# File 'lib/prism/inspect_visitor.rb', line 940 def visit_float_node(node) commands << [inspect_node("FloatNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── value: #{node.value.inspect}\n", indent] end |
#visit_for_node(node) ⇒ Object
Inspect a ForNode node.
948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 |
# File 'lib/prism/inspect_visitor.rb', line 948 def visit_for_node(node) commands << [inspect_node("ForNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── index:\n", indent] commands << [node.index, "#{indent}│ "] commands << ["├── collection:\n", indent] commands << [node.collection, "#{indent}│ "] if (statements = node.statements).nil? commands << ["├── statements: ∅\n", indent] else commands << ["├── statements:\n", indent] commands << [statements, "#{indent}│ "] end commands << ["├── for_keyword_loc: #{inspect_location(node.for_keyword_loc)}\n", indent] commands << ["├── in_keyword_loc: #{inspect_location(node.in_keyword_loc)}\n", indent] commands << ["├── do_keyword_loc: #{inspect_location(node.do_keyword_loc)}\n", indent] commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent] end |
#visit_forwarding_arguments_node(node) ⇒ Object
Inspect a ForwardingArgumentsNode node.
969 970 971 972 973 |
# File 'lib/prism/inspect_visitor.rb', line 969 def visit_forwarding_arguments_node(node) commands << [inspect_node("ForwardingArgumentsNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] end |
#visit_forwarding_parameter_node(node) ⇒ Object
Inspect a ForwardingParameterNode node.
976 977 978 979 980 |
# File 'lib/prism/inspect_visitor.rb', line 976 def visit_forwarding_parameter_node(node) commands << [inspect_node("ForwardingParameterNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] end |
#visit_forwarding_super_node(node) ⇒ Object
Inspect a ForwardingSuperNode node.
983 984 985 986 987 988 989 990 991 992 993 |
# File 'lib/prism/inspect_visitor.rb', line 983 def visit_forwarding_super_node(node) commands << [inspect_node("ForwardingSuperNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (block = node.block).nil? commands << ["└── block: ∅\n", indent] else commands << ["└── block:\n", indent] commands << [block, "#{indent} "] end end |
#visit_global_variable_and_write_node(node) ⇒ Object
Inspect a GlobalVariableAndWriteNode node.
996 997 998 999 1000 1001 1002 1003 1004 1005 |
# File 'lib/prism/inspect_visitor.rb', line 996 def visit_global_variable_and_write_node(node) commands << [inspect_node("GlobalVariableAndWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_global_variable_operator_write_node(node) ⇒ Object
Inspect a GlobalVariableOperatorWriteNode node.
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 |
# File 'lib/prism/inspect_visitor.rb', line 1008 def visit_global_variable_operator_write_node(node) commands << [inspect_node("GlobalVariableOperatorWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["└── binary_operator: #{node.binary_operator.inspect}\n", indent] end |
#visit_global_variable_or_write_node(node) ⇒ Object
Inspect a GlobalVariableOrWriteNode node.
1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 |
# File 'lib/prism/inspect_visitor.rb', line 1021 def visit_global_variable_or_write_node(node) commands << [inspect_node("GlobalVariableOrWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_global_variable_read_node(node) ⇒ Object
Inspect a GlobalVariableReadNode node.
1033 1034 1035 1036 1037 1038 |
# File 'lib/prism/inspect_visitor.rb', line 1033 def visit_global_variable_read_node(node) commands << [inspect_node("GlobalVariableReadNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── name: #{node.name.inspect}\n", indent] end |
#visit_global_variable_target_node(node) ⇒ Object
Inspect a GlobalVariableTargetNode node.
1041 1042 1043 1044 1045 1046 |
# File 'lib/prism/inspect_visitor.rb', line 1041 def visit_global_variable_target_node(node) commands << [inspect_node("GlobalVariableTargetNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── name: #{node.name.inspect}\n", indent] end |
#visit_global_variable_write_node(node) ⇒ Object
Inspect a GlobalVariableWriteNode node.
1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 |
# File 'lib/prism/inspect_visitor.rb', line 1049 def visit_global_variable_write_node(node) commands << [inspect_node("GlobalVariableWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_hash_node(node) ⇒ Object
Inspect a HashNode node.
1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 |
# File 'lib/prism/inspect_visitor.rb', line 1061 def visit_hash_node(node) commands << [inspect_node("HashNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["├── elements: (length: #{(elements = node.elements).length})\n", indent] if elements.any? elements[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [elements[-1], "#{indent}│ "] end commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_hash_pattern_node(node) ⇒ Object
Inspect a HashPatternNode node.
1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 |
# File 'lib/prism/inspect_visitor.rb', line 1079 def visit_hash_pattern_node(node) commands << [inspect_node("HashPatternNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (constant = node.constant).nil? commands << ["├── constant: ∅\n", indent] else commands << ["├── constant:\n", indent] commands << [constant, "#{indent}│ "] end commands << ["├── elements: (length: #{(elements = node.elements).length})\n", indent] if elements.any? elements[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [elements[-1], "#{indent}│ "] end if (rest = node.rest).nil? commands << ["├── rest: ∅\n", indent] else commands << ["├── rest:\n", indent] commands << [rest, "#{indent}│ "] end commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_if_node(node) ⇒ Object
Inspect a IfNode node.
1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 |
# File 'lib/prism/inspect_visitor.rb', line 1109 def visit_if_node(node) commands << [inspect_node("IfNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── if_keyword_loc: #{inspect_location(node.if_keyword_loc)}\n", indent] commands << ["├── predicate:\n", indent] commands << [node.predicate, "#{indent}│ "] commands << ["├── then_keyword_loc: #{inspect_location(node.then_keyword_loc)}\n", indent] if (statements = node.statements).nil? commands << ["├── statements: ∅\n", indent] else commands << ["├── statements:\n", indent] commands << [statements, "#{indent}│ "] end if (subsequent = node.subsequent).nil? commands << ["├── subsequent: ∅\n", indent] else commands << ["├── subsequent:\n", indent] commands << [subsequent, "#{indent}│ "] end commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent] end |
#visit_imaginary_node(node) ⇒ Object
Inspect a ImaginaryNode node.
1133 1134 1135 1136 1137 1138 1139 |
# File 'lib/prism/inspect_visitor.rb', line 1133 def visit_imaginary_node(node) commands << [inspect_node("ImaginaryNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── numeric:\n", indent] commands << [node.numeric, "#{indent} "] end |
#visit_implicit_node(node) ⇒ Object
Inspect a ImplicitNode node.
1142 1143 1144 1145 1146 1147 1148 |
# File 'lib/prism/inspect_visitor.rb', line 1142 def visit_implicit_node(node) commands << [inspect_node("ImplicitNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_implicit_rest_node(node) ⇒ Object
Inspect a ImplicitRestNode node.
1151 1152 1153 1154 1155 |
# File 'lib/prism/inspect_visitor.rb', line 1151 def visit_implicit_rest_node(node) commands << [inspect_node("ImplicitRestNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] end |
#visit_in_node(node) ⇒ Object
Inspect a InNode node.
1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 |
# File 'lib/prism/inspect_visitor.rb', line 1158 def visit_in_node(node) commands << [inspect_node("InNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── pattern:\n", indent] commands << [node.pattern, "#{indent}│ "] if (statements = node.statements).nil? commands << ["├── statements: ∅\n", indent] else commands << ["├── statements:\n", indent] commands << [statements, "#{indent}│ "] end commands << ["├── in_loc: #{inspect_location(node.in_loc)}\n", indent] commands << ["└── then_loc: #{inspect_location(node.then_loc)}\n", indent] end |
#visit_index_and_write_node(node) ⇒ Object
Inspect a IndexAndWriteNode node.
1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 |
# File 'lib/prism/inspect_visitor.rb', line 1175 def visit_index_and_write_node(node) commands << [inspect_node("IndexAndWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (receiver = node.receiver).nil? commands << ["├── receiver: ∅\n", indent] else commands << ["├── receiver:\n", indent] commands << [receiver, "#{indent}│ "] end commands << ["├── call_operator_loc: #{inspect_location(node.call_operator_loc)}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] if (arguments = node.arguments).nil? commands << ["├── arguments: ∅\n", indent] else commands << ["├── arguments:\n", indent] commands << [arguments, "#{indent}│ "] end commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] if (block = node.block).nil? commands << ["├── block: ∅\n", indent] else commands << ["├── block:\n", indent] commands << [block, "#{indent}│ "] end commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_index_operator_write_node(node) ⇒ Object
Inspect a IndexOperatorWriteNode node.
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 |
# File 'lib/prism/inspect_visitor.rb', line 1206 def visit_index_operator_write_node(node) commands << [inspect_node("IndexOperatorWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (receiver = node.receiver).nil? commands << ["├── receiver: ∅\n", indent] else commands << ["├── receiver:\n", indent] commands << [receiver, "#{indent}│ "] end commands << ["├── call_operator_loc: #{inspect_location(node.call_operator_loc)}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] if (arguments = node.arguments).nil? commands << ["├── arguments: ∅\n", indent] else commands << ["├── arguments:\n", indent] commands << [arguments, "#{indent}│ "] end commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] if (block = node.block).nil? commands << ["├── block: ∅\n", indent] else commands << ["├── block:\n", indent] commands << [block, "#{indent}│ "] end commands << ["├── binary_operator: #{node.binary_operator.inspect}\n", indent] commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_index_or_write_node(node) ⇒ Object
Inspect a IndexOrWriteNode node.
1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 |
# File 'lib/prism/inspect_visitor.rb', line 1238 def visit_index_or_write_node(node) commands << [inspect_node("IndexOrWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (receiver = node.receiver).nil? commands << ["├── receiver: ∅\n", indent] else commands << ["├── receiver:\n", indent] commands << [receiver, "#{indent}│ "] end commands << ["├── call_operator_loc: #{inspect_location(node.call_operator_loc)}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] if (arguments = node.arguments).nil? commands << ["├── arguments: ∅\n", indent] else commands << ["├── arguments:\n", indent] commands << [arguments, "#{indent}│ "] end commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] if (block = node.block).nil? commands << ["├── block: ∅\n", indent] else commands << ["├── block:\n", indent] commands << [block, "#{indent}│ "] end commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_index_target_node(node) ⇒ Object
Inspect a IndexTargetNode node.
1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 |
# File 'lib/prism/inspect_visitor.rb', line 1269 def visit_index_target_node(node) commands << [inspect_node("IndexTargetNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── receiver:\n", indent] commands << [node.receiver, "#{indent}│ "] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] if (arguments = node.arguments).nil? commands << ["├── arguments: ∅\n", indent] else commands << ["├── arguments:\n", indent] commands << [arguments, "#{indent}│ "] end commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] if (block = node.block).nil? commands << ["└── block: ∅\n", indent] else commands << ["└── block:\n", indent] commands << [block, "#{indent} "] end end |
#visit_instance_variable_and_write_node(node) ⇒ Object
Inspect a InstanceVariableAndWriteNode node.
1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 |
# File 'lib/prism/inspect_visitor.rb', line 1292 def visit_instance_variable_and_write_node(node) commands << [inspect_node("InstanceVariableAndWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_instance_variable_operator_write_node(node) ⇒ Object
Inspect a InstanceVariableOperatorWriteNode node.
1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 |
# File 'lib/prism/inspect_visitor.rb', line 1304 def visit_instance_variable_operator_write_node(node) commands << [inspect_node("InstanceVariableOperatorWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["└── binary_operator: #{node.binary_operator.inspect}\n", indent] end |
#visit_instance_variable_or_write_node(node) ⇒ Object
Inspect a InstanceVariableOrWriteNode node.
1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 |
# File 'lib/prism/inspect_visitor.rb', line 1317 def visit_instance_variable_or_write_node(node) commands << [inspect_node("InstanceVariableOrWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_instance_variable_read_node(node) ⇒ Object
Inspect a InstanceVariableReadNode node.
1329 1330 1331 1332 1333 1334 |
# File 'lib/prism/inspect_visitor.rb', line 1329 def visit_instance_variable_read_node(node) commands << [inspect_node("InstanceVariableReadNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── name: #{node.name.inspect}\n", indent] end |
#visit_instance_variable_target_node(node) ⇒ Object
Inspect a InstanceVariableTargetNode node.
1337 1338 1339 1340 1341 1342 |
# File 'lib/prism/inspect_visitor.rb', line 1337 def visit_instance_variable_target_node(node) commands << [inspect_node("InstanceVariableTargetNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── name: #{node.name.inspect}\n", indent] end |
#visit_instance_variable_write_node(node) ⇒ Object
Inspect a InstanceVariableWriteNode node.
1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 |
# File 'lib/prism/inspect_visitor.rb', line 1345 def visit_instance_variable_write_node(node) commands << [inspect_node("InstanceVariableWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_integer_node(node) ⇒ Object
Inspect a IntegerNode node.
1357 1358 1359 1360 1361 1362 |
# File 'lib/prism/inspect_visitor.rb', line 1357 def visit_integer_node(node) commands << [inspect_node("IntegerNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("binary" if node.binary?), ("decimal" if node.decimal?), ("octal" if node.octal?), ("hexadecimal" if node.hexadecimal?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── value: #{node.value.inspect}\n", indent] end |
#visit_interpolated_match_last_line_node(node) ⇒ Object
Inspect a InterpolatedMatchLastLineNode node.
1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 |
# File 'lib/prism/inspect_visitor.rb', line 1365 def visit_interpolated_match_last_line_node(node) commands << [inspect_node("InterpolatedMatchLastLineNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("ignore_case" if node.ignore_case?), ("extended" if node.extended?), ("multi_line" if node.multi_line?), ("once" if node.once?), ("euc_jp" if node.euc_jp?), ("ascii_8bit" if node.ascii_8bit?), ("windows_31j" if node.windows_31j?), ("utf_8" if node.utf_8?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["├── parts: (length: #{(parts = node.parts).length})\n", indent] if parts.any? parts[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [parts[-1], "#{indent}│ "] end commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_interpolated_regular_expression_node(node) ⇒ Object
Inspect a InterpolatedRegularExpressionNode node.
1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 |
# File 'lib/prism/inspect_visitor.rb', line 1383 def visit_interpolated_regular_expression_node(node) commands << [inspect_node("InterpolatedRegularExpressionNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("ignore_case" if node.ignore_case?), ("extended" if node.extended?), ("multi_line" if node.multi_line?), ("once" if node.once?), ("euc_jp" if node.euc_jp?), ("ascii_8bit" if node.ascii_8bit?), ("windows_31j" if node.windows_31j?), ("utf_8" if node.utf_8?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["├── parts: (length: #{(parts = node.parts).length})\n", indent] if parts.any? parts[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [parts[-1], "#{indent}│ "] end commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_interpolated_string_node(node) ⇒ Object
Inspect a InterpolatedStringNode node.
1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 |
# File 'lib/prism/inspect_visitor.rb', line 1401 def visit_interpolated_string_node(node) commands << [inspect_node("InterpolatedStringNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("frozen" if node.frozen?), ("mutable" if node.mutable?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["├── parts: (length: #{(parts = node.parts).length})\n", indent] if parts.any? parts[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [parts[-1], "#{indent}│ "] end commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_interpolated_symbol_node(node) ⇒ Object
Inspect a InterpolatedSymbolNode node.
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 |
# File 'lib/prism/inspect_visitor.rb', line 1419 def visit_interpolated_symbol_node(node) commands << [inspect_node("InterpolatedSymbolNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["├── parts: (length: #{(parts = node.parts).length})\n", indent] if parts.any? parts[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [parts[-1], "#{indent}│ "] end commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_interpolated_x_string_node(node) ⇒ Object
Inspect a InterpolatedXStringNode node.
1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 |
# File 'lib/prism/inspect_visitor.rb', line 1437 def visit_interpolated_x_string_node(node) commands << [inspect_node("InterpolatedXStringNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["├── parts: (length: #{(parts = node.parts).length})\n", indent] if parts.any? parts[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [parts[-1], "#{indent}│ "] end commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_it_local_variable_read_node(node) ⇒ Object
Inspect a ItLocalVariableReadNode node.
1455 1456 1457 1458 1459 |
# File 'lib/prism/inspect_visitor.rb', line 1455 def visit_it_local_variable_read_node(node) commands << [inspect_node("ItLocalVariableReadNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] end |
#visit_it_parameters_node(node) ⇒ Object
Inspect a ItParametersNode node.
1462 1463 1464 1465 1466 |
# File 'lib/prism/inspect_visitor.rb', line 1462 def visit_it_parameters_node(node) commands << [inspect_node("ItParametersNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] end |
#visit_keyword_hash_node(node) ⇒ Object
Inspect a KeywordHashNode node.
1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 |
# File 'lib/prism/inspect_visitor.rb', line 1469 def visit_keyword_hash_node(node) commands << [inspect_node("KeywordHashNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("symbol_keys" if node.symbol_keys?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── elements: (length: #{(elements = node.elements).length})\n", indent] if elements.any? elements[0...-1].each do |child| commands << [Replace.new("#{indent} ├── "), indent] commands << [child, "#{indent} │ "] end commands << [Replace.new("#{indent} └── "), indent] commands << [elements[-1], "#{indent} "] end end |
#visit_keyword_rest_parameter_node(node) ⇒ Object
Inspect a KeywordRestParameterNode node.
1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 |
# File 'lib/prism/inspect_visitor.rb', line 1485 def visit_keyword_rest_parameter_node(node) commands << [inspect_node("KeywordRestParameterNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (name = node.name).nil? commands << ["├── name: ∅\n", indent] else commands << ["├── name: #{name.inspect}\n", indent] end commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_lambda_node(node) ⇒ Object
Inspect a LambdaNode node.
1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 |
# File 'lib/prism/inspect_visitor.rb', line 1499 def visit_lambda_node(node) commands << [inspect_node("LambdaNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── locals: #{node.locals.inspect}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] if (parameters = node.parameters).nil? commands << ["├── parameters: ∅\n", indent] else commands << ["├── parameters:\n", indent] commands << [parameters, "#{indent}│ "] end if (body = node.body).nil? commands << ["└── body: ∅\n", indent] else commands << ["└── body:\n", indent] commands << [body, "#{indent} "] end end |
#visit_local_variable_and_write_node(node) ⇒ Object
Inspect a LocalVariableAndWriteNode node.
1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 |
# File 'lib/prism/inspect_visitor.rb', line 1522 def visit_local_variable_and_write_node(node) commands << [inspect_node("LocalVariableAndWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["└── depth: #{node.depth.inspect}\n", indent] end |
#visit_local_variable_operator_write_node(node) ⇒ Object
Inspect a LocalVariableOperatorWriteNode node.
1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 |
# File 'lib/prism/inspect_visitor.rb', line 1535 def visit_local_variable_operator_write_node(node) commands << [inspect_node("LocalVariableOperatorWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── binary_operator: #{node.binary_operator.inspect}\n", indent] commands << ["└── depth: #{node.depth.inspect}\n", indent] end |
#visit_local_variable_or_write_node(node) ⇒ Object
Inspect a LocalVariableOrWriteNode node.
1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 |
# File 'lib/prism/inspect_visitor.rb', line 1549 def visit_local_variable_or_write_node(node) commands << [inspect_node("LocalVariableOrWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["└── depth: #{node.depth.inspect}\n", indent] end |
#visit_local_variable_read_node(node) ⇒ Object
Inspect a LocalVariableReadNode node.
1562 1563 1564 1565 1566 1567 1568 |
# File 'lib/prism/inspect_visitor.rb', line 1562 def visit_local_variable_read_node(node) commands << [inspect_node("LocalVariableReadNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["└── depth: #{node.depth.inspect}\n", indent] end |
#visit_local_variable_target_node(node) ⇒ Object
Inspect a LocalVariableTargetNode node.
1571 1572 1573 1574 1575 1576 1577 |
# File 'lib/prism/inspect_visitor.rb', line 1571 def visit_local_variable_target_node(node) commands << [inspect_node("LocalVariableTargetNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["└── depth: #{node.depth.inspect}\n", indent] end |
#visit_local_variable_write_node(node) ⇒ Object
Inspect a LocalVariableWriteNode node.
1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 |
# File 'lib/prism/inspect_visitor.rb', line 1580 def visit_local_variable_write_node(node) commands << [inspect_node("LocalVariableWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── depth: #{node.depth.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_match_last_line_node(node) ⇒ Object
Inspect a MatchLastLineNode node.
1593 1594 1595 1596 1597 1598 1599 1600 1601 |
# File 'lib/prism/inspect_visitor.rb', line 1593 def visit_match_last_line_node(node) commands << [inspect_node("MatchLastLineNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("ignore_case" if node.ignore_case?), ("extended" if node.extended?), ("multi_line" if node.multi_line?), ("once" if node.once?), ("euc_jp" if node.euc_jp?), ("ascii_8bit" if node.ascii_8bit?), ("windows_31j" if node.windows_31j?), ("utf_8" if node.utf_8?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["├── content_loc: #{inspect_location(node.content_loc)}\n", indent] commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] commands << ["└── unescaped: #{node.unescaped.inspect}\n", indent] end |
#visit_match_predicate_node(node) ⇒ Object
Inspect a MatchPredicateNode node.
1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 |
# File 'lib/prism/inspect_visitor.rb', line 1604 def visit_match_predicate_node(node) commands << [inspect_node("MatchPredicateNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["├── pattern:\n", indent] commands << [node.pattern, "#{indent}│ "] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_match_required_node(node) ⇒ Object
Inspect a MatchRequiredNode node.
1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 |
# File 'lib/prism/inspect_visitor.rb', line 1616 def visit_match_required_node(node) commands << [inspect_node("MatchRequiredNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── value:\n", indent] commands << [node.value, "#{indent}│ "] commands << ["├── pattern:\n", indent] commands << [node.pattern, "#{indent}│ "] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_match_write_node(node) ⇒ Object
Inspect a MatchWriteNode node.
1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 |
# File 'lib/prism/inspect_visitor.rb', line 1628 def visit_match_write_node(node) commands << [inspect_node("MatchWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── call:\n", indent] commands << [node.call, "#{indent}│ "] commands << ["└── targets: (length: #{(targets = node.targets).length})\n", indent] if targets.any? targets[0...-1].each do |child| commands << [Replace.new("#{indent} ├── "), indent] commands << [child, "#{indent} │ "] end commands << [Replace.new("#{indent} └── "), indent] commands << [targets[-1], "#{indent} "] end end |
#visit_missing_node(node) ⇒ Object
Inspect a MissingNode node.
1646 1647 1648 1649 1650 |
# File 'lib/prism/inspect_visitor.rb', line 1646 def visit_missing_node(node) commands << [inspect_node("MissingNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] end |
#visit_module_node(node) ⇒ Object
Inspect a ModuleNode node.
1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 |
# File 'lib/prism/inspect_visitor.rb', line 1653 def visit_module_node(node) commands << [inspect_node("ModuleNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── locals: #{node.locals.inspect}\n", indent] commands << ["├── module_keyword_loc: #{inspect_location(node.module_keyword_loc)}\n", indent] commands << ["├── constant_path:\n", indent] commands << [node.constant_path, "#{indent}│ "] if (body = node.body).nil? commands << ["├── body: ∅\n", indent] else commands << ["├── body:\n", indent] commands << [body, "#{indent}│ "] end commands << ["├── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent] commands << ["└── name: #{node.name.inspect}\n", indent] end |
#visit_multi_target_node(node) ⇒ Object
Inspect a MultiTargetNode node.
1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 |
# File 'lib/prism/inspect_visitor.rb', line 1672 def visit_multi_target_node(node) commands << [inspect_node("MultiTargetNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── lefts: (length: #{(lefts = node.lefts).length})\n", indent] if lefts.any? lefts[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [lefts[-1], "#{indent}│ "] end if (rest = node.rest).nil? commands << ["├── rest: ∅\n", indent] else commands << ["├── rest:\n", indent] commands << [rest, "#{indent}│ "] end commands << ["├── rights: (length: #{(rights = node.rights).length})\n", indent] if rights.any? rights[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [rights[-1], "#{indent}│ "] end commands << ["├── lparen_loc: #{inspect_location(node.lparen_loc)}\n", indent] commands << ["└── rparen_loc: #{inspect_location(node.rparen_loc)}\n", indent] end |
#visit_multi_write_node(node) ⇒ Object
Inspect a MultiWriteNode node.
1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 |
# File 'lib/prism/inspect_visitor.rb', line 1705 def visit_multi_write_node(node) commands << [inspect_node("MultiWriteNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── lefts: (length: #{(lefts = node.lefts).length})\n", indent] if lefts.any? lefts[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [lefts[-1], "#{indent}│ "] end if (rest = node.rest).nil? commands << ["├── rest: ∅\n", indent] else commands << ["├── rest:\n", indent] commands << [rest, "#{indent}│ "] end commands << ["├── rights: (length: #{(rights = node.rights).length})\n", indent] if rights.any? rights[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [rights[-1], "#{indent}│ "] end commands << ["├── lparen_loc: #{inspect_location(node.lparen_loc)}\n", indent] commands << ["├── rparen_loc: #{inspect_location(node.rparen_loc)}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_next_node(node) ⇒ Object
Inspect a NextNode node.
1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 |
# File 'lib/prism/inspect_visitor.rb', line 1741 def visit_next_node(node) commands << [inspect_node("NextNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (arguments = node.arguments).nil? commands << ["├── arguments: ∅\n", indent] else commands << ["├── arguments:\n", indent] commands << [arguments, "#{indent}│ "] end commands << ["└── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] end |
#visit_nil_node(node) ⇒ Object
Inspect a NilNode node.
1755 1756 1757 1758 1759 |
# File 'lib/prism/inspect_visitor.rb', line 1755 def visit_nil_node(node) commands << [inspect_node("NilNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] end |
#visit_no_keywords_parameter_node(node) ⇒ Object
Inspect a NoKeywordsParameterNode node.
1762 1763 1764 1765 1766 1767 1768 |
# File 'lib/prism/inspect_visitor.rb', line 1762 def visit_no_keywords_parameter_node(node) commands << [inspect_node("NoKeywordsParameterNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] end |
#visit_numbered_parameters_node(node) ⇒ Object
Inspect a NumberedParametersNode node.
1771 1772 1773 1774 1775 1776 |
# File 'lib/prism/inspect_visitor.rb', line 1771 def visit_numbered_parameters_node(node) commands << [inspect_node("NumberedParametersNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── maximum: #{node.maximum.inspect}\n", indent] end |
#visit_numbered_reference_read_node(node) ⇒ Object
Inspect a NumberedReferenceReadNode node.
1779 1780 1781 1782 1783 1784 |
# File 'lib/prism/inspect_visitor.rb', line 1779 def visit_numbered_reference_read_node(node) commands << [inspect_node("NumberedReferenceReadNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── number: #{node.number.inspect}\n", indent] end |
#visit_optional_keyword_parameter_node(node) ⇒ Object
Inspect a OptionalKeywordParameterNode node.
1787 1788 1789 1790 1791 1792 1793 1794 1795 |
# File 'lib/prism/inspect_visitor.rb', line 1787 def visit_optional_keyword_parameter_node(node) commands << [inspect_node("OptionalKeywordParameterNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_optional_parameter_node(node) ⇒ Object
Inspect a OptionalParameterNode node.
1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 |
# File 'lib/prism/inspect_visitor.rb', line 1798 def visit_optional_parameter_node(node) commands << [inspect_node("OptionalParameterNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["└── value:\n", indent] commands << [node.value, "#{indent} "] end |
#visit_or_node(node) ⇒ Object
Inspect a OrNode node.
1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 |
# File 'lib/prism/inspect_visitor.rb', line 1810 def visit_or_node(node) commands << [inspect_node("OrNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── left:\n", indent] commands << [node.left, "#{indent}│ "] commands << ["├── right:\n", indent] commands << [node.right, "#{indent}│ "] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_parameters_node(node) ⇒ Object
Inspect a ParametersNode node.
1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 |
# File 'lib/prism/inspect_visitor.rb', line 1822 def visit_parameters_node(node) commands << [inspect_node("ParametersNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── requireds: (length: #{(requireds = node.requireds).length})\n", indent] if requireds.any? requireds[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [requireds[-1], "#{indent}│ "] end commands << ["├── optionals: (length: #{(optionals = node.optionals).length})\n", indent] if optionals.any? optionals[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [optionals[-1], "#{indent}│ "] end if (rest = node.rest).nil? commands << ["├── rest: ∅\n", indent] else commands << ["├── rest:\n", indent] commands << [rest, "#{indent}│ "] end commands << ["├── posts: (length: #{(posts = node.posts).length})\n", indent] if posts.any? posts[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [posts[-1], "#{indent}│ "] end commands << ["├── keywords: (length: #{(keywords = node.keywords).length})\n", indent] if keywords.any? keywords[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [keywords[-1], "#{indent}│ "] end if (keyword_rest = node.keyword_rest).nil? commands << ["├── keyword_rest: ∅\n", indent] else commands << ["├── keyword_rest:\n", indent] commands << [keyword_rest, "#{indent}│ "] end if (block = node.block).nil? commands << ["└── block: ∅\n", indent] else commands << ["└── block:\n", indent] commands << [block, "#{indent} "] end end |
#visit_parentheses_node(node) ⇒ Object
Inspect a ParenthesesNode node.
1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 |
# File 'lib/prism/inspect_visitor.rb', line 1883 def visit_parentheses_node(node) commands << [inspect_node("ParenthesesNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("multiple_statements" if node.multiple_statements?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (body = node.body).nil? commands << ["├── body: ∅\n", indent] else commands << ["├── body:\n", indent] commands << [body, "#{indent}│ "] end commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_pinned_expression_node(node) ⇒ Object
Inspect a PinnedExpressionNode node.
1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 |
# File 'lib/prism/inspect_visitor.rb', line 1898 def visit_pinned_expression_node(node) commands << [inspect_node("PinnedExpressionNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── expression:\n", indent] commands << [node.expression, "#{indent}│ "] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["├── lparen_loc: #{inspect_location(node.lparen_loc)}\n", indent] commands << ["└── rparen_loc: #{inspect_location(node.rparen_loc)}\n", indent] end |
#visit_pinned_variable_node(node) ⇒ Object
Inspect a PinnedVariableNode node.
1910 1911 1912 1913 1914 1915 1916 1917 |
# File 'lib/prism/inspect_visitor.rb', line 1910 def visit_pinned_variable_node(node) commands << [inspect_node("PinnedVariableNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── variable:\n", indent] commands << [node.variable, "#{indent}│ "] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_post_execution_node(node) ⇒ Object
Inspect a PostExecutionNode node.
1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 |
# File 'lib/prism/inspect_visitor.rb', line 1920 def visit_post_execution_node(node) commands << [inspect_node("PostExecutionNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (statements = node.statements).nil? commands << ["├── statements: ∅\n", indent] else commands << ["├── statements:\n", indent] commands << [statements, "#{indent}│ "] end commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_pre_execution_node(node) ⇒ Object
Inspect a PreExecutionNode node.
1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 |
# File 'lib/prism/inspect_visitor.rb', line 1936 def visit_pre_execution_node(node) commands << [inspect_node("PreExecutionNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (statements = node.statements).nil? commands << ["├── statements: ∅\n", indent] else commands << ["├── statements:\n", indent] commands << [statements, "#{indent}│ "] end commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] end |
#visit_program_node(node) ⇒ Object
Inspect a ProgramNode node.
1952 1953 1954 1955 1956 1957 1958 1959 |
# File 'lib/prism/inspect_visitor.rb', line 1952 def visit_program_node(node) commands << [inspect_node("ProgramNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── locals: #{node.locals.inspect}\n", indent] commands << ["└── statements:\n", indent] commands << [node.statements, "#{indent} "] end |
#visit_range_node(node) ⇒ Object
Inspect a RangeNode node.
1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 |
# File 'lib/prism/inspect_visitor.rb', line 1962 def visit_range_node(node) commands << [inspect_node("RangeNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("exclude_end" if node.exclude_end?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (left = node.left).nil? commands << ["├── left: ∅\n", indent] else commands << ["├── left:\n", indent] commands << [left, "#{indent}│ "] end if (right = node.right).nil? commands << ["├── right: ∅\n", indent] else commands << ["├── right:\n", indent] commands << [right, "#{indent}│ "] end commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_rational_node(node) ⇒ Object
Inspect a RationalNode node.
1982 1983 1984 1985 1986 1987 1988 |
# File 'lib/prism/inspect_visitor.rb', line 1982 def visit_rational_node(node) commands << [inspect_node("RationalNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("binary" if node.binary?), ("decimal" if node.decimal?), ("octal" if node.octal?), ("hexadecimal" if node.hexadecimal?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── numerator: #{node.numerator.inspect}\n", indent] commands << ["└── denominator: #{node.denominator.inspect}\n", indent] end |
#visit_redo_node(node) ⇒ Object
Inspect a RedoNode node.
1991 1992 1993 1994 1995 |
# File 'lib/prism/inspect_visitor.rb', line 1991 def visit_redo_node(node) commands << [inspect_node("RedoNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] end |
#visit_regular_expression_node(node) ⇒ Object
Inspect a RegularExpressionNode node.
1998 1999 2000 2001 2002 2003 2004 2005 2006 |
# File 'lib/prism/inspect_visitor.rb', line 1998 def visit_regular_expression_node(node) commands << [inspect_node("RegularExpressionNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("ignore_case" if node.ignore_case?), ("extended" if node.extended?), ("multi_line" if node.multi_line?), ("once" if node.once?), ("euc_jp" if node.euc_jp?), ("ascii_8bit" if node.ascii_8bit?), ("windows_31j" if node.windows_31j?), ("utf_8" if node.utf_8?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["├── content_loc: #{inspect_location(node.content_loc)}\n", indent] commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] commands << ["└── unescaped: #{node.unescaped.inspect}\n", indent] end |
#visit_required_keyword_parameter_node(node) ⇒ Object
Inspect a RequiredKeywordParameterNode node.
2009 2010 2011 2012 2013 2014 2015 |
# File 'lib/prism/inspect_visitor.rb', line 2009 def visit_required_keyword_parameter_node(node) commands << [inspect_node("RequiredKeywordParameterNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── name: #{node.name.inspect}\n", indent] commands << ["└── name_loc: #{inspect_location(node.name_loc)}\n", indent] end |
#visit_required_parameter_node(node) ⇒ Object
Inspect a RequiredParameterNode node.
2018 2019 2020 2021 2022 2023 |
# File 'lib/prism/inspect_visitor.rb', line 2018 def visit_required_parameter_node(node) commands << [inspect_node("RequiredParameterNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── name: #{node.name.inspect}\n", indent] end |
#visit_rescue_modifier_node(node) ⇒ Object
Inspect a RescueModifierNode node.
2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 |
# File 'lib/prism/inspect_visitor.rb', line 2026 def visit_rescue_modifier_node(node) commands << [inspect_node("RescueModifierNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── expression:\n", indent] commands << [node.expression, "#{indent}│ "] commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] commands << ["└── rescue_expression:\n", indent] commands << [node.rescue_expression, "#{indent} "] end |
#visit_rescue_node(node) ⇒ Object
Inspect a RescueNode node.
2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 |
# File 'lib/prism/inspect_visitor.rb', line 2038 def visit_rescue_node(node) commands << [inspect_node("RescueNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] commands << ["├── exceptions: (length: #{(exceptions = node.exceptions).length})\n", indent] if exceptions.any? exceptions[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [exceptions[-1], "#{indent}│ "] end commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] if (reference = node.reference).nil? commands << ["├── reference: ∅\n", indent] else commands << ["├── reference:\n", indent] commands << [reference, "#{indent}│ "] end commands << ["├── then_keyword_loc: #{inspect_location(node.then_keyword_loc)}\n", indent] if (statements = node.statements).nil? commands << ["├── statements: ∅\n", indent] else commands << ["├── statements:\n", indent] commands << [statements, "#{indent}│ "] end if (subsequent = node.subsequent).nil? commands << ["└── subsequent: ∅\n", indent] else commands << ["└── subsequent:\n", indent] commands << [subsequent, "#{indent} "] end end |
#visit_rest_parameter_node(node) ⇒ Object
Inspect a RestParameterNode node.
2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 |
# File 'lib/prism/inspect_visitor.rb', line 2075 def visit_rest_parameter_node(node) commands << [inspect_node("RestParameterNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] if (name = node.name).nil? commands << ["├── name: ∅\n", indent] else commands << ["├── name: #{name.inspect}\n", indent] end commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent] commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] end |
#visit_retry_node(node) ⇒ Object
Inspect a RetryNode node.
2089 2090 2091 2092 2093 |
# File 'lib/prism/inspect_visitor.rb', line 2089 def visit_retry_node(node) commands << [inspect_node("RetryNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] end |
#visit_return_node(node) ⇒ Object
Inspect a ReturnNode node.
2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 |
# File 'lib/prism/inspect_visitor.rb', line 2096 def visit_return_node(node) commands << [inspect_node("ReturnNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] if (arguments = node.arguments).nil? commands << ["└── arguments: ∅\n", indent] else commands << ["└── arguments:\n", indent] commands << [arguments, "#{indent} "] end end |
#visit_self_node(node) ⇒ Object
Inspect a SelfNode node.
2110 2111 2112 2113 2114 |
# File 'lib/prism/inspect_visitor.rb', line 2110 def visit_self_node(node) commands << [inspect_node("SelfNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] end |
#visit_shareable_constant_node(node) ⇒ Object
Inspect a ShareableConstantNode node.
2117 2118 2119 2120 2121 2122 2123 |
# File 'lib/prism/inspect_visitor.rb', line 2117 def visit_shareable_constant_node(node) commands << [inspect_node("ShareableConstantNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("literal" if node.literal?), ("experimental_everything" if node.experimental_everything?), ("experimental_copy" if node.experimental_copy?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── write:\n", indent] commands << [node.write, "#{indent} "] end |
#visit_singleton_class_node(node) ⇒ Object
Inspect a SingletonClassNode node.
2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 |
# File 'lib/prism/inspect_visitor.rb', line 2126 def visit_singleton_class_node(node) commands << [inspect_node("SingletonClassNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── locals: #{node.locals.inspect}\n", indent] commands << ["├── class_keyword_loc: #{inspect_location(node.class_keyword_loc)}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] commands << ["├── expression:\n", indent] commands << [node.expression, "#{indent}│ "] if (body = node.body).nil? commands << ["├── body: ∅\n", indent] else commands << ["├── body:\n", indent] commands << [body, "#{indent}│ "] end commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent] end |
#visit_source_encoding_node(node) ⇒ Object
Inspect a SourceEncodingNode node.
2145 2146 2147 2148 2149 |
# File 'lib/prism/inspect_visitor.rb', line 2145 def visit_source_encoding_node(node) commands << [inspect_node("SourceEncodingNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] end |
#visit_source_file_node(node) ⇒ Object
Inspect a SourceFileNode node.
2152 2153 2154 2155 2156 2157 |
# File 'lib/prism/inspect_visitor.rb', line 2152 def visit_source_file_node(node) commands << [inspect_node("SourceFileNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("frozen" if node.frozen?), ("mutable" if node.mutable?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── filepath: #{node.filepath.inspect}\n", indent] end |
#visit_source_line_node(node) ⇒ Object
Inspect a SourceLineNode node.
2160 2161 2162 2163 2164 |
# File 'lib/prism/inspect_visitor.rb', line 2160 def visit_source_line_node(node) commands << [inspect_node("SourceLineNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] end |
#visit_splat_node(node) ⇒ Object
Inspect a SplatNode node.
2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 |
# File 'lib/prism/inspect_visitor.rb', line 2167 def visit_splat_node(node) commands << [inspect_node("SplatNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent] if (expression = node.expression).nil? commands << ["└── expression: ∅\n", indent] else commands << ["└── expression:\n", indent] commands << [expression, "#{indent} "] end end |
#visit_statements_node(node) ⇒ Object
Inspect a StatementsNode node.
2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 |
# File 'lib/prism/inspect_visitor.rb', line 2181 def visit_statements_node(node) commands << [inspect_node("StatementsNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["└── body: (length: #{(body = node.body).length})\n", indent] if body.any? body[0...-1].each do |child| commands << [Replace.new("#{indent} ├── "), indent] commands << [child, "#{indent} │ "] end commands << [Replace.new("#{indent} └── "), indent] commands << [body[-1], "#{indent} "] end end |
#visit_string_node(node) ⇒ Object
Inspect a StringNode node.
2197 2198 2199 2200 2201 2202 2203 2204 2205 |
# File 'lib/prism/inspect_visitor.rb', line 2197 def visit_string_node(node) commands << [inspect_node("StringNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("frozen" if node.frozen?), ("mutable" if node.mutable?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["├── content_loc: #{inspect_location(node.content_loc)}\n", indent] commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] commands << ["└── unescaped: #{node.unescaped.inspect}\n", indent] end |
#visit_super_node(node) ⇒ Object
Inspect a SuperNode node.
2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 |
# File 'lib/prism/inspect_visitor.rb', line 2208 def visit_super_node(node) commands << [inspect_node("SuperNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] commands << ["├── lparen_loc: #{inspect_location(node.lparen_loc)}\n", indent] if (arguments = node.arguments).nil? commands << ["├── arguments: ∅\n", indent] else commands << ["├── arguments:\n", indent] commands << [arguments, "#{indent}│ "] end commands << ["├── rparen_loc: #{inspect_location(node.rparen_loc)}\n", indent] if (block = node.block).nil? commands << ["└── block: ∅\n", indent] else commands << ["└── block:\n", indent] commands << [block, "#{indent} "] end end |
#visit_symbol_node(node) ⇒ Object
Inspect a SymbolNode node.
2230 2231 2232 2233 2234 2235 2236 2237 2238 |
# File 'lib/prism/inspect_visitor.rb', line 2230 def visit_symbol_node(node) commands << [inspect_node("SymbolNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["├── value_loc: #{inspect_location(node.value_loc)}\n", indent] commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] commands << ["└── unescaped: #{node.unescaped.inspect}\n", indent] end |
#visit_true_node(node) ⇒ Object
Inspect a TrueNode node.
2241 2242 2243 2244 2245 |
# File 'lib/prism/inspect_visitor.rb', line 2241 def visit_true_node(node) commands << [inspect_node("TrueNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] end |
#visit_undef_node(node) ⇒ Object
Inspect a UndefNode node.
2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 |
# File 'lib/prism/inspect_visitor.rb', line 2248 def visit_undef_node(node) commands << [inspect_node("UndefNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── names: (length: #{(names = node.names).length})\n", indent] if names.any? names[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [names[-1], "#{indent}│ "] end commands << ["└── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] end |
#visit_unless_node(node) ⇒ Object
Inspect a UnlessNode node.
2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 |
# File 'lib/prism/inspect_visitor.rb', line 2265 def visit_unless_node(node) commands << [inspect_node("UnlessNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] commands << ["├── predicate:\n", indent] commands << [node.predicate, "#{indent}│ "] commands << ["├── then_keyword_loc: #{inspect_location(node.then_keyword_loc)}\n", indent] if (statements = node.statements).nil? commands << ["├── statements: ∅\n", indent] else commands << ["├── statements:\n", indent] commands << [statements, "#{indent}│ "] end if (else_clause = node.else_clause).nil? commands << ["├── else_clause: ∅\n", indent] else commands << ["├── else_clause:\n", indent] commands << [else_clause, "#{indent}│ "] end commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent] end |
#visit_until_node(node) ⇒ Object
Inspect a UntilNode node.
2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 |
# File 'lib/prism/inspect_visitor.rb', line 2289 def visit_until_node(node) commands << [inspect_node("UntilNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("begin_modifier" if node.begin_modifier?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] commands << ["├── do_keyword_loc: #{inspect_location(node.do_keyword_loc)}\n", indent] commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] commands << ["├── predicate:\n", indent] commands << [node.predicate, "#{indent}│ "] if (statements = node.statements).nil? commands << ["└── statements: ∅\n", indent] else commands << ["└── statements:\n", indent] commands << [statements, "#{indent} "] end end |
#visit_when_node(node) ⇒ Object
Inspect a WhenNode node.
2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 |
# File 'lib/prism/inspect_visitor.rb', line 2307 def visit_when_node(node) commands << [inspect_node("WhenNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] commands << ["├── conditions: (length: #{(conditions = node.conditions).length})\n", indent] if conditions.any? conditions[0...-1].each do |child| commands << [Replace.new("#{indent}│ ├── "), indent] commands << [child, "#{indent}│ │ "] end commands << [Replace.new("#{indent}│ └── "), indent] commands << [conditions[-1], "#{indent}│ "] end commands << ["├── then_keyword_loc: #{inspect_location(node.then_keyword_loc)}\n", indent] if (statements = node.statements).nil? commands << ["└── statements: ∅\n", indent] else commands << ["└── statements:\n", indent] commands << [statements, "#{indent} "] end end |
#visit_while_node(node) ⇒ Object
Inspect a WhileNode node.
2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 |
# File 'lib/prism/inspect_visitor.rb', line 2331 def visit_while_node(node) commands << [inspect_node("WhileNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("begin_modifier" if node.begin_modifier?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] commands << ["├── do_keyword_loc: #{inspect_location(node.do_keyword_loc)}\n", indent] commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] commands << ["├── predicate:\n", indent] commands << [node.predicate, "#{indent}│ "] if (statements = node.statements).nil? commands << ["└── statements: ∅\n", indent] else commands << ["└── statements:\n", indent] commands << [statements, "#{indent} "] end end |
#visit_x_string_node(node) ⇒ Object
Inspect a XStringNode node.
2349 2350 2351 2352 2353 2354 2355 2356 2357 |
# File 'lib/prism/inspect_visitor.rb', line 2349 def visit_x_string_node(node) commands << [inspect_node("XStringNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?)].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent] commands << ["├── content_loc: #{inspect_location(node.content_loc)}\n", indent] commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent] commands << ["└── unescaped: #{node.unescaped.inspect}\n", indent] end |
#visit_yield_node(node) ⇒ Object
Inspect a YieldNode node.
2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 |
# File 'lib/prism/inspect_visitor.rb', line 2360 def visit_yield_node(node) commands << [inspect_node("YieldNode", node), indent] flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent] commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent] commands << ["├── lparen_loc: #{inspect_location(node.lparen_loc)}\n", indent] if (arguments = node.arguments).nil? commands << ["├── arguments: ∅\n", indent] else commands << ["├── arguments:\n", indent] commands << [arguments, "#{indent}│ "] end commands << ["└── rparen_loc: #{inspect_location(node.rparen_loc)}\n", indent] end |