Class: SyntaxTree::CLI::Doc

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

Overview

An action of the CLI that prints out the doc tree IR for the given source.

Instance Method Summary collapse

Methods inherited from Action

#failure, #success

Instance Method Details

#run(filepath, source) ⇒ Object



101
102
103
104
105
# File 'lib/syntax_tree/cli.rb', line 101

def run(filepath, source)
  formatter = Formatter.new([])
  SyntaxTree.parse(source).format(formatter)
  pp formatter.groups.first
end