Method: ATNConfig#initialize
- Defined in:
- lib/antlr4/atn/ATNConfig.rb
#initialize(state = nil, alt = nil, context = nil, semantic = nil, config = nil) ⇒ ATNConfig
Returns a new instance of ATNConfig.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/antlr4/atn/ATNConfig.rb', line 16 def initialize(state=nil, alt=nil, context=nil, semantic=nil, config=nil) if config then state = config.state if state.nil? alt = config.alt if alt.nil? context = config.context if context.nil? semantic = config.semanticContext if semantic.nil? semantic = SemanticContext.NONE if semantic.nil? @reachesIntoOuterContext = config.reachesIntoOuterContext else # We cannot execute predicates dependent upon local context unless # we know for sure we are in the correct context. Because there is # no way to do this efficiently, we simply cannot evaluate # dependent predicates unless we are in the rule that initially # invokes the ATN simulator. # # closure() tracks the depth of how far we dip into the # outer context: depth > 0. Note that it may not be totally # accurate depth since I don't ever decrement. TODO: make it a boolean then @reachesIntoOuterContext = 0 end #if not isinstance(state, ATNState): # pass # The ATN state associated with this configuration#/ @state = state # What alt (or lexer rule) is predicted by this configuration#/ @alt = alt # The stack of invoking states leading to the rule/states associated # with this config. We track only those contexts pushed during # execution of the ATN simulator. @context = context @semanticContext = semantic mk_hashcode end |