示例#1
0
		public static string QuickRun(IParsingService inputLang, int maxExpand, string input, params Assembly[] macroAssemblies)
		{
			var c = new LeMP.TestCompiler(MessageSink.Trace, new UString(input));
			c.Parallel = false;
			c.MaxExpansions = maxExpand;
			c.AddMacros(Assembly.GetExecutingAssembly());
			c.MacroProcessor.PreOpenedNamespaces.Add(GSymbol.Get("LeMP.Prelude"));
			c.MacroProcessor.PreOpenedNamespaces.Add(GSymbol.Get("LeMP.Prelude.Les"));
			c.MacroProcessor.PreOpenedNamespaces.Add(Loyc.LLPG.Macros.MacroNamespace);
			foreach (var assembly in macroAssemblies)
				c.AddMacros(assembly);
			using (ParsingService.PushCurrent(inputLang ?? ParsingService.Current))
			using (LNode.PushPrinter(Ecs.EcsNodePrinter.Printer))
				c.Run();
			return c.Output.ToString();
		}
示例#2
0
        public static string QuickRun(IParsingService inputLang, int maxExpand, string input, params Assembly[] macroAssemblies)
        {
            var c = new LeMP.TestCompiler(TraceMessageSink.Value, new UString(input));

            c.Parallel      = false;
            c.MaxExpansions = maxExpand;
            c.AddMacros(Assembly.GetExecutingAssembly());
            c.MacroProcessor.PreOpenedNamespaces.Add(GSymbol.Get("LeMP.Prelude"));
            c.MacroProcessor.PreOpenedNamespaces.Add(Loyc.LLPG.Macros.MacroNamespace);
            foreach (var assembly in macroAssemblies)
            {
                c.AddMacros(assembly);
            }
            using (ParsingService.SetDefault(inputLang ?? ParsingService.Default))
                using (LNode.SetPrinter(Ecs.EcsLanguageService.Value))
                    c.Run();
            return(c.Output.ToString());
        }
示例#3
0
文件: Program.cs 项目: bel-uwa/Loyc
        public static string QuickRun(IParsingService inputLang, int maxExpand, string input, params Assembly[] macroAssemblies)
        {
            var c = new LeMP.TestCompiler(MessageSink.Trace, new StringSlice(input));

            c.Parallel      = false;
            c.MaxExpansions = maxExpand;
            c.AddMacros(Assembly.GetExecutingAssembly());
            c.MacroProcessor.PreOpenedNamespaces.Add(GSymbol.Get("LeMP.Prelude"));
            c.MacroProcessor.PreOpenedNamespaces.Add(GSymbol.Get("LeMP.Prelude.Les"));
            c.MacroProcessor.PreOpenedNamespaces.Add(GSymbol.Get("Loyc.LLParserGenerator"));
            foreach (var assembly in macroAssemblies)
            {
                c.AddMacros(assembly);
            }
            using (ParsingService.PushCurrent(inputLang ?? ParsingService.Current))
                using (LNode.PushPrinter(Ecs.EcsNodePrinter.Printer))
                    c.Run();
            return(c.Output.ToString());
        }