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[R]
Location
-
the location of this node
Public Instance Methods
accept(visitor)
click to toggle source
# File lib/syntax_tree/node.rb, line 109 def accept(visitor) raise NotImplementedError end
child_nodes()
click to toggle source
# File lib/syntax_tree/node.rb, line 113 def child_nodes raise NotImplementedError end
construct_keys()
click to toggle source
# File lib/syntax_tree/node.rb, line 149 def construct_keys PrettierPrint.format(+"") { |q| accept(MatchVisitor.new(q)) } end
deconstruct()
click to toggle source
# File lib/syntax_tree/node.rb, line 117 def deconstruct raise NotImplementedError end
deconstruct_keys(keys)
click to toggle source
# File lib/syntax_tree/node.rb, line 121 def deconstruct_keys(keys) raise NotImplementedError end
end_char()
click to toggle source
# File lib/syntax_tree/node.rb, line 133 def end_char location.end_char end
format(q)
click to toggle source
# File lib/syntax_tree/node.rb, line 125 def format(q) raise NotImplementedError end
pretty_print(q)
click to toggle source
# File lib/syntax_tree/node.rb, line 137 def pretty_print(q) accept(PrettyPrintVisitor.new(q)) end
start_char()
click to toggle source
# File lib/syntax_tree/node.rb, line 129 def start_char location.start_char end
to_json(*opts)
click to toggle source
# File lib/syntax_tree/node.rb, line 141 def to_json(*opts) accept(JSONVisitor.new).to_json(*opts) end
to_mermaid()
click to toggle source
# File lib/syntax_tree/node.rb, line 145 def to_mermaid accept(MermaidVisitor.new) end