Exemplo n.º 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();
		}
Exemplo n.º 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());
        }
Exemplo n.º 3
0
        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());
        }