Class: Rley::Parser::ErrorReason

Inherits:
Object
  • Object
show all
Defined in:
lib/rley/parser/error_reason.rb

Overview

Abstract class. An instance represents an explanation describing the likely cause of a parse error detected by Rley.

Direct Known Subclasses

ExpectationNotMet, NoInput

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aRank) ⇒ ErrorReason

Constructor

Parameters:

  • aRank (Fixnum)

    The sequence number of the offending input token.



15
16
17
# File 'lib/rley/parser/error_reason.rb', line 15

def initialize(aRank)
  @rank = aRank
end

Instance Attribute Details

#rankObject (readonly)

Returns the value of attribute rank.



11
12
13
# File 'lib/rley/parser/error_reason.rb', line 11

def rank
  @rank
end

Instance Method Details

#inspectString

Return this reason's class name and message

Returns:

  • (String)

    Return this reason's class name and message



25
26
27
# File 'lib/rley/parser/error_reason.rb', line 25

def inspect
  "#{self.class.name}: #{message}"
end

#messageString

Returns the result of invoking reason.to_s.

Returns:

  • (String)

    the result of invoking reason.to_s



20
21
22
# File 'lib/rley/parser/error_reason.rb', line 20

def message()
  return to_s
end