Class: ATNSimulator

Inherits:
Object show all
Includes:
PredictionContextFunctions
Defined in:
lib/antlr4/atn/ATNSimulator.rb

Direct Known Subclasses

LexerATNSimulator, ParserATNSimulator

Constant Summary collapse

ERROR =

Must distinguish between missing edge and edge we know leads nowhere#/

DFAState.new(0x7FFFFFFF,ATNConfigSet.new())

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PredictionContextFunctions

included

Constructor Details

#initialize(atn, sharedContextCache) ⇒ ATNSimulator

Returns a new instance of ATNSimulator.

Raises:

  • (Exception)


30
31
32
33
34
# File 'lib/antlr4/atn/ATNSimulator.rb', line 30

def initialize(atn, sharedContextCache)
    raise Exception.new("ATN is nil") if atn.nil?
    self.atn = atn
    self.sharedContextCache = sharedContextCache
end

Instance Attribute Details

#atnObject

Returns the value of attribute atn.



29
30
31
# File 'lib/antlr4/atn/ATNSimulator.rb', line 29

def atn
  @atn
end

#sharedContextCacheObject

Returns the value of attribute sharedContextCache.



29
30
31
# File 'lib/antlr4/atn/ATNSimulator.rb', line 29

def sharedContextCache
  @sharedContextCache
end

Instance Method Details

#getCachedContext(context) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/antlr4/atn/ATNSimulator.rb', line 35

def getCachedContext(context)
    if self.sharedContextCache.nil? then
        return context
    end
    visited = Hash.new
    return getCachedPredictionContext(context, self.sharedContextCache, visited)
end