Exception: Walrat::SkippedSubstringException
- Inherits:
-
Exception
- Object
- Exception
- Walrat::SkippedSubstringException
- Includes:
- LocationTracking
- Defined in:
- lib/walrat/skipped_substring_exception.rb
Overview
I don’t really like using Exceptions for non-error situations, but it seems that using throw/catch here would not be adequate (not possible to embed information in the thrown symbol).
Instance Attribute Summary
Attributes included from LocationTracking
#outer_end, #outer_source_text, #outer_start, #source_text
Instance Method Summary collapse
-
#initialize(substring, info = {}) ⇒ SkippedSubstringException
constructor
A new instance of SkippedSubstringException.
Methods included from LocationTracking
#column_end, #column_end=, #column_start, #column_start=, #end, #end=, #line_end, #line_end=, #line_start, #line_start=, #rightmost?, #start, #start=
Constructor Details
#initialize(substring, info = {}) ⇒ SkippedSubstringException
Returns a new instance of SkippedSubstringException.
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/walrat/skipped_substring_exception.rb', line 32 def initialize substring, info = {} super substring # TODO: this code is just like the code in ParseError. could save # repeating it by setting up inheritance but would need to pay careful # attention to the ordering of my rescue blocks and also change many # instances of "kind_of" in my specs to "instance_of " # alternatively, could look at using a mix-in self.line_start = info[:line_start] self.column_start = info[:column_start] self.line_end = info[:line_end] self.column_end = info[:column_end] end |