Inheritance: OutputModelObject
コード例 #1
0
        protected Recognizer(OutputModelFactory factory)
            : base(factory)
        {
            Grammar g = factory.GetGrammar();

            grammarFileName = Path.GetFileName(g.fileName);
            grammarName     = g.name;
            name            = g.GetRecognizerName();
            tokens          = new LinkedHashMap <string, int>();
            foreach (KeyValuePair <string, int> entry in g.tokenNameToTypeMap)
            {
                int ttype = entry.Value;
                if (ttype > 0)
                {
                    tokens[entry.Key] = ttype;
                }
            }

            ruleNames = g.rules.Keys;
            rules     = g.rules.Values;
            atn       = new SerializedATN(factory, g.atn, g.GetRuleNames());
            if (g.GetOptionString("superClass") != null)
            {
                superClass = new ActionText(null, g.GetOptionString("superClass"));
            }
            else
            {
                superClass = null;
            }

#pragma warning disable CS0612 // Type or member is obsolete
            tokenNames = TranslateTokenStringsToTarget(g.GetTokenDisplayNames(), factory);
#pragma warning restore CS0612 // Type or member is obsolete
            literalNames       = TranslateTokenStringsToTarget(g.GetTokenLiteralNames(), factory);
            symbolicNames      = TranslateTokenStringsToTarget(g.GetTokenSymbolicNames(), factory);
            abstractRecognizer = g.IsAbstract();
        }
コード例 #2
0
ファイル: Recognizer.cs プロジェクト: sharwell/antlr4cs
        protected Recognizer(OutputModelFactory factory)
            : base(factory)
        {
            Grammar g = factory.GetGrammar();
            grammarFileName = Path.GetFileName(g.fileName);
            grammarName = g.name;
            name = g.GetRecognizerName();
            tokens = new LinkedHashMap<string, int>();
            foreach (KeyValuePair<string, int> entry in g.tokenNameToTypeMap)
            {
                int ttype = entry.Value;
                if (ttype > 0)
                {
                    tokens[entry.Key] = ttype;
                }
            }

            ruleNames = g.rules.Keys;
            rules = g.rules.Values;
            atn = new SerializedATN(factory, g.atn, g.GetRuleNames());
            if (g.GetOptionString("superClass") != null)
            {
                superClass = new ActionText(null, g.GetOptionString("superClass"));
            }
            else
            {
                superClass = null;
            }

#pragma warning disable CS0612 // Type or member is obsolete
            tokenNames = TranslateTokenStringsToTarget(g.GetTokenDisplayNames(), factory);
#pragma warning restore CS0612 // Type or member is obsolete
            literalNames = TranslateTokenStringsToTarget(g.GetTokenLiteralNames(), factory);
            symbolicNames = TranslateTokenStringsToTarget(g.GetTokenSymbolicNames(), factory);
            abstractRecognizer = g.IsAbstract();
        }