Esempio n. 1
0
        public static void GetParseTreeTest()
        {
            var executingAssembly = Assembly.GetExecutingAssembly();

            Stream stream = null;

            try {
                stream = executingAssembly.GetManifestResourceStream(@"SharpGraph.TestExamples.example.gv");
                Assert.IsTrue(stream != null);
                using (var reader = new StreamReader(stream)) {
                    stream = null;
                    try {
                        DotParserHelper.GetParseTree(reader);
                    } catch (Exception e) {
                        Assert.Fail(e.Message);
                    }
                }
            } finally {
                stream?.Dispose();
            }
        }
Esempio n. 2
0
        public static IGraph GetGraph(TextReader reader)
        {
            var tree = DotParserHelper.GetParseTree(reader);

            return(new GraphVisitor().Visit(tree));
        }