Class: Antlr4::Runtime::ATNSimulator

Inherits:
Object
  • Object
show all
Defined in:
lib/antlr4/runtime/atn_simulator.rb

Direct Known Subclasses

LexerATNSimulator, ParserATNSimulator

Constant Summary collapse

SERIALIZED_VERSION =
ATNDeserializer.SERIALIZED_VERSION
SERIALIZED_UUID =
ATNDeserializer.SERIALIZED_Uuid
@@error =
DFAState.new

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(atn, shared_context_cache) ⇒ ATNSimulator



17
18
19
20
# File 'lib/antlr4/runtime/atn_simulator.rb', line 17

def initialize(atn, shared_context_cache)
  @atn = atn
  @shared_context_cache = shared_context_cache
end

Class Attribute Details

.errorObject

Returns the value of attribute error



11
12
13
# File 'lib/antlr4/runtime/atn_simulator.rb', line 11

def error
  @error
end

Instance Attribute Details

#atnObject

Returns the value of attribute atn



8
9
10
# File 'lib/antlr4/runtime/atn_simulator.rb', line 8

def atn
  @atn
end

#shared_context_cacheObject (readonly)

Returns the value of attribute shared_context_cache



26
27
28
# File 'lib/antlr4/runtime/atn_simulator.rb', line 26

def shared_context_cache
  @shared_context_cache
end

Class Method Details

.check_condition(condition, message = nil) ⇒ Object



39
40
41
# File 'lib/antlr4/runtime/atn_simulator.rb', line 39

def self.check_condition(condition, message = nil)
  ATNDeserializer.new.check_condition(condition, message)
end

.deserialize(data) ⇒ Object



35
36
37
# File 'lib/antlr4/runtime/atn_simulator.rb', line 35

def self.deserialize(data)
  ATNDeserializer.new.deserialize(data)
end

.to_int(c) ⇒ Object



43
44
45
# File 'lib/antlr4/runtime/atn_simulator.rb', line 43

def self.to_int(c)
  ATNDeserializer.to_int(c)
end

.to_int32(data, offset) ⇒ Object



47
48
49
# File 'lib/antlr4/runtime/atn_simulator.rb', line 47

def self.to_int32(data, offset)
  ATNDeserializer.to_int32(data, offset)
end

.to_long(data, offset) ⇒ Object



51
52
53
# File 'lib/antlr4/runtime/atn_simulator.rb', line 51

def self.to_long(data, offset)
  ATNDeserializer.to_long(data, offset)
end

.to_uuid(data, offset) ⇒ Object



55
56
57
# File 'lib/antlr4/runtime/atn_simulator.rb', line 55

def self.to_uuid(data, offset)
  ATNDeserializer.to_uuid(data, offset)
end

Instance Method Details

#cached_context(context) ⇒ Object



28
29
30
31
32
33
# File 'lib/antlr4/runtime/atn_simulator.rb', line 28

def cached_context(context)
  return context if @shared_context_cache.nil?

  visited = {}
  PredictionContextUtils.cached_context(context, @shared_context_cache, visited)
end

#clear_dfaObject



22
23
24
# File 'lib/antlr4/runtime/atn_simulator.rb', line 22

def clear_dfa
  raise UnsupportedOperationException, 'This ATN simulator does not support clearing the DFA.'
end

#edge_factory(atn, type, src, trg, arg1, arg2, arg3, sets) ⇒ Object



59
60
61
# File 'lib/antlr4/runtime/atn_simulator.rb', line 59

def edge_factory(atn, type, src, trg, arg1, arg2, arg3, sets)
  ATNDeserializer.new.edge_factory(atn, type, src, trg, arg1, arg2, arg3, sets)
end

#state_factory(type, rule_index) ⇒ Object



63
64
65
# File 'lib/antlr4/runtime/atn_simulator.rb', line 63

def state_factory(type, rule_index)
  ATNDeserializer.new.state_factory(type, rule_index)
end