Exception: Trenni::ParseError

Inherits:
Error
  • Object
show all
Defined in:
lib/trenni/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, buffer, offset) ⇒ ParseError

Returns a new instance of ParseError.



30
31
32
33
34
35
# File 'lib/trenni/error.rb', line 30

def initialize(message, buffer, offset)
	super(message)
	
	@buffer = buffer
	@offset = offset
end

Instance Attribute Details

#bufferObject (readonly)

Returns the value of attribute buffer.



41
42
43
# File 'lib/trenni/error.rb', line 41

def buffer
  @buffer
end

#pathObject (readonly)

Returns the value of attribute path.



42
43
44
# File 'lib/trenni/error.rb', line 42

def path
  @path
end

Instance Method Details

#locationObject



37
38
39
# File 'lib/trenni/error.rb', line 37

def location
	@location ||= Location.new(@buffer.read, @offset)
end

#to_sObject



44
45
46
# File 'lib/trenni/error.rb', line 44

def to_s
	"#{buffer.path}#{location}: #{super}\n#{location.line_text}"
end