6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/s2/display.rb', line 6
def self.error(filename, source, err)
line = source.split("\n")
STDERR.puts "#{filename}:#{err["_line"]}:#{err["_col"]} #{"error".colorize(:red)}: #{err["_error"]}"
STDERR.puts line[err["_line"] - 1]
STDERR.puts " " * (err["_col"] - 1) + "^".colorize(:green)
STDERR.puts " " * (err["_col"] - 1) + "#{err["_explain"]}" if err["_explain"]
if err["_type"] == "parser"
STDERR.puts ""
STDERR.puts "Please refer to https://davidsiaw.github.com/s2/syntax for correct syntax"
end
end
|