Method: ANTLR3::Main::LexerMain#recognize

Defined in:
lib/antlr3/main.rb

#recognize(in_stream) ⇒ Object



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/antlr3/main.rb', line 318

def recognize( in_stream )
  lexer = @lexer_class.new( in_stream )
  
  loop do
    begin
      token = lexer.next_token
      if token.nil? || token.type == ANTLR3::EOF then break
      else display_token( token )
      end
    rescue ANTLR3::RecognitionError => error
      report_error( error )
      break
    end
  end
end