public override int VisitCompileUnit(MINICParser.CompileUnitContext context)
        {
            CASTCompileUnit newnode = new CASTCompileUnit(context.GetText(), null, 2);

            m_root = newnode;
            m_parents.Push(newnode);
            this.VisitElementsInContext(context.statement(), m_parentContext, contextType.CT_COMPILEUNIT_MAINBODY);
            this.VisitElementsInContext(context.functionDefinition(), m_parentContext, contextType.CT_COMPILEUNIT_FUNCTIONDEFINITIONS);
            m_parents.Pop();
            return(0);
        }
Beispiel #2
0
        public override int VisitCOMPILEUNIT(CASTCompileUnit node, object param)
        {
            m_ostream.WriteLine("digraph {");

            ExtractSubgraphs(node, contextType.CT_COMPILEUNIT_MAINBODY);
            ExtractSubgraphs(node, contextType.CT_COMPILEUNIT_FUNCTIONDEFINITIONS);

            base.VisitCOMPILEUNIT(node);

            m_ostream.WriteLine("}");
            m_ostream.Close();

            // Prepare the process to run
            ProcessStartInfo start = new ProcessStartInfo();

            // Enter in the command line arguments, everything you would enter after the executable name itself
            start.Arguments = "-Tgif " + m_dotName + " -o" + m_dotName + ".gif";
            // Enter the executable to run, including the complete path
            start.FileName = "dot";
            // Do you want to show a console window?
            start.WindowStyle    = ProcessWindowStyle.Hidden;
            start.CreateNoWindow = true;
            int exitCode;


            // Run the external process & wait for it to finish
            using (Process proc = Process.Start(start))
            {
                proc.WaitForExit();

                // Retrieve the app's exit code
                exitCode = proc.ExitCode;
            }

            return(0);
        }
 public virtual Result VisitCOMPILEUNIT(CASTCompileUnit node, VParam param = default(VParam))
 {
     VisitChildren(node, param);
     return(default(Result));
 }