Exception: Trenni::ParseError
- Inherits:
-
StandardError
- Object
- StandardError
- Trenni::ParseError
- Defined in:
- lib/trenni/scanner.rb
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#locations ⇒ Object
readonly
Returns the value of attribute locations.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(message, scanner, positions = nil) ⇒ ParseError
constructor
A new instance of ParseError.
- #to_s ⇒ Object
Constructor Details
#initialize(message, scanner, positions = nil) ⇒ ParseError
Returns a new instance of ParseError.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/trenni/scanner.rb', line 27 def initialize(, scanner, positions = nil) super() @path = scanner.path @locations = [] if positions positions.each do |position| @locations << Location.new(scanner.string, position) end else @locations = [Location.new(scanner.string, scanner.pos)] end @location = @locations.first @input_name = nil end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
48 49 50 |
# File 'lib/trenni/scanner.rb', line 48 def location @location end |
#locations ⇒ Object (readonly)
Returns the value of attribute locations.
47 48 49 |
# File 'lib/trenni/scanner.rb', line 47 def locations @locations end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
50 51 52 |
# File 'lib/trenni/scanner.rb', line 50 def path @path end |
Instance Method Details
#to_s ⇒ Object
52 53 54 |
# File 'lib/trenni/scanner.rb', line 52 def to_s "#{@path}#{@location}: #{super}\n#{location.line_text}" end |