class Antlr4::Runtime::DFAState
Attributes
configs[RW]
edges[RW]
is_accept_state[RW]
lexer_action_executor[RW]
predicates[RW]
prediction[RW]
requires_full_context[RW]
state_number[RW]
Public Class Methods
new(x = nil)
click to toggle source
# File lib/antlr4/runtime/dfa_state.rb, line 19 def initialize(x = nil) @is_accept_state = false @edges = [] @state_number = -1 @_hash = nil if x.nil? @configs = ATNConfigSet.new elsif x.is_a?(ATNConfigSet) @configs = x else @state_number = x end end
Public Instance Methods
alt_set()
click to toggle source
# File lib/antlr4/runtime/dfa_state.rb, line 56 def alt_set alts = Set.new unless @configs.nil? i = 0 while i < @configs.length c = @configs[i] alts.add(c.alt) i += 1 end end return nil if alts.empty? alts end
equals?(o)
click to toggle source
# File lib/antlr4/runtime/dfa_state.rb, line 87 def equals?(o) # compare set of ATN configurations in this set with other return true if self == o return false unless o.is_a? DFAState @configs.eql?(o.configs) end
hash()
click to toggle source
# File lib/antlr4/runtime/dfa_state.rb, line 71 def hash return @_hash unless @_hash.nil? hash_code = RumourHash.calculate([configs.hash]) unless @_hash.nil? if hash_code == @_hash puts 'Same hash_code for DFAState' else puts 'Different hash_code for DFAState' end end @_hash = hash_code end
initialize_configs(configs)
click to toggle source
# File lib/antlr4/runtime/dfa_state.rb, line 52 def initialize_configs(configs) @configs = configs end
initialize_state_number(stateNumber)
click to toggle source
# File lib/antlr4/runtime/dfa_state.rb, line 48 def initialize_state_number(stateNumber) @state_number = stateNumber end
to_s()
click to toggle source
# File lib/antlr4/runtime/dfa_state.rb, line 94 def to_s buf = '' buf << @state_number.to_s << ':' << @configs.to_s if @is_accept_state buf << '=>' buf << if !@predicates.nil? @predicates.to_s else @prediction.to_s end end buf.to_s end