Exception: ANTLR3::Error::MismatchedTreeNode

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

Overview

error

MismatchedTreeNode

used by

tree parsers

occurs when

A tree parser expects to match a tree node containing a specific type of token, but the current tree node's token type does not match. It's essentially the same as MismatchedToken, but used specifically for tree nodes.

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, #line, #source_name, #symbol, #token

Instance Method Summary collapse

Methods inherited from RecognitionError

#approximate_line_info?, #location, #unexpected_type

Constructor Details

#initialize(expecting, input) ⇒ MismatchedTreeNode

Returns a new instance of MismatchedTreeNode.


500
501
502
503
# File 'lib/antlr3/error.rb', line 500

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

Instance Attribute Details

#expectingObject

Returns the value of attribute expecting


499
500
501
# File 'lib/antlr3/error.rb', line 499

def expecting
  @expecting
end

#inputObject

Returns the value of attribute input


499
500
501
# File 'lib/antlr3/error.rb', line 499

def input
  @input
end

Instance Method Details

#messageObject


505
506
507
508
# File 'lib/antlr3/error.rb', line 505

def message
  '%s: %p != %p' %
    [ self.class, unexpected_type, @expecting ]
end