Method: ANTLR3::Main::ParserMain#recognize

Defined in:
lib/antlr3/main.rb

#recognize(in_stream) ⇒ Object



440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'lib/antlr3/main.rb', line 440

def recognize( in_stream )
  parser_options = {}
  if @debug
    if @trace
      parser_options[ :debug_listener ] = ANTLR3::Debug::RuleTracer.new
    else
      parser_options[ :port ] = @port
      parser_options[ :log ]  = @log
    end
  end
  lexer = @lexer_class.new( in_stream )
  # token_stream = CommonTokenStream.new( lexer )
  parser = @parser_class.new( lexer, parser_options )
  result = parser.send( @parser_rule ) and present( result )
  @profile and puts( parser.profile.generate_report )
end