Exception: NoViableAltException

Inherits:
RecognitionException show all
Defined in:
lib/antlr4/error.rb

Overview

in the various paths when the error. Reported by reportNoViableAlternative()

Instance Attribute Summary

Attributes inherited from RecognitionException

#ctx, #deadEndConfigs, #input, #offendingState, #offendingToken, #recognizer, #startToken

Instance Method Summary collapse

Methods inherited from RecognitionException

#getExpectedTokens

Constructor Details

#initialize(recognizer, input = nil, startToken = nil, offendingToken = nil, deadEndConfigs = nil, ctx = nil) ⇒ NoViableAltException

Returns a new instance of NoViableAltException.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/antlr4/error.rb', line 90

def initialize(recognizer, input=nil, startToken=nil, offendingToken=nil, deadEndConfigs=nil, ctx=nil)
    ctx = recognizer.ctx if ctx.nil?
    offendingToken = recognizer.getCurrentToken() if offendingToken.nil?
    startToken = recognizer.getCurrentToken() if startToken.nil?
    input = recognizer.getInputStream() if input.nil?
    super(nil,recognizer, input, ctx)
    # Which configurations did we try at input.index() that couldn't match input.LT(1)?#
    @deadEndConfigs = deadEndConfigs
    # The token object at the start index; the input stream might
    #   not be buffering tokens so get a reference to it. (At the
    #  time the error occurred, of course the stream needs to keep a
    #  buffer all of the tokens but later we might not have access to those.)
    @startToken = startToken
    @offendingToken = offendingToken
end