The Tokens rule start state linking to each lexer rule start state
Inheritance: DecisionState
コード例 #1
0
ファイル: ATN.cs プロジェクト: ylabade/azure-cosmos-dotnet-v3
 // just free mem, don't shift states in list
 public virtual void DefineMode(string name, TokensStartState s)
 {
     modeNameToStartState[name] = s;
     modeToStartState.Add(s);
     modeToDFA = Arrays.CopyOf(modeToDFA, modeToStartState.Count);
     modeToDFA[modeToDFA.Length - 1] = new DFA(s);
     DefineDecisionState(s);
 }
コード例 #2
0
ファイル: ATNDeserializer.cs プロジェクト: Thomasb81/Surelog
        protected internal virtual ATNState StateFactory(StateType type, int ruleIndex)
        {
            ATNState s;

            switch (type)
            {
            case StateType.InvalidType:
            {
                return(null);
            }

            case StateType.Basic:
            {
                s = new BasicState();
                break;
            }

            case StateType.RuleStart:
            {
                s = new RuleStartState();
                break;
            }

            case StateType.BlockStart:
            {
                s = new BasicBlockStartState();
                break;
            }

            case StateType.PlusBlockStart:
            {
                s = new PlusBlockStartState();
                break;
            }

            case StateType.StarBlockStart:
            {
                s = new StarBlockStartState();
                break;
            }

            case StateType.TokenStart:
            {
                s = new TokensStartState();
                break;
            }

            case StateType.RuleStop:
            {
                s = new RuleStopState();
                break;
            }

            case StateType.BlockEnd:
            {
                s = new BlockEndState();
                break;
            }

            case StateType.StarLoopBack:
            {
                s = new StarLoopbackState();
                break;
            }

            case StateType.StarLoopEntry:
            {
                s = new StarLoopEntryState();
                break;
            }

            case StateType.PlusLoopBack:
            {
                s = new PlusLoopbackState();
                break;
            }

            case StateType.LoopEnd:
            {
                s = new LoopEndState();
                break;
            }

            default:
            {
                string message = string.Format(CultureInfo.CurrentCulture, "The specified state type {0} is not valid.", type);
                throw new ArgumentException(message);
            }
            }
            s.ruleIndex = ruleIndex;
            return(s);
        }
コード例 #3
0
ファイル: ATNDeserializer.cs プロジェクト: antlr/antlr4
        protected internal virtual ATNState StateFactory(StateType type, int ruleIndex)
        {
            ATNState s;
            switch (type)
            {
                case StateType.InvalidType:
                {
                    return null;
                }

                case StateType.Basic:
                {
                    s = new BasicState();
                    break;
                }

                case StateType.RuleStart:
                {
                    s = new RuleStartState();
                    break;
                }

                case StateType.BlockStart:
                {
                    s = new BasicBlockStartState();
                    break;
                }

                case StateType.PlusBlockStart:
                {
                    s = new PlusBlockStartState();
                    break;
                }

                case StateType.StarBlockStart:
                {
                    s = new StarBlockStartState();
                    break;
                }

                case StateType.TokenStart:
                {
                    s = new TokensStartState();
                    break;
                }

                case StateType.RuleStop:
                {
                    s = new RuleStopState();
                    break;
                }

                case StateType.BlockEnd:
                {
                    s = new BlockEndState();
                    break;
                }

                case StateType.StarLoopBack:
                {
                    s = new StarLoopbackState();
                    break;
                }

                case StateType.StarLoopEntry:
                {
                    s = new StarLoopEntryState();
                    break;
                }

                case StateType.PlusLoopBack:
                {
                    s = new PlusLoopbackState();
                    break;
                }

                case StateType.LoopEnd:
                {
                    s = new LoopEndState();
                    break;
                }

                default:
                {
                    string message = string.Format(CultureInfo.CurrentCulture, "The specified state type {0} is not valid.", type);
                    throw new ArgumentException(message);
                }
            }
            s.ruleIndex = ruleIndex;
            return s;
        }
コード例 #4
0
ファイル: ATN.cs プロジェクト: rharrisxtheta/antlr4cs
 // just free mem, don't shift states in list
 public virtual void DefineMode(string name, TokensStartState s)
 {
     modeNameToStartState[name] = s;
     modeToStartState.Add(s);
     modeToDFA = Arrays.CopyOf(modeToDFA, modeToStartState.Count);
     modeToDFA[modeToDFA.Length - 1] = new DFA(s);
     DefineDecisionState(s);
 }