Antlr3.Tool.Grammar.CreateRuleStartAndStopNFAStates C# (CSharp) Method

CreateRuleStartAndStopNFAStates() public method

public CreateRuleStartAndStopNFAStates ( ) : void
return void
        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;
            }
        }
Grammar