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));
        }
Exemple #4
0
        public XSolverResult GetValue(XTokenRefId token)
        {
            var refId = token.Data as string;

            if (string.IsNullOrEmpty(refId))
            {
                return(XSolverResult.FromData(null));
            }

            object value;

            this._bag.TryGetValue(refId, out value);
            return(XSolverResult.FromData(value));
        }
        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 #6
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));
        }
Exemple #7
0
 public override XSolverResult Resolve(IXSolverContext context, XTreeNodeBase na, XTreeNodeBase nb, XTreeNodeBase nc)
 {
     return(XSolverResult.FromData(this.Data));
 }