예제 #1
0
 /// <summary>
 ///     Executes the program on the <paramref name="input" /> to obtain the output.
 /// </summary>
 /// <param name="input">The input token.</param>
 /// <returns>The result string output.</returns>
 public string RunString(MergeConflict input)
 {
     return(string.Join(
                System.Environment.NewLine,
                Run(input).Select(n => Semantics.NodeValue(n, Path))
                .Where(path => !string.IsNullOrEmpty(path))
                .Select(path => $"{Include} \"{path}\"")));
 }
예제 #2
0
        internal DisjunctiveExamplesSpec WitnessConcatTree2(GrammarRule rule, DisjunctiveExamplesSpec spec, DisjunctiveExamplesSpec tree1Spec)
        {
            var result = new Dictionary <State, IEnumerable <object> >();

            foreach (KeyValuePair <State, IEnumerable <object> > example in spec.DisjunctiveExamples)
            {
                State inputState = example.Key;
                List <IReadOnlyList <Node> > possibleCombinations = new List <IReadOnlyList <Node> >();
                foreach (IReadOnlyList <Node> tree1NodeList in tree1Spec.DisjunctiveExamples[inputState])
                {
                    IEnumerable <Node> temp = from output in example.Value
                                              from outNode in (IReadOnlyList <Node>)output
                                              where tree1NodeList.All(
                        tree1Node => Semantics.NodeValue(tree1Node, Path) != Semantics.NodeValue(outNode, Path))
                                              select outNode;
                    possibleCombinations.Add(temp.ToList());
                }

                result[inputState] = possibleCombinations;
            }

            return(DisjunctiveExamplesSpec.From(result));
        }