Class: Rley::Parser::ExpectationNotMet
- Inherits:
-
ErrorReason
- Object
- ErrorReason
- Rley::Parser::ExpectationNotMet
- Defined in:
- lib/rley/parser/error_reason.rb
Overview
Abstract class and subclass of ErrorReason. This specialization represents errors in which the input didn't match one of the expected token.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#expected_terminals ⇒ Object
readonly
The terminal symbols expected when error was occurred.
-
#last_token ⇒ Object
readonly
The last input token read when error was detected.
Attributes inherited from ErrorReason
Instance Method Summary collapse
-
#initialize(aRank, lastToken, expectedTerminals) ⇒ ExpectationNotMet
constructor
A new instance of ExpectationNotMet.
Methods inherited from ErrorReason
Constructor Details
#initialize(aRank, lastToken, expectedTerminals) ⇒ ExpectationNotMet
Returns a new instance of ExpectationNotMet.
53 54 55 56 57 58 59 |
# File 'lib/rley/parser/error_reason.rb', line 53 def initialize(aRank, lastToken, expectedTerminals) super(aRank) raise StandardError, 'Internal error: nil token' if lastToken.nil? @last_token = lastToken.dup @expected_terminals = expectedTerminals.dup end |
Instance Attribute Details
#expected_terminals ⇒ Object (readonly)
The terminal symbols expected when error was occurred
51 52 53 |
# File 'lib/rley/parser/error_reason.rb', line 51 def expected_terminals @expected_terminals end |
#last_token ⇒ Object (readonly)
The last input token read when error was detected
48 49 50 |
# File 'lib/rley/parser/error_reason.rb', line 48 def last_token @last_token end |