Method: Intar#run

Defined in:
lib/intar.rb

#runObject



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/intar.rb', line 115

def run
  handle_history do
    set_current do
      execute OLD_INIT
      r = nil
      loop do
        l = readline
        l or break
        @redir = find_redirect l
        begin
          if l.slice! /^\\(\w+|.)\s*(.*?)\s*$\n?/ then
            r = send (get_metacommand $1).method, (eval_param $2)
            l.empty? or @previous = l
          else
            begin
              r = eval_line l
            rescue SyntaxError
              raise if l.end_with? $/
              @previous = l
            end
          end
          next if @previous
          display r
        rescue Clear
          @previous = nil
          next
        rescue Bye
          raise if @depth.nonzero?
          break
        rescue Quit
          break
        rescue Exception
          raise if SystemExit === $! and not @params[ :catch_exit]
          r = $!
          show_exception
        end
        (execute OLD_SET).call r, @n
        @n += 1
      rescue
        switchcolor 33
        puts "Internal error."
        show_exception
      end
      r
    ensure
      execute OLD_INIT
    end
  end
end