Class: SyntaxTree::Index::ParserBackend

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree/index.rb

Overview

This backend creates the index using the Syntax Tree parser and a visitor. It is not as fast as using the instruction sequences directly, but is supported on all runtimes.

Defined Under Namespace

Classes: IndexVisitor

Instance Method Summary collapse

Instance Method Details

#index(source) ⇒ Object



449
450
451
# File 'lib/syntax_tree/index.rb', line 449

def index(source)
  SyntaxTree.parse(source).accept(IndexVisitor.new)
end

#index_file(filepath) ⇒ Object



453
454
455
# File 'lib/syntax_tree/index.rb', line 453

def index_file(filepath)
  index(SyntaxTree.read(filepath))
end