示例#1
0
 public PGNodeSet Intersect(PGNodeSet other, bool subtract = false, bool subtractThis = false)
 {
     if (subtractThis)
     {
         Debug.Assert(!subtract);
         return(other.Intersect(this, true));
     }
     else
     {
         return(new PGNodeSet(base.Intersect(other, subtract)));
     }
 }
示例#2
0
        public override Pred CodeToPred(LNode expr, ref string errorMsg)
        {
            Debug.Assert(!expr.IsIdNamed(EOF.Name) || expr.Equals(EOF));
            if (expr.IsCall && expr.Name != S.Dot && expr.Name != S.Of)
            {
                errorMsg = "Unrecognized expression. Treating this as a terminal: " + expr.ToString();                 // warning
            }
            expr = ResolveAlias(expr);

            PGNodeSet set;

            if (expr.IsIdNamed(_underscore))
            {
                set = PGNodeSet.AllExceptEOF;
            }
            else
            {
                set = new PGNodeSet(expr);
            }
            return(new TerminalPred(expr, set, true));
        }
示例#3
0
        public override Pred CodeToTerminalPred(LNode expr, ref string errorMsg)
        {
            Debug.Assert(!expr.IsIdNamed(EOF.Name) || expr.Equals(EOF));
            if (expr.IsCall && expr.Name != S.Dot && expr.Name != S.Of)
            {
                errorMsg = "Unrecognized expression. Treating this as a terminal: " + expr.ToString();                 // warning
            }
            var expr2 = ResolveAlias(expr);

            PGNodeSet set;

            if (expr2.IsIdNamed(_underscore))
            {
                set = PGNodeSet.AllExceptEOF;
            }
            else
            {
                set = new PGNodeSet(expr2);
            }
            // bug fix 2015-07: must use expr, not expr2, as TerminalPred's Basis
            // (wrong Basis breaks error locations, and $A in code blocks if A is an alias)
            return(new TerminalPred(expr, set, true));
        }