Exception: ANTLR3::Error::FailedPredicate

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

Overview

error

FailedPredicate

used by

all recognizers

occurs when

A recognizer is in a rule with a predicate action element, and the predicating action code evaluated to a false value.

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(input, rule_name, predicate_text) ⇒ FailedPredicate

Returns a new instance of FailedPredicate.


472
473
474
475
476
# File 'lib/antlr3/error.rb', line 472

def initialize( input, rule_name, predicate_text )
  @rule_name = rule_name
  @predicate_text = predicate_text
  super( input )
end

Instance Attribute Details

#inputObject

Returns the value of attribute input


471
472
473
# File 'lib/antlr3/error.rb', line 471

def input
  @input
end

#predicate_textObject

Returns the value of attribute predicate_text


471
472
473
# File 'lib/antlr3/error.rb', line 471

def predicate_text
  @predicate_text
end

#rule_nameObject

Returns the value of attribute rule_name


471
472
473
# File 'lib/antlr3/error.rb', line 471

def rule_name
  @rule_name
end

Instance Method Details

#inspectObject


478
479
480
# File 'lib/antlr3/error.rb', line 478

def inspect
  '%s(%s, { %s }?)' % [ self.class.name, @rule_name, @predicate_text ]
end

#messageObject


482
483
484
# File 'lib/antlr3/error.rb', line 482

def message
  "rule #@rule_name failed predicate: { #@predicate_text }?"
end