Exception: ANTLR3::Error::MismatchedToken

Inherits:
RecognitionError show all
Defined in:
lib/antlr3/error.rb

Overview

type

MismatchedToken

used by

lexers and parsers

occurs when

The recognizer expected to match a symbol x at the current input position, but it saw a different symbol y instead.

Direct Known Subclasses

MissingToken, UnwantedToken

Constant Summary

Constants included from Constants

Constants::BUILT_IN_TOKEN_NAMES, Constants::DEFAULT, Constants::DOWN, Constants::EOF, Constants::EOF_TOKEN, Constants::EOR_TOKEN_TYPE, Constants::HIDDEN, Constants::INVALID, Constants::INVALID_TOKEN, Constants::MEMO_RULE_FAILED, Constants::MEMO_RULE_UNKNOWN, Constants::MIN_TOKEN_TYPE, Constants::SKIP_TOKEN, Constants::UP

Instance Attribute Summary collapse

Attributes inherited from RecognitionError

#column, #index, #input, #line, #source_name, #symbol, #token

Instance Method Summary collapse

Methods inherited from RecognitionError

#approximate_line_info?, #location, #unexpected_type

Constructor Details

#initialize(expecting, input) ⇒ MismatchedToken

Returns a new instance of MismatchedToken.


220
221
222
223
# File 'lib/antlr3/error.rb', line 220

def initialize( expecting, input )
  @expecting = expecting
  super( input )
end

Instance Attribute Details

#expectingObject (readonly)

Returns the value of attribute expecting


218
219
220
# File 'lib/antlr3/error.rb', line 218

def expecting
  @expecting
end

Instance Method Details

#messageObject


225
226
227
# File 'lib/antlr3/error.rb', line 225

def message
  "%s: %p %p" % [ self.class, unexpected_type, @expecting.inspect ]
end