Exemple #1
0
        public object PrecedenceTesting(string expression)
        {
            IParser parser = Factory.Instance.Create();
            IToken  token  = parser.Compile(expression);

            return(token.EvalValue(null));
        }
Exemple #2
0
        public void ParsingFailure(string expression, Type errType)
        {
            TestDelegate handler = new TestDelegate(() => {
                IParser parser = Factory.Instance.Create();
                IToken token   = parser.Compile(expression);
                token.EvalValue(null);
            });

            Assert.Throws(errType, handler);
        }
        public object StringLiteralEvalTest(string text, int start, string className)
        {
            IToken token = (IToken)Activator.CreateInstance(Type.GetType(className));
            int    next;

            if (token.Match(text, start, out next))
            {
                return(token.EvalValue(null));
            }
            else
            {
                return(null);
            }
        }
Exemple #4
0
 public object Eval(IToken token, Func <string, object> context)
 {
     return(token.EvalValue(context));
 }
Exemple #5
0
 public object Eval(IToken token, Func<string, object> context)
 {
     return token.EvalValue(context);
 }