Class: Antlr4::Runtime::SingletonPredictionContext
Constant Summary
PredictionContext::EMPTY_RETURN_STATE, PredictionContext::INITIAL_HASH
Instance Attribute Summary collapse
#cached_hash_code
Instance Method Summary
collapse
#empty_path?, #hash, #to_s_recog, #to_strings, #to_strings3, #to_strings3_inner
Constructor Details
Returns a new instance of SingletonPredictionContext.
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
4
5
6
|
# File 'lib/antlr4/runtime/singleton_prediction_context.rb', line 4
def parent
@parent
end
|
#return_state ⇒ Object
Returns the value of attribute return_state.
5
6
7
|
# File 'lib/antlr4/runtime/singleton_prediction_context.rb', line 5
def return_state
@return_state
end
|
Instance Method Details
#empty? ⇒ Boolean
21
22
23
|
# File 'lib/antlr4/runtime/singleton_prediction_context.rb', line 21
def empty?
@return_state == EMPTY_RETURN_STATE
end
|
#equals(other) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/antlr4/runtime/singleton_prediction_context.rb', line 29
def equals(other)
if self == other
return true
elsif !(other.is_a? SingletonPredictionContext)
return false
end
if hash != other.hash
return false end
@return_state == other.return_state && (!@parent.nil? && @parent.eql?(other.parent))
end
|
#get_parent(_i) ⇒ Object
13
14
15
|
# File 'lib/antlr4/runtime/singleton_prediction_context.rb', line 13
def get_parent(_i)
@parent
end
|
#get_return_state(_index) ⇒ Object
25
26
27
|
# File 'lib/antlr4/runtime/singleton_prediction_context.rb', line 25
def get_return_state(_index)
@return_state
end
|
#size ⇒ Object
17
18
19
|
# File 'lib/antlr4/runtime/singleton_prediction_context.rb', line 17
def size
1
end
|
#to_s ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'lib/antlr4/runtime/singleton_prediction_context.rb', line 43
def to_s
up = !@parent.nil? ? @parent.to_s : ''
if up.empty?
return '$' if @return_state == EMPTY_RETURN_STATE
return @return_state.to_s
end
@return_state.to_s + ' ' + up
end
|