本文整理汇总了C#中Mono.CSharp.Report类的典型用法代码示例。如果您正苦于以下问题:C# Report类的具体用法?C# Report怎么用?C# Report使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Report类属于Mono.CSharp命名空间,在下文中一共展示了Report类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: CSharpCompiler
public CSharpCompiler()
{
CompilerSettings settings = new CompilerSettings ();
Report report = new Report (new NullReportPrinter ());
evaluator = new Evaluator (settings, report);
}
示例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;
}
}
示例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);
}
示例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();
}
示例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));
}
}
示例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;");
}
示例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;
}
示例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;");
}
示例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>> ();
}
示例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 ();
}
}
示例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);
}
示例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;
}
示例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 ();
}
}
}
示例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;
}