public override XSolverResult Resolve(IXSolverContext context, XTreeNodeBase na, XTreeNodeBase nb, XTreeNodeBase nc)
        {
            XSolverResult sra = na.Resolve(context);

            if (sra.Error != null)
            {
                return(sra);
            }

            XSolverResult srb = nb.Resolve(context);

            if (srb.Error != null)
            {
                return(srb);
            }

            var s = sra.Data as string;

            if (s == null)
            {
                return(XSolverResult.FromData(false));
            }

            var re = srb.Data as Regex;

            if (re == null)
            {
                return(XSolverResult.FromData(false));
            }

            Match match = re.Match(s);

            return(XSolverResult.FromData(match.Success));
        }
Exemple #2
0
 public override XSolverResult Resolve(IXSolverContext context, XTreeNodeBase na, XTreeNodeBase nb, XTreeNodeBase nc)
 {
     if (context.ReferenceSolver == null)
     {
         return(XSolverResult.FromData(null));
     }
     return(context.ReferenceSolver.GetValue(this));
 }
        public override XSolverResult Resolve(IXSolverContext context, XTreeNodeBase na, XTreeNodeBase nb, XTreeNodeBase nc)
        {
            XSolverResult result = na.Resolve(context);

            if (result.Error != null)
            {
                return(result);
            }
            bool value = XSolverHelpers.AsBool(result.Data);

            return(XSolverResult.FromData(value == false));
        }
        public override XSolverResult Resolve(IXSolverContext context, XTreeNodeBase na, XTreeNodeBase nb, XTreeNodeBase nc)
        {
            XSolverResult sra = na.Resolve(context);

            if (sra.Error != null)
            {
                return(sra);
            }

            XSolverResult srb = nb.Resolve(context);

            if (srb.Error != null)
            {
                return(srb);
            }

            bool value = XSolverHelpers.Match(sra.Data, srb.Data);

            return(XSolverResult.FromData(value));
        }
Exemple #5
0
        public override XSolverResult Resolve(IXSolverContext context, XTreeNodeBase na, XTreeNodeBase nb, XTreeNodeBase nc)
        {
            var pattern = this.Data as string;

            if (pattern == null)
            {
                return(XSolverResult.FromData(null));
            }

            var          flags   = this.Flags ?? string.Empty;
            RegexOptions options = RegexOptions.None;

            if (flags.Contains('i'))
            {
                options |= RegexOptions.IgnoreCase;
            }

            var re = new Regex(pattern, options);

            return(XSolverResult.FromData(re));
        }
 public abstract XSolverResult Resolve(IXSolverContext context, XTreeNodeBase na, XTreeNodeBase nb, XTreeNodeBase nc);
 public override XSolverResult Resolve(IXSolverContext context, XTreeNodeBase na, XTreeNodeBase nb, XTreeNodeBase nc)
 {
     throw new NotImplementedException();
 }
Exemple #8
0
 public override XSolverResult Resolve(IXSolverContext context)
 {
     return(this.Token.Resolve(context, this.LeftChild, this.RightChild, null));
 }
Exemple #9
0
 public override XSolverResult Resolve(IXSolverContext context)
 {
     return(this.Token.Resolve(context, null, null, null));
 }
Exemple #10
0
 public abstract XSolverResult Resolve(IXSolverContext context);
Exemple #11
0
 public override XSolverResult Resolve(IXSolverContext context, XTreeNodeBase na, XTreeNodeBase nb, XTreeNodeBase nc)
 {
     return(XSolverResult.FromData(this.Data));
 }