Esempio n. 1
0
        public void StripSynPred(GrammarAST altAST)
        {
            GrammarAST t = (GrammarAST)altAST.GetChild(0);

            if (t.Type == ANTLRParser.BACKTRACK_SEMPRED ||
                t.Type == ANTLRParser.SYNPRED ||
                t.Type == ANTLRParser.SYN_SEMPRED)
            {
                altAST.DeleteChild(0);
            }
        }
Esempio n. 2
0
        public void StripLeftRecursion(GrammarAST altAST)
        {
            GrammarAST rref = (GrammarAST)altAST.GetChild(0);

            if (rref.Type == ANTLRParser.RULE_REF && rref.Text.Equals(ruleName))
            {
                // remove rule ref
                altAST.DeleteChild(0);

                // reset index so it prints properly
                GrammarAST newFirstChild = (GrammarAST)altAST.GetChild(0);
                altAST.TokenStartIndex = newFirstChild.TokenStartIndex;
            }
        }
 public void StripSynPred(GrammarAST altAST)
 {
     GrammarAST t = (GrammarAST)altAST.GetChild(0);
     if (t.Type == ANTLRParser.BACKTRACK_SEMPRED ||
          t.Type == ANTLRParser.SYNPRED ||
          t.Type == ANTLRParser.SYN_SEMPRED)
     {
         altAST.DeleteChild(0);
     }
 }
        public void StripLeftRecursion(GrammarAST altAST)
        {
            GrammarAST rref = (GrammarAST)altAST.GetChild(0);
            if (rref.Type == ANTLRParser.RULE_REF && rref.Text.Equals(ruleName))
            {
                // remove rule ref
                altAST.DeleteChild(0);

                // reset index so it prints properly
                GrammarAST newFirstChild = (GrammarAST)altAST.GetChild(0);
                altAST.TokenStartIndex = newFirstChild.TokenStartIndex;
            }
        }