Exemplo n.º 1
0
        public static BaseExpression ExpressionAttributeValue(this XElement el, ParsingEnvironment env, string attributeName)
        {
            XAttribute attr = el.Attribute(attributeName);

            if (attr is null)
            {
                throw new FileLoadException(el, $"Missing {attributeName} attribute");
            }
            try
            {
                return(MyExpressionParser.Parse(env, attr.Value));
            }
            catch (Exception ex)
            {
                throw new FileLoadException(attr, "Failed to parse ValueExpr", ex);
            }
        }
Exemplo n.º 2
0
        static void ValidateParse(string input, BaseExpression expectedParse)
        {
            var actual = MyExpressionParser.Parse(null, input);

            Assert.AreEqual(expectedParse, actual, $"\nFrom input '{input}'\nexpected:\n{expectedParse}\nactual:\n{actual}");
        }