Beispiel #1
0
        protected bool Equals(MagicK other)
        {
            var wildCard = new Wildcard(_target.InnerNode.GetType().Name);
            var pattern  = new Pattern(wildCard, 0, new AbsolutePath(0));

            return(Equals(GetK(pattern), other.GetK(pattern)));
        }
Beispiel #2
0
        public static ExampleSpec WitnessK(GrammarRule rule, int parameter, ExampleSpec spec, ExampleSpec patternSpec)
        {
            var result = new Dictionary <State, object>();

            foreach (var input in spec.ProvidedInputs)
            {
                var inp     = (PythonNode)input[rule.Body[0]];
                var pattern = patternSpec.Examples[input] as Pattern;
                var node    = spec.Examples[input] as PythonNode;
                if (pattern != null && node != null)
                {
                    var magicK = new MagicK(inp, node);
                    var k      = magicK.GetK(pattern);
                    result[input] = k;
                }
                else
                {
                    return(null);
                }
            }
            return(new ExampleSpec(result));
        }