Exception: Kaiseki::ParseError
- Defined in:
- lib/parse_error.rb
Instance Attribute Summary collapse
-
#child ⇒ Object
Returns the value of attribute child.
-
#column ⇒ Object
Returns the value of attribute column.
-
#line ⇒ Object
Returns the value of attribute line.
-
#rule ⇒ Object
Returns the value of attribute rule.
Instance Method Summary collapse
-
#initialize(string, rule, child = nil) ⇒ ParseError
constructor
A new instance of ParseError.
- #parsetrace ⇒ Object
- #verbose ⇒ Object
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
#child ⇒ Object
Returns the value of attribute child.
3 4 5 |
# File 'lib/parse_error.rb', line 3 def child @child end |
#column ⇒ Object
Returns the value of attribute column.
3 4 5 |
# File 'lib/parse_error.rb', line 3 def column @column end |
#line ⇒ Object
Returns the value of attribute line.
3 4 5 |
# File 'lib/parse_error.rb', line 3 def line @line end |
#rule ⇒ Object
Returns the value of attribute rule.
3 4 5 |
# File 'lib/parse_error.rb', line 3 def rule @rule end |
Instance Method Details
#parsetrace ⇒ Object
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 |
#verbose ⇒ Object
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 |