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: ConstantNameVisitor, IndexVisitor

Instance Method Summary collapse

Instance Method Details

#index(source) ⇒ Object



659
660
661
# File 'lib/syntax_tree/index.rb', line 659

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

#index_file(filepath) ⇒ Object



663
664
665
# File 'lib/syntax_tree/index.rb', line 663

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