Class: Antlr4::Runtime::ATNConfig
- Inherits:
-
Object
- Object
- Antlr4::Runtime::ATNConfig
- Defined in:
- lib/antlr4/runtime/atn_config.rb
Direct Known Subclasses
Constant Summary collapse
- SUPPRESS_PRECEDENCE_FILTER =
0x40000000
Instance Attribute Summary collapse
-
#alt ⇒ Object
Returns the value of attribute alt.
-
#context ⇒ Object
Returns the value of attribute context.
-
#reaches_into_outer_context ⇒ Object
Returns the value of attribute reaches_into_outer_context.
-
#semantic_context ⇒ Object
Returns the value of attribute semantic_context.
-
#state ⇒ Object
Returns the value of attribute state.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #atn_config1(state, alt, context) ⇒ Object
- #atn_config2(state, alt, context, semantic_context) ⇒ Object
- #atn_config3(c, state) ⇒ Object
- #atn_config4(c, state, semantic_context) ⇒ Object
- #atn_config5(c, semantic_context) ⇒ Object
- #atn_config6(c, state, context) ⇒ Object
- #atn_config7(c, state, context, semantic_context) ⇒ Object
- #atn_config_copy(old) ⇒ Object
- #bucket_hash ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize ⇒ ATNConfig
constructor
A new instance of ATNConfig.
- #outer_context_depth ⇒ Object
- #precedence_filter_suppressed(value) ⇒ Object
- #precedence_filter_suppressed? ⇒ Boolean
- #to_s ⇒ Object
- #to_s2(_recog = nil, show_alt = false) ⇒ Object
Constructor Details
#initialize ⇒ ATNConfig
Returns a new instance of ATNConfig.
12 13 14 15 16 17 |
# File 'lib/antlr4/runtime/atn_config.rb', line 12 def initialize @reaches_into_outer_context = 0 @alt = 0 @_hash = nil @_bucket_hash = nil end |
Instance Attribute Details
#alt ⇒ Object
Returns the value of attribute alt.
6 7 8 |
# File 'lib/antlr4/runtime/atn_config.rb', line 6 def alt @alt end |
#context ⇒ Object
Returns the value of attribute context.
7 8 9 |
# File 'lib/antlr4/runtime/atn_config.rb', line 7 def context @context end |
#reaches_into_outer_context ⇒ Object
Returns the value of attribute reaches_into_outer_context.
9 10 11 |
# File 'lib/antlr4/runtime/atn_config.rb', line 9 def reaches_into_outer_context @reaches_into_outer_context end |
#semantic_context ⇒ Object
Returns the value of attribute semantic_context.
10 11 12 |
# File 'lib/antlr4/runtime/atn_config.rb', line 10 def semantic_context @semantic_context end |
#state ⇒ Object
Returns the value of attribute state.
5 6 7 |
# File 'lib/antlr4/runtime/atn_config.rb', line 5 def state @state end |
#target ⇒ Object
Returns the value of attribute target.
8 9 10 |
# File 'lib/antlr4/runtime/atn_config.rb', line 8 def target @target end |
Instance Method Details
#<=>(other) ⇒ Object
128 129 130 131 132 133 134 135 136 137 |
# File 'lib/antlr4/runtime/atn_config.rb', line 128 def <=>(other) if self == other return 0 elsif other.nil? return 1 end return 0 if @state.state_number == other.state.state_number && @alt == other.alt && (@context == other.context || (!@context.nil? && @context.<=>(other.context))) && @semantic_context.<=>(other.semantic_context) && precedence_filter_suppressed? == other.precedence_filter_suppressed? -1 end |
#atn_config1(state, alt, context) ⇒ Object
40 41 42 |
# File 'lib/antlr4/runtime/atn_config.rb', line 40 def atn_config1(state, alt, context) atn_config2(state, alt, context, SemanticContext::NONE) end |
#atn_config2(state, alt, context, semantic_context) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/antlr4/runtime/atn_config.rb', line 44 def atn_config2(state, alt, context, semantic_context) @state = state @alt = alt @context = context @semantic_context = semantic_context end |
#atn_config3(c, state) ⇒ Object
51 52 53 |
# File 'lib/antlr4/runtime/atn_config.rb', line 51 def atn_config3(c, state) atn_config7(c, state, c.context, c.semantic_context) end |
#atn_config4(c, state, semantic_context) ⇒ Object
55 56 57 |
# File 'lib/antlr4/runtime/atn_config.rb', line 55 def atn_config4(c, state, semantic_context) atn_config7(c, state, c.context, semantic_context) end |
#atn_config5(c, semantic_context) ⇒ Object
59 60 61 |
# File 'lib/antlr4/runtime/atn_config.rb', line 59 def atn_config5(c, semantic_context) atn_config7(c, c.state, c.context, semantic_context) end |
#atn_config6(c, state, context) ⇒ Object
63 64 65 |
# File 'lib/antlr4/runtime/atn_config.rb', line 63 def atn_config6(c, state, context) atn_config7(c, state, context, c.semantic_context) end |
#atn_config7(c, state, context, semantic_context) ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/antlr4/runtime/atn_config.rb', line 67 def atn_config7(c, state, context, semantic_context) @state = state @alt = c.alt @context = context @semantic_context = semantic_context @reaches_into_outer_context = c.reaches_into_outer_context end |
#atn_config_copy(old) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/antlr4/runtime/atn_config.rb', line 32 def atn_config_copy(old) @state = old.state @alt = old.alt @context = old.context @semantic_context = old.semantic_context @reaches_into_outer_context = old.reaches_into_outer_context end |
#bucket_hash ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/antlr4/runtime/atn_config.rb', line 19 def bucket_hash return @_bucket_hash unless @_bucket_hash.nil? unless @_bucket_hash.nil? if hash_code == @_bucket_hash puts 'Same hash_code for ATNConfig.bucket_hash' else puts 'Different hash_code for ATNConfig.bucket_hash' end end @_bucket_hash = RumourHash.calculate([@state.state_number, @alt]) end |
#eql?(other) ⇒ Boolean
117 118 119 120 121 122 123 124 125 126 |
# File 'lib/antlr4/runtime/atn_config.rb', line 117 def eql?(other) if self == other return true elsif other.nil? return false end return true if @state.state_number == other.state.state_number && @alt == other.alt && (@context == other.context || (!@context.nil? && @context.<=>(other.context))) && @semantic_context.<=>(other.semantic_context) && precedence_filter_suppressed? == other.precedence_filter_suppressed? false end |
#hash ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/antlr4/runtime/atn_config.rb', line 139 def hash return @_hash unless @_hash.nil? hash_code = RumourHash.calculate([@state.state_number, @alt, @context, @semantic_context]) unless @_hash.nil? if hash_code == @_hash puts 'Same hash_code for ATNConfig' else puts 'Different hash_code for ATNConfig' end end @_hash = hash_code end |
#outer_context_depth ⇒ Object
75 76 77 |
# File 'lib/antlr4/runtime/atn_config.rb', line 75 def outer_context_depth (@reaches_into_outer_context & ~SUPPRESS_PRECEDENCE_FILTER) end |
#precedence_filter_suppressed(value) ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/antlr4/runtime/atn_config.rb', line 83 def precedence_filter_suppressed(value) if value @reaches_into_outer_context |= 0x40000000 else @reaches_into_outer_context &= ~SUPPRESS_PRECEDENCE_FILTER end end |
#precedence_filter_suppressed? ⇒ Boolean
79 80 81 |
# File 'lib/antlr4/runtime/atn_config.rb', line 79 def precedence_filter_suppressed? (@reaches_into_outer_context & SUPPRESS_PRECEDENCE_FILTER) != 0 end |
#to_s ⇒ Object
91 92 93 |
# File 'lib/antlr4/runtime/atn_config.rb', line 91 def to_s to_s2(nil, true) end |
#to_s2(_recog = nil, show_alt = false) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/antlr4/runtime/atn_config.rb', line 95 def to_s2(_recog = nil, show_alt = false) buf = '' buf << '(' buf << @state.to_s if show_alt buf << ',' buf << @alt.to_s end unless @context.nil? buf << ',[' buf << @context.to_s buf << ']' end if !@semantic_context.nil? && @semantic_context != SemanticContext::NONE buf << ',' buf << @semantic_context.to_s end buf << ',up=' << outer_context_depth.to_s if outer_context_depth > 0 buf << ')' buf end |