private bool?Initialize_IsLeftRecursiveProjectionInternal()
        {
            if (this.rootAdapter != this.Adapter)
            {
                return(false);
            }

            /* ToDo: Do a path depth search that looks at the paths introduced from the root node of the
             * projections entered and see if from 1->Depth the current node yields the current node. */
            List <SyntacticalDFAState> stateSet = new List <SyntacticalDFAState>();

            SyntacticalDFAState.FlatlineState(this.Adapter.AssociatedState, stateSet);
            if (!stateSet.Contains(this.Adapter.AssociatedState))
            {
                stateSet.Insert(0, this.Adapter.AssociatedState);
            }
            var aggSources = (from targetState in stateSet
                              from s in targetState.Sources
                              select s).ToArray();

            return((from s in aggSources
                    let decision = s.Item1 as PredictionTreeDestination
                                   where decision != null
                                   let symbolicDecision = decision.DecidingFactor.SymbolicBreakdown(this.AssociatedCompiler)
                                                          where symbolicDecision.Rules.Count > 0
                                                          let firstRule = symbolicDecision.Rules.Values.First()
                                                                          let decisiveAdapter = this.AssociatedCompiler.AllRuleAdapters[firstRule.Rule, firstRule.DFAState]
                                                                                                where decisiveAdapter.AssociatedContext.Leaf.ContainsKey(rootNode.Rule)
                                                                                                select 1).Any());
        }
 internal void DeterminateAutomata()
 {
     if (this.nfaState != null)
     {
         this.dfaState = nfaState.DeterminateAutomata();
     }
     else
     {
         throw new InvalidOperationException();
     }
 }
Exemple #3
0
 /// <summary>Creates a new <see cref="PredictionTreeLeafVeins"/> instance with the <paramref name="parent"/> provided.</summary>
 /// <param name="parent">The <see cref="PredictionTreeLeaf"/> from which the <see cref="PredictionTreeLeafVeins"/> is derived.</param>
 public PredictionTreeLeafVeins(PredictionTreeLeaf leaf, SyntacticalDFAState originalState, IOilexerGrammarProductionRuleEntry rule)
 {
     this.Leaf           = leaf;
     this.DFAOriginState = originalState;
     this.Rule           = rule;
 }
 internal void ReplaceState(SyntacticalDFAState replacement, PredictionTreeDFAdapter adapter)
 {
     this.dfaState = replacement;
     this.Adapter  = adapter;
 }