Sha256: 3b6e741e0a15f594337a18624a8c9c8060f9e4cd447fb53313b746ac250a3141

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

module Hotcell
  class Error < StandardError
  end

  class ParseError < Error
    def initialize value, line, column
      @value, @line, @column = value, line, column
      super(compose_message)
    end
  end

  class UnexpectedSymbol < ParseError
    def compose_message
      "Unexpected symbol `#{@value}` at #{@line}:#{@column}"
    end
  end

  class UnterminatedString < ParseError
    def compose_message
      "Unterminated string `#{@value}` starting at #{@line}:#{@column}"
    end
  end

  # class UnterminatedRegexp < ParseError
  #   def compose_message
  #     "Unterminated regexp `#{@value}` starting at #{@line}:#{@column}"
  #   end
  # end

  class SyntaxError < Error
    def initialize value, line, column
      @value, @line, @column = value, line, column
      super(compose_message)
    end

    def compose_message
      "#{@value} at #{@line}:#{@column}"
    end
  end

  class UnexpectedLexem < ParseError
    def compose_message
      "Unexpected #{@value} at #{@line}:#{@column}"
    end
  end

  class BlockError < SyntaxError
  end

  class ArgumentError < SyntaxError
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hotcell-0.3.0 lib/hotcell/errors.rb
hotcell-0.2.0 lib/hotcell/errors.rb
hotcell-0.1.0 lib/hotcell/errors.rb