Пример #1
0
        static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                System.Console.WriteLine("Syntax: model2mbed <a.xml> <outdir> [template1 [template2 ...]]");
                System.Console.WriteLine("Syntax: model2mbed <a.xml> <outdir> <@template.lst>");
                return;
            }

            try
            {
                List <string> templates = new List <string>();
                for (int i = 2; i < args.Length; ++i)
                {
                    if (args[i].StartsWith("@"))
                    {
                        templates.AddRange(File.ReadAllLines(args[i].Substring(1)).Where(s => !string.IsNullOrWhiteSpace(s)));
                    }
                    else
                    {
                        templates.Add(args[i]);
                    }
                }
                Model m = UPAALParser.Parse(args[0], templates);
                ReferenceOptimizer.cleanup(m);
                Generator g = new Generator(m);
                g.generate(args[1]);
            }
            catch (Exception e)
            {
                System.Console.WriteLine("Error: " + e.Message);
                System.Console.WriteLine("At:");
                System.Console.WriteLine(e.StackTrace);
            }
        }
Пример #2
0
        public static Model Parse(string path, IEnumerable <string> templates)
        {
            UPAALParser parser = new UPAALParser(templates);

            return(parser.run(path));
        }