Exception: Antlr4::Runtime::FailedPredicateException
- Inherits:
-
RecognitionException
- Object
- StandardError
- RecognitionException
- Antlr4::Runtime::FailedPredicateException
- Defined in:
- lib/antlr4/runtime/failed_predicate_exception.rb
Instance Attribute Summary collapse
-
#predicate ⇒ Object
readonly
Returns the value of attribute predicate.
-
#predicate_index ⇒ Object
readonly
Returns the value of attribute predicate_index.
-
#rule_index ⇒ Object
readonly
Returns the value of attribute rule_index.
Attributes inherited from RecognitionException
#context, #input, #offending_state, #offending_token, #recognizer
Instance Method Summary collapse
- #format_message(predicate, message) ⇒ Object
-
#initialize(recognizer, predicate = nil, message = nil) ⇒ FailedPredicateException
constructor
A new instance of FailedPredicateException.
Methods inherited from RecognitionException
Constructor Details
#initialize(recognizer, predicate = nil, message = nil) ⇒ FailedPredicateException
Returns a new instance of FailedPredicateException.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/antlr4/runtime/failed_predicate_exception.rb', line 8 def initialize(recognizer, predicate = nil, = nil) super((predicate, )) @recognizer = recognizer @input = recognizer.input_stream @context = recognizer._ctx s = recognizer._interp.atn.states.get(recognizer.getState) trans = s.transition(0) if trans.is_a? PredicateTransition @rule_index = trans.rule_index @predicate_index = trans.pred_index else @rule_index = 0 @predicate_index = 0 end @predicate = predicate @offending_token = recognizer.current_token end |
Instance Attribute Details
#predicate ⇒ Object (readonly)
Returns the value of attribute predicate.
4 5 6 |
# File 'lib/antlr4/runtime/failed_predicate_exception.rb', line 4 def predicate @predicate end |
#predicate_index ⇒ Object (readonly)
Returns the value of attribute predicate_index.
5 6 7 |
# File 'lib/antlr4/runtime/failed_predicate_exception.rb', line 5 def predicate_index @predicate_index end |
#rule_index ⇒ Object (readonly)
Returns the value of attribute rule_index.
6 7 8 |
# File 'lib/antlr4/runtime/failed_predicate_exception.rb', line 6 def rule_index @rule_index end |
Instance Method Details
#format_message(predicate, message) ⇒ Object
29 30 31 |
# File 'lib/antlr4/runtime/failed_predicate_exception.rb', line 29 def (predicate, ) .nil? ? : "failed predicate: {" + predicate + "}?" end |