Sha256: 5b74e7be6996b95d565f40fd6b1fc13b24031eecb9b56b5456ee07b0c9a7e86d
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true module Basic101 class Error < StandardError ; end class ArraySizeError < Error ; end class ForNextSequenceError < Error ; end class ForWithoutNext < Error ; end class IndexError < Error ; end class InputError < Error ; end class InternalError < Error ; end class InvalidArgumentError < Error ; end class NextWithoutFor < Error ; end class NoMoreInputError < Error ; end class OutOfDataError < Error ; end class ReturnWithoutGosub < Error ; end class TypeError < Error ; end class UndefinedLineNumberError < Error ; end class BadInputFormatError < InputError ; end class TooFewInputItemsError < InputError ; end class DuplicateReferenceInForStack < InternalError ; end class SyntaxError < Error def initialize(line, line_number, column_number, parse_error) @line = line @line_number = line_number @column_number = column_number @parse_error = parse_error super(message) end def to_s out = StringIO.new out.puts @parse_error out.puts @line out.puts '%*s' % [(@column_number), '^'] out.string end private def message @parse_error end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
basic101-1.0.2 | lib/basic101/errors.rb |
basic101-1.0.1 | lib/basic101/errors.rb |
basic101-1.0.0 | lib/basic101/errors.rb |