Antlr4.Analysis.LeftRecursiveRuleAnalyzer.SuffixAlt C# (CSharp) Method

SuffixAlt() public method

public SuffixAlt ( AltAST originalAltTree, int alt ) : void
originalAltTree AltAST
alt int
return void
        public override void SuffixAlt(AltAST originalAltTree, int alt)
        {
            AltAST altTree = (AltAST)originalAltTree.DupTree();
            string altLabel = altTree.altLabel != null ? altTree.altLabel.Text : null;

            string label = null;
            bool isListLabel = false;
            GrammarAST lrlabel = StripLeftRecursion(altTree);
            if (lrlabel != null)
            {
                label = lrlabel.Text;
                isListLabel = lrlabel.Parent.Type == PLUS_ASSIGN;
                leftRecursiveRuleRefLabels.Add(Tuple.Create(lrlabel, altLabel));
            }

            StripAltLabel(altTree);
            string altText = Text(altTree);
            altText = altText.Trim();
            LeftRecursiveRuleAltInfo a =
                new LeftRecursiveRuleAltInfo(alt, altText, label, altLabel, isListLabel, originalAltTree);
            suffixAlts[alt] = a;
            //		System.out.println("suffixAlt " + alt + ": " + altText + ", rewrite=" + rewriteText);
        }