Class: Squeezy::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/squeezy/reporter.rb

Instance Method Summary collapse

Instance Method Details

#do_message(type, message, source_name, line, line_source, line_offset) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/squeezy/reporter.rb', line 7

def do_message(type, message, source_name, line, line_source, line_offset)
  if (line < 0)
    $stderr.puts("\n[#{type.to_s.upcase}] #{message} --> #{line_source}")
  else
    $stderr.puts("\n[#{type.to_s.upcase}] #{line} #{line_offset} : #{message} --> #{line_source}")
  end
end

#error(message, source_name, live, line_source, line_offset) ⇒ Object



19
20
21
# File 'lib/squeezy/reporter.rb', line 19

def error(message, source_name, live, line_source, line_offset)
  do_message(:error, message, source_name, live, line_source, line_offset)
end

#runtimeError(message, source_name, line, line_source, line_offset) ⇒ Object



23
24
25
26
# File 'lib/squeezy/reporter.rb', line 23

def runtimeError(message, source_name, line, line_source, line_offset)
  error(message, source_name, line, line_source, line_offset)
  EvaluatorException.new(message)
end

#warning(message, source_name, live, line_source, line_offset) ⇒ Object



15
16
17
# File 'lib/squeezy/reporter.rb', line 15

def warning(message, source_name, live, line_source, line_offset)
  do_message(:warning, message, source_name, live, line_source, line_offset)
end