Sha256: 087e96a67cb974e9a58319d1160f592e4d676d3ab0875bb0de333d5b594ca450

Contents?: true

Size: 481 Bytes

Versions: 3

Compression:

Stored size: 481 Bytes

Contents

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

    # to string
    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

3 entries across 3 versions & 1 rubygems

Version Path
minjs-0.4.2 lib/minjs/lex/exceptions.rb
minjs-0.4.1 lib/minjs/lex/exceptions.rb
minjs-0.4.0 lib/minjs/lex/exceptions.rb