class SyntaxTree::Node
This is the parent node of all of the syntax tree nodes. It’s pretty much exclusively here to make it easier to operate with the tree in cases where you’re trying to monkey-patch or strictly type.
Attributes
Location
-
the location of this node
Public Instance Methods
Source
# File lib/syntax_tree/node.rb, line 109 def accept(visitor) raise NotImplementedError end
Source
# File lib/syntax_tree/node.rb, line 113 def child_nodes raise NotImplementedError end
Source
# File lib/syntax_tree/node.rb, line 149 def construct_keys PrettierPrint.format(+"") { |q| accept(MatchVisitor.new(q)) } end
Source
# File lib/syntax_tree/node.rb, line 117 def deconstruct raise NotImplementedError end
Source
# File lib/syntax_tree/node.rb, line 121 def deconstruct_keys(keys) raise NotImplementedError end
Source
# File lib/syntax_tree/node.rb, line 125 def format(q) raise NotImplementedError end
Source
# File lib/syntax_tree/node.rb, line 137 def pretty_print(q) accept(PrettyPrintVisitor.new(q)) end
Source
# File lib/syntax_tree/node.rb, line 129 def start_char location.start_char end
Source
# File lib/syntax_tree/node.rb, line 141 def to_json(*opts) accept(JSONVisitor.new).to_json(*opts) end
Source
# File lib/syntax_tree/node.rb, line 145 def to_mermaid accept(MermaidVisitor.new) end