Class: Parser::Runner::RubyParse

Inherits:
Parser::Runner show all
Defined in:
lib/parser/runner/ruby_parse.rb

Defined Under Namespace

Classes: LocationProcessor

Instance Method Summary collapse

Methods inherited from Parser::Runner

#execute, go, #initialize, #input_size, #parse_options, #prepare_parser, #process_buffer, #process_files, #process_fragments, #report_with_time

Constructor Details

This class inherits a constructor from Parser::Runner

Instance Method Details

#process(buffer) ⇒ Object (private)



122
123
124
125
126
127
128
129
130
# File 'lib/parser/runner/ruby_parse.rb', line 122

def process(buffer)
  ast = @parser.parse(buffer)

  if @slop.locate?
    LocationProcessor.new.process(ast)
  elsif !@slop.benchmark?
    p ast
  end
end

#process_all_inputObject (private)



114
115
116
117
118
119
120
# File 'lib/parser/runner/ruby_parse.rb', line 114

def process_all_input
  super

  if input_size > 1
    puts "Using #{@parser_class} to parse #{input_size} files."
  end
end

#runner_nameObject (private)



98
99
100
# File 'lib/parser/runner/ruby_parse.rb', line 98

def runner_name
  'ruby-parse'
end

#setup_option_parsingObject (private)



102
103
104
105
106
107
108
109
110
111
112
# File 'lib/parser/runner/ruby_parse.rb', line 102

def setup_option_parsing
  super

  @slop.on 'L', 'locate',  'Explain how source maps for AST nodes are laid out'

  @slop.on 'E', 'explain', 'Explain how the source is tokenized' do
    ENV['RACC_DEBUG'] = '1'

    Lexer.send :include, Lexer::Explanation
  end
end