Sha256: 844e410700ff99dd8f1586dc2799f855c127c8d40f3b37f3116ba6853c988084

Contents?: true

Size: 445 Bytes

Versions: 1

Compression:

Stored size: 445 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
        row, col = @lex.row_col(@lex_pos)
        t << "row: #{row}, col: #{col}\n"
        t << @lex.debug_str(@lex_pos, row, col)
      end
      t
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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