Sha256: 0f1bfd9e396f78a0eb9fcbc3e279046f73915cbd70923531f8bfe761193dc24c

Contents?: true

Size: 450 Bytes

Versions: 6

Compression:

Stored size: 450 Bytes

Contents

module Minjs
  class ParseError < StandardError
    def initialize(error_message = nil, lex = nil)
      super(error_message)
      if lex
        @lex = lex
        @lex_pos = lex.pos
      end
    end

    def to_s
      t = ''
      t << super
      t << "\n"
      if @lex
        line, col = @lex.line_col(@lex_pos)
        t << "line: #{line}, col: #{col}\n"
        t << @lex.debug_str(@lex_pos, line, col)
      end
      t
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
minjs-0.2.2 lib/minjs/exceptions.rb
minjs-0.2.1 lib/minjs/exceptions.rb
minjs-0.2.0 lib/minjs/exceptions.rb
minjs-0.1.10 lib/minjs/exceptions.rb
minjs-0.1.7 lib/minjs/exceptions.rb
minjs-0.1.5 lib/minjs/exceptions.rb