Class: TreeHaver::Backends::Citrus::Tree Private

Inherits:
TreeHaver::Base::Tree show all
Defined in:
lib/tree_haver/backends/citrus.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Citrus tree wrapper

Wraps a Citrus::Match (which represents the parse tree) to provide
tree-sitter-compatible API.

Inherits from Base::Tree to get shared methods like #errors, #warnings,
#comments, #has_error?, and #inspect.

Instance Attribute Summary collapse

Attributes inherited from TreeHaver::Base::Tree

#inner_tree, #lines, #source

Instance Method Summary collapse

Methods inherited from TreeHaver::Base::Tree

#comments, #edit, #errors, #has_error?, #inspect, #warnings

Constructor Details

#initialize(root_match, source) ⇒ Tree

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Tree.



285
286
287
288
# File 'lib/tree_haver/backends/citrus.rb', line 285

def initialize(root_match, source)
  @root_match = root_match
  super(root_match, source: source)
end

Instance Attribute Details

#root_matchCitrus::Match (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The raw Citrus::Match root

Returns:

  • (Citrus::Match)

    The root match



283
284
285
# File 'lib/tree_haver/backends/citrus.rb', line 283

def root_match
  @root_match
end

Instance Method Details

#root_nodeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



290
291
292
# File 'lib/tree_haver/backends/citrus.rb', line 290

def root_node
  Node.new(@root_match, @source)
end