Method: ANTLR3::Main::Main#execute

Defined in:
lib/antlr3/main.rb

#execute(argv = ARGV) ⇒ Object

runs the script



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/antlr3/main.rb', line 135

def execute( argv = ARGV )
  args = parse_options( argv )
  setup
  
  @interactive and return execute_interactive
  
  in_stream = 
    case
    when @input.is_a?( ::String ) then StringStream.new( @input )
    when args.length == 1 && args.first != '-'
      ANTLR3::FileStream.new( args[ 0 ] )
    else ANTLR3::FileStream.new( @input )
    end
  if @ruby_prof
    load_ruby_prof
    profile = RubyProf.profile do
      recognize( in_stream )
    end
    printer = RubyProf::FlatPrinter.new( profile )
    printer.print( @output )
  else
    recognize( in_stream )
  end
end