Class: LexerATNConfig

Inherits:
ATNConfig show all
Defined in:
lib/antlr4/atn/ATNConfig.rb

Overview

need a forward declaration

Instance Attribute Summary collapse

Attributes inherited from ATNConfig

#alt, #context, #hashcode, #reachesIntoOuterContext, #semanticContext, #state

Instance Method Summary collapse

Methods inherited from ATNConfig

createConfigState, #mk_hashcode, #toString, #to_s

Constructor Details

#initialize(state, alt = nil, context = nil, semantic = SemanticContext.NONE, _lexerActionExecutor = nil, config = nil) ⇒ LexerATNConfig

Returns a new instance of LexerATNConfig.



109
110
111
112
113
114
115
116
117
118
119
# File 'lib/antlr4/atn/ATNConfig.rb', line 109

def initialize(state, alt=nil, context=nil, semantic=SemanticContext.NONE, _lexerActionExecutor=nil, config=nil)
    super(state, alt, context, semantic, config)
    if config then 
        _lexerActionExecutor = config.lexerActionExecutor if _lexerActionExecutor.nil? 
        @passedThroughNonGreedyDecision = self.checkNonGreedyDecision(config, state)
    else
       @passedThroughNonGreedyDecision = false 
    end
    # This is the backing field for {@link #getLexerActionExecutor}.
    @lexerActionExecutor = _lexerActionExecutor
end

Instance Attribute Details

#lexerActionExecutorObject

Returns the value of attribute lexerActionExecutor.



108
109
110
# File 'lib/antlr4/atn/ATNConfig.rb', line 108

def lexerActionExecutor
  @lexerActionExecutor
end

#passedThroughNonGreedyDecisionObject

Returns the value of attribute passedThroughNonGreedyDecision.



108
109
110
# File 'lib/antlr4/atn/ATNConfig.rb', line 108

def passedThroughNonGreedyDecision
  @passedThroughNonGreedyDecision
end

Instance Method Details

#==(other) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/antlr4/atn/ATNConfig.rb', line 131

def ==(other)
    return true if self.equal? other
    return false unless other.kind_of? LexerATNConfig
    if self.passedThroughNonGreedyDecision != other.passedThroughNonGreedyDecision
        return false
    end
    if self.lexerActionExecutor == other.lexerActionExecutor
          super(other)
    else
        false
    end
end

#checkNonGreedyDecision(source, target) ⇒ Object



143
144
145
# File 'lib/antlr4/atn/ATNConfig.rb', line 143

def checkNonGreedyDecision(source, target)
    source.passedThroughNonGreedyDecision or (target.kind_of?(DecisionState) and target.nonGreedy )
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


128
129
130
# File 'lib/antlr4/atn/ATNConfig.rb', line 128

def eql?(other)
    self == other
end

#hashObject



121
122
123
124
125
126
127
# File 'lib/antlr4/atn/ATNConfig.rb', line 121

def hash
    b = 0
    b = 1 if self.passedThroughNonGreedyDecision 
    [self.state.stateNumber, self.alt, self.context, 
      self.semanticContext, b, self.lexerActionExecutor
    ].map(&:to_s).join('').hash
end