Sha256: 57613d1fd28439327541329d6d67fb7ad950d9a25d7ab73dc5eb096143600cfd

Contents?: true

Size: 439 Bytes

Versions: 1

Compression:

Stored size: 439 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)
      end
      t
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
minjs-0.1.3 lib/minjs/exceptions.rb