public TreeToNFAConverter( Grammar g, NFA nfa, NFAFactory factory, ITreeNodeStream input )
     : this(input)
 {
     this.grammar = g;
     this.nfa = nfa;
     this.factory = factory;
 }
Esempio n. 2
0
 public NFAFactory( NFA nfa )
 {
     this._nfa = nfa;
 }
Esempio n. 3
0
 protected DFA( int decisionNumber, NFAState decisionStartState )
 {
     this._probe = new DecisionProbe(this);
     this._decisionNumber = decisionNumber;
     this._decisionNFAStartState = decisionStartState;
     this._nfa = decisionStartState.nfa;
     this._numberOfAlts = Nfa.Grammar.GetNumberOfAltsForDecisionNFA( decisionStartState );
     //setOptions( nfa.grammar.getDecisionOptions(getDecisionNumber()) );
     this._altToAcceptState = new DFAState[NumberOfAlts + 1];
     this._unreachableAlts = new List<int>(Enumerable.Range(1, NumberOfAlts));
 }
Esempio n. 4
0
        /** Define all the rule begin/end NFAStates to solve forward reference
         *  issues.  Critical for composite grammars too.
         *  This is normally called on all root/delegates manually and then
         *  buildNFA() is called afterwards because the NFA construction needs
         *  to see rule start/stop states from potentially every grammar. Has
         *  to be have these created a priori.  Testing routines will often
         *  just call buildNFA(), which forces a call to this method if not
         *  done already. Works ONLY for single noncomposite grammars.
         */
        public virtual void CreateRuleStartAndStopNFAStates()
        {
            //[email protected]("### createRuleStartAndStopNFAStates "+getGrammarTypeString()+" grammar "+name+" NFAs");
            if ( nfa != null )
            {
                return;
            }
            nfa = new NFA( this );
            factory = new NFAFactory( nfa );

            foreach ( Rule r in Rules )
            {
                string ruleName = r.Name;
                NFAState ruleBeginState = factory.NewState();
                ruleBeginState.Description = "rule " + ruleName + " start";
                ruleBeginState.enclosingRule = r;
                r.StartState = ruleBeginState;
                NFAState ruleEndState = factory.NewState();
                ruleEndState.Description = "rule " + ruleName + " end";
                ruleEndState.IsAcceptState = true;
                ruleEndState.enclosingRule = r;
                r.StopState = ruleEndState;
            }
        }
Esempio n. 5
0
 public NFAState( NFA nfa )
 {
     this.nfa = nfa;
 }
Esempio n. 6
0
 public NFAState(NFA nfa)
 {
     this.nfa = nfa;
 }
Esempio n. 7
0
 public NFAFactory( NFA nfa )
 {
     nfa.Factory = this;
     this.nfa = nfa;
 }