Exception: Kaiseki::ParseError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string, rule, child = nil) ⇒ ParseError

Returns a new instance of ParseError.



5
6
7
8
9
# File 'lib/parse_error.rb', line 5

def initialize string, rule, child = nil
	super string
	@rule = rule
	@child = child
end

Instance Attribute Details

#childObject

Returns the value of attribute child.



3
4
5
# File 'lib/parse_error.rb', line 3

def child
  @child
end

#columnObject

Returns the value of attribute column.



3
4
5
# File 'lib/parse_error.rb', line 3

def column
  @column
end

#lineObject

Returns the value of attribute line.



3
4
5
# File 'lib/parse_error.rb', line 3

def line
  @line
end

#ruleObject

Returns the value of attribute rule.



3
4
5
# File 'lib/parse_error.rb', line 3

def rule
  @rule
end

Instance Method Details

#parsetraceObject



15
16
17
18
19
20
21
# File 'lib/parse_error.rb', line 15

def parsetrace
	array = [self]
	while array.last.child
		array << array.last.child
	end
	array.reverse
end

#verboseObject



11
12
13
# File 'lib/parse_error.rb', line 11

def verbose
	"[#{@line ? @line + 1 : 0}:#{@column ? @column + 1 : 0}] #{to_s} [in #{@rule}]"
end