• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CSharp.Report类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Mono.CSharp.Report的典型用法代码示例。如果您正苦于以下问题:C# Report类的具体用法?C# Report怎么用?C# Report使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Report类属于Mono.CSharp命名空间,在下文中一共展示了Report类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Shell

		public Shell(MainWindow container) : base()
		{
			this.container = container;
			WrapMode = WrapMode.Word;
			CreateTags ();

			Pango.FontDescription font_description = new Pango.FontDescription();
			font_description.Family = "Monospace";
			ModifyFont(font_description);
			
			TextIter end = Buffer.EndIter;
			Buffer.InsertWithTagsByName (ref end, "Mono C# Shell, type 'help;' for help\n\nEnter statements or expressions below.\n", "Comment");
			ShowPrompt (false);
			
			report = new Report (new ConsoleReportPrinter ());
			evaluator = new Evaluator (new CompilerSettings (), report);
			evaluator.DescribeTypeExpressions = true;
			
			evaluator.InteractiveBaseClass = typeof (InteractiveGraphicsBase);
			evaluator.Run ("LoadAssembly (\"System.Drawing\");");
			evaluator.Run ("using System; using System.Linq; using System.Collections; using System.Collections.Generic; using System.Drawing;");

			if (!MainClass.Debug){
				GuiStream error_stream = new GuiStream ("Error", (x, y) => Output (x, y));
				StreamWriter gui_output = new StreamWriter (error_stream);
				gui_output.AutoFlush = true;
				Console.SetError (gui_output);

				GuiStream stdout_stream = new GuiStream ("Stdout", (x, y) => Output (x, y));
				gui_output = new StreamWriter (stdout_stream);
				gui_output.AutoFlush = true;
				Console.SetOut (gui_output);
			}
		}
开发者ID:krijesta,项目名称:mono-tools,代码行数:34,代码来源:Shell.cs


示例2: CSharpCompiler

        public CSharpCompiler()
        {
            CompilerSettings settings = new CompilerSettings ();
            Report report = new Report (new NullReportPrinter ());

            evaluator = new Evaluator (settings, report);
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:7,代码来源:CSharpCompiler.cs


示例3: GetDocCommentNode

		private static XmlNode GetDocCommentNode (MemberCore mc,
			string name, Report Report)
		{
			// FIXME: It could be even optimizable as not
			// to use XmlDocument. But anyways the nodes
			// are not kept in memory.
			XmlDocument doc = RootContext.Documentation.XmlDocumentation;
			try {
				XmlElement el = doc.CreateElement ("member");
				el.SetAttribute ("name", name);
				string normalized = mc.DocComment;
				el.InnerXml = normalized;
				// csc keeps lines as written in the sources
				// and inserts formatting indentation (which 
				// is different from XmlTextWriter.Formatting
				// one), but when a start tag contains an 
				// endline, it joins the next line. We don't
				// have to follow such a hacky behavior.
				string [] split =
					normalized.Split ('\n');
				int j = 0;
				for (int i = 0; i < split.Length; i++) {
					string s = split [i].TrimEnd ();
					if (s.Length > 0)
						split [j++] = s;
				}
				el.InnerXml = line_head + String.Join (
					line_head, split, 0, j);
				return el;
			} catch (Exception ex) {
				Report.Warning (1570, 1, mc.Location, "XML comment on `{0}' has non-well-formed XML ({1})", name, ex.Message);
				XmlComment com = doc.CreateComment (String.Format ("FIXME: Invalid documentation markup was found for member {0}", name));
				return com;
			}
		}
开发者ID:kumpera,项目名称:mono,代码行数:35,代码来源:doc.cs


示例4: GenerateDocComment

        //
        // Fixes full type name of each documented types/members up.
        //
        public void GenerateDocComment(Report r)
        {
            TypeContainer root = RootContext.ToplevelTypes;

            if (root.Types != null)
                foreach (TypeContainer tc in root.Types)
                    DocUtil.GenerateTypeDocComment (tc, null, r);
        }
开发者ID:speier,项目名称:shake,代码行数:11,代码来源:doc.cs


示例5: Parse

        public static void Parse(SeekableStreamReader reader, SourceFile sourceFile, ModuleContainer module, ParserSession session, Report report)
        {
            var file = new CompilationSourceFile(module, sourceFile);
            module.AddTypeContainer(file);

            CSharpParser parser = new CSharpParser(reader, file, report, session);
            parser.parse();
        }
开发者ID:Nystul-the-Magician,项目名称:daggerfall-unity,代码行数:8,代码来源:CustomDynamicDriver.cs


示例6: Error_InvalidConstantType

 public static void Error_InvalidConstantType(TypeSpec t, Location loc, Report Report)
 {
     if (t.IsGenericParameter) {
         Report.Error (1959, loc,
             "Type parameter `{0}' cannot be declared const", TypeManager.CSharpName (t));
     } else {
         Report.Error (283, loc,
             "The type `{0}' cannot be declared const", TypeManager.CSharpName (t));
     }
 }
开发者ID:speier,项目名称:shake,代码行数:10,代码来源:const.cs


示例7: Runner

        /// <summary>
        /// Initializes the evaluator and includes a few basic System libraries
        /// </summary>
        public Runner()
        {
            _report   = new Report(new Printer(this));
            _settings = new CommandLineParser(_report).ParseArguments(new string[] {});
            _eval     = new Evaluator(_settings, _report);

            _eval.Run("using System;");
            _eval.Run("using System.Linq;");
            _eval.Run("using System.Collections.Generic;");
        }
开发者ID:RainsSoft,项目名称:MonoCompilerAsAService,代码行数:13,代码来源:Runner.cs


示例8: GenerateCode

		public static void GenerateCode (ModuleContainer module, ParserSession session, Report report)
		{
			GenerateDynamicPartialClasses(module, session, report);
			if (report.Errors > 0)
				return;

			GenerateEmbedClasses(module, session, report);
			if (report.Errors > 0)
				return;

		}
开发者ID:rlfqudxo,项目名称:playscript-mono,代码行数:11,代码来源:ps-codegen.cs


示例9: Runner

        /// <summary>
        /// Initializes the evaluator and includes a few basic System libraries
        /// </summary>
        public Runner()
        {
            _report = new Report(new Printer(this));
            _settings = new CommandLineParser(_report).ParseArguments (new string[] {});
            _eval = new Evaluator(_settings, _report);

            _eval.ReferenceAssembly(typeof(System.Linq.Enumerable).Assembly);

            _eval.Run("using System;");
            _eval.Run("using System.Collections.Generic;");
            _eval.Run("using System.Linq;");
        }
开发者ID:jorik041,项目名称:runcs,代码行数:15,代码来源:Runner.cs


示例10: Evaluator

		public Evaluator (CompilerSettings settings, Report report)
		{
			ctx = new CompilerContext (settings, report);

			module = new ModuleContainer (ctx);
			module.Evaluator = this;

			// FIXME: Importer needs this assembly for internalsvisibleto
			module.SetDeclaringAssembly (new AssemblyDefinitionDynamic (module, "evaluator"));
			importer = new ReflectionImporter (module, ctx.BuildinTypes);

			InteractiveBaseClass = typeof (InteractiveBase);
			fields = new Dictionary<string, Tuple<FieldSpec, FieldInfo>> ();
		}
开发者ID:famousthom,项目名称:monodevelop,代码行数:14,代码来源:eval.cs


示例11: InvokeCompiler

        public static bool InvokeCompiler(string [] args, TextWriter error)
        {
            try {
                var r = new Report (new StreamReportPrinter (error));
                CommandLineParser cmd = new CommandLineParser (r, error);
                var setting = cmd.ParseArguments (args);
                if (setting == null || r.Errors > 0)
                    return false;

                var d = new Driver (new CompilerContext (setting, r));
                return d.Compile ();
            } finally {
                Reset ();
            }
        }
开发者ID:RainsSoft,项目名称:MonoCompilerAsAService,代码行数:15,代码来源:driver.cs


示例12: GenerateTypeDocComment

		// TypeContainer

		//
		// Generates xml doc comments (if any), and if required,
		// handle warning report.
		//
		internal static void GenerateTypeDocComment (TypeContainer t,
			DeclSpace ds, Report Report)
		{
			GenerateDocComment (t, ds, Report);

			if (t.DefaultStaticConstructor != null)
				t.DefaultStaticConstructor.GenerateDocComment (t);

			if (t.InstanceConstructors != null)
				foreach (Constructor c in t.InstanceConstructors)
					c.GenerateDocComment (t);

			if (t.Types != null)
				foreach (TypeContainer tc in t.Types)
					tc.GenerateDocComment (t);

			if (t.Delegates != null)
				foreach (Delegate de in t.Delegates)
					de.GenerateDocComment (t);

			if (t.Constants != null)
				foreach (Const c in t.Constants)
					c.GenerateDocComment (t);

			if (t.Fields != null)
				foreach (FieldBase f in t.Fields)
					f.GenerateDocComment (t);

			if (t.Events != null)
				foreach (Event e in t.Events)
					e.GenerateDocComment (t);

			if (t.Indexers != null)
				foreach (Indexer ix in t.Indexers)
					ix.GenerateDocComment (t);

			if (t.Properties != null)
				foreach (Property p in t.Properties)
					p.GenerateDocComment (t);

			if (t.Methods != null)
				foreach (MethodOrOperator m in t.Methods)
					m.GenerateDocComment (t);

			if (t.Operators != null)
				foreach (Operator o in t.Operators)
					o.GenerateDocComment (t);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:54,代码来源:doc.cs


示例13: Check

        // <summary>
        //   Checks the object @mod modifiers to be in @allowed.
        //   Returns the new mask.  Side effect: reports any
        //   incorrect attributes.
        // </summary>
        public static Modifiers Check(Modifiers allowed, Modifiers mod, Modifiers def_access, Location l, Report Report)
        {
            int invalid_flags = (~(int) allowed) & ((int) mod & ((int) Modifiers.TOP - 1));
            int i;

            if (invalid_flags == 0){

                if ((mod & Modifiers.UNSAFE) != 0){
                    RootContext.CheckUnsafeOption (l, Report);
                }

                //
                // If no accessibility bits provided
                // then provide the defaults.
                //
                if ((mod & Modifiers.AccessibilityMask) == 0) {
                    mod |= def_access;
                    if (def_access != 0)
                        mod |= Modifiers.DEFAULT_ACCESS_MODIFER;
                    return mod;
                }

                //
                // Make sure that no conflicting accessibility
                // bits have been set.  Protected+Internal is
                // allowed, that is why they are placed on bits
                // 1 and 4 (so the shift 3 basically merges them)
                //
                int a = (int) mod;
                a &= 15;
                a |= (a >> 3);
                a = ((a & 2) >> 1) + (a & 5);
                a = ((a & 4) >> 2) + (a & 3);
                if (a > 1)
                    Report.Error (107, l, "More than one protection modifier specified");

                return mod;
            }

            for (i = 1; i <= (int) Modifiers.TOP; i <<= 1) {
                if ((i & invalid_flags) == 0)
                    continue;

                Error_InvalidModifier (l, Name ((Modifiers) i), Report);
            }

            return allowed & mod;
        }
开发者ID:speier,项目名称:shake,代码行数:53,代码来源:modifiers.cs


示例14: ParseFile

        public static CompilerCompilationUnit ParseFile(string[] args, Stream input, string inputFile, ReportPrinter reportPrinter)
        {
            lock (parseLock) {
                try {
                    //                                     Driver d = Driver.Create (args, false, null, reportPrinter);
                    //                                     if (d == null)
                    //                                             return null;

                    var r = new Report (reportPrinter);
                    CommandLineParser cmd = new CommandLineParser (r, Console.Out);
                    var setting = cmd.ParseArguments (args);
                    if (setting == null || r.Errors > 0)
                        return null;
                    setting.Version = LanguageVersion.V_5;

                    CompilerContext ctx = new CompilerContext (setting, r);

                    var files = new List<CompilationSourceFile> ();
                    var unit = new CompilationSourceFile (inputFile, inputFile, 0);
                    var module = new ModuleContainer (ctx);
                    unit.NamespaceContainer = new NamespaceContainer (null, module, null, unit);
                    files.Add (unit);
                    Location.Initialize (files);

                    // TODO: encoding from driver
                    SeekableStreamReader reader = new SeekableStreamReader (input, Encoding.UTF8);

                    RootContext.ToplevelTypes = module;

                    CSharpParser parser = new CSharpParser (reader, unit);
                    parser.Lexer.TabSize = 1;
                    parser.Lexer.sbag = new SpecialsBag ();
                    parser.LocationsBag = new LocationsBag ();
                    parser.UsingsBag = new UsingsBag ();
                    parser.parse ();

                    return new CompilerCompilationUnit () {
                        ModuleCompiled = RootContext.ToplevelTypes,
                        LocationsBag = parser.LocationsBag,
                        UsingsBag = parser.UsingsBag,
                        SpecialsBag = parser.Lexer.sbag,
                        LastYYValue = parser.LastYYVal
                    };
                } finally {
                    Reset ();
                }
            }
        }
开发者ID:holmak,项目名称:NRefactory,代码行数:48,代码来源:driver.cs


示例15: CreateContext

        private CompilerContext CreateContext([NotNull] string source)
        {
            var settings = new CompilerSettings
            {
                Target = Target.Library,
                TargetExt = ".dll",
                LoadDefaultReferences = true,
                ShowFullPaths = false,
                StdLib = true,
            };

            var context = new CompilerContext(settings, new ConsoleReportPrinter(_logger));
            context.SourceFiles.Add(new SourceFile("Source", source, 0));

            _report = new Report(context, new ConsoleReportPrinter(_logger));

            return context;
        }
开发者ID:Tauron1990,项目名称:Radio-Streamer,代码行数:18,代码来源:StyleScriptCompiler.cs


示例16: evaluateCode

        // This method evaluates the given code and returns a CompilerOutput object
        public static CompilerOutput evaluateCode(string code)
        {
            CompilerOutput compilerOutput = new CompilerOutput ();
            /*
            var compilerContext = new CompilerContext(new CompilerSettings(), new ConsoleReportPrinter());

            var evaluator = new Evaluator(compilerContext);
            */
            var reportWriter = new StringWriter();
            var settings = new CompilerSettings();
            var printer = new ConsoleReportPrinter(reportWriter);

            var compilerContext = new CompilerContext (settings, printer);
            var reports = new Report(compilerContext, printer);
            var evaluator = new Evaluator(compilerContext);

            var myString = "";
            originalConsoleOut_global = Console.Out; // preserve the original stream
            using(var writer = new StringWriter())
            {
                Console.SetOut(writer);

                evaluator.Run (code);
                evaluator.Run ("MainClass m1 = new MainClass(); m1.Main();");

                //bConsole.WriteLine ("after executing code");

                if (reports.Errors > 0) {
                    Console.WriteLine ("reportWriter.ToString: \n" + reportWriter.ToString ());
                    compilerOutput.errors = reportWriter.ToString ();
                }

                writer.Flush(); // make sure everything is written out of consule

                myString = writer.GetStringBuilder().ToString();

                compilerOutput.consoleOut = myString;

            }

            Console.SetOut(originalConsoleOut_global); // restore Console.Out

            return compilerOutput;
        }
开发者ID:sameli,项目名称:online-compiler,代码行数:45,代码来源:MonoCompiler.aspx.cs


示例17: Evaluator

		public Evaluator (CompilerSettings settings, Report report)
		{
			ctx = new CompilerContext (settings, report);

			module = new ModuleContainer (ctx);
			module.Evaluator = this;

			source_file = new CompilationSourceFile ("{interactive}", "", 1);
 			source_file.NamespaceContainer = new NamespaceContainer (null, module, null, source_file);

			ctx.SourceFiles.Add (source_file);

			// FIXME: Importer needs this assembly for internalsvisibleto
			module.SetDeclaringAssembly (new AssemblyDefinitionDynamic (module, "evaluator"));
			importer = new ReflectionImporter (module, ctx.BuiltinTypes);

			InteractiveBaseClass = typeof (InteractiveBase);
			fields = new Dictionary<string, Tuple<FieldSpec, FieldInfo>> ();
		}
开发者ID:constructor-igor,项目名称:cudafy,代码行数:19,代码来源:eval.cs


示例18: Bind

		public static DynamicMetaObject Bind (DynamicMetaObject target, Compiler.Expression expr, BindingRestrictions restrictions, DynamicMetaObject errorSuggestion)
		{
			var report = new Compiler.Report (ErrorPrinter.Instance) { WarningLevel = 0 };
			var ctx = new Compiler.CompilerContext (report);
			Compiler.RootContext.ToplevelTypes = new Compiler.ModuleContainer (ctx, true);

			InitializeCompiler (ctx);

			Expression res;
			try {
				// TODO: ResolveOptions
				Compiler.ResolveContext rc = new Compiler.ResolveContext (new RuntimeBinderContext (ctx));

				// Static typemanager and internal caches are not thread-safe
				lock (resolver) {
					expr = expr.Resolve (rc);
				}

				if (expr == null)
					throw new RuntimeBinderInternalCompilerException ("Expression resolved to null");

				res = expr.MakeExpression (new Compiler.BuilderContext ());
			} catch (RuntimeBinderException e) {
				if (errorSuggestion != null)
					return errorSuggestion;

				if (binder_exception_ctor == null)
					binder_exception_ctor = typeof (RuntimeBinderException).GetConstructor (new[] { typeof (string) });

				//
				// Uses target type to keep expressions composition working
				//
				res = Expression.Throw (Expression.New (binder_exception_ctor, Expression.Constant (e.Message)), target.LimitType);
			} catch (Exception) {
				if (errorSuggestion != null)
					return errorSuggestion;

				throw;
			}

			return new DynamicMetaObject (res, restrictions);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:42,代码来源:CSharpBinder.cs


示例19: ClearSession

        public void ClearSession(Action callback = null)
        {
            ThreadPool.QueueUserWorkItem((o) =>
            {
                _errors = new List<string>();
                _warnings = new List<string>();

                var report = new Report(new Printer(msg => _errors.Add(msg.Text), msg => _warnings.Add(msg.Text)));
                var settings = new CommandLineParser(report).ParseArguments(new string[] { });
                _eval = new Evaluator(settings, report);

                foreach (string @namespace in Options.DefaultNamespaces)
                {
                    addUsing(@namespace);
                }

                if (callback != null)
                    callback();
            });
        }
开发者ID:jorik041,项目名称:CSharpToGo,代码行数:20,代码来源:Runner.cs


示例20: Create

        public IController Create(RequestContext requestContext, Type controllerType)
        {
            CompilerSettings settings = new CompilerSettings();
            Report report = new Report(new ConsoleReportPrinter());
            Evaluator eval = new Evaluator(settings, report);

            object instance = null;
            bool instanceCreated = false;
            eval.ReferenceAssembly(typeof(Controller).Assembly);

            foreach (Assembly assembly in assemblies)
            {
                eval.ReferenceAssembly(assembly);
            }

            string controllerName = GetControllerName(requestContext, controllerType);
            string path = pathProvider.GetPath(requestContext, controllerName);
            CSharpControllerFile controllerFile = CSharpControllerFile.Parse(File.ReadAllText(path));

            eval.Run(controllerFile.ClassSource);
            eval.Evaluate("new " + controllerName + "();", out instance, out instanceCreated);

            return (IController)instance;
        }
开发者ID:friism,项目名称:RuntimeControllerFactory,代码行数:24,代码来源:RuntimeControllerActivator.cs



注:本文中的Mono.CSharp.Report类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CSharp.ReportPrinter类代码示例发布时间:2022-05-26
下一篇:
C# CSharp.QualifiedAliasMember类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap