lib/minjs/exceptions.rb in minjs-0.1.2 vs lib/minjs/exceptions.rb in minjs-0.1.3

- old
+ new

@@ -1,15 +1,23 @@ module Minjs class ParseError < StandardError def initialize(error_message = nil, lex = nil) super(error_message) - @lex = lex + if lex + @lex = lex + @lex_pos = lex.pos + end end def to_s t = '' t << super t << "\n" - t << @lex.debug_str if @lex + if @lex + line, col = @lex.line_col(@lex_pos) + t << "line: #{line}, col: #{col}\n" + t << @lex.debug_str(@lex_pos) + end + t end end end