Exception: Trenni::ParseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/trenni/parse_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, buffer, offset) ⇒ ParseError

Returns a new instance of ParseError.



25
26
27
28
29
30
# File 'lib/trenni/parse_error.rb', line 25

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

Instance Attribute Details

#bufferObject (readonly)

Returns the value of attribute buffer.



36
37
38
# File 'lib/trenni/parse_error.rb', line 36

def buffer
  @buffer
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#locationObject



32
33
34
# File 'lib/trenni/parse_error.rb', line 32

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

#to_sObject



39
40
41
# File 'lib/trenni/parse_error.rb', line 39

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