本文整理汇总了C#中Mono.CSharp.ReportPrinter类的典型用法代码示例。如果您正苦于以下问题:C# ReportPrinter类的具体用法?C# ReportPrinter怎么用?C# ReportPrinter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReportPrinter类属于Mono.CSharp命名空间,在下文中一共展示了ReportPrinter类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Report
public Report (ReportPrinter printer)
{
if (printer == null)
throw new ArgumentNullException ("printer");
this.printer = printer;
warning_level = 4;
}
示例2: Create
public static Driver Create (string[] args, bool require_files, ReportPrinter printer)
{
Driver d = new Driver (new CompilerContext (new Report (printer)));
if (!d.ParseArguments (args, require_files))
return null;
return d;
}
示例3: Create
public static Driver Create (string[] args, bool require_files, Func<string [], int, int> unknown_option_parser, ReportPrinter printer)
{
Driver d = new Driver (new CompilerContext (new Report (printer)));
if (!d.ParseArguments (args, require_files, unknown_option_parser))
return null;
return d;
}
示例4: Report
public Report (CompilerContext context, ReportPrinter printer)
{
if (context == null)
throw new ArgumentNullException ("settings");
if (printer == null)
throw new ArgumentNullException ("printer");
this.settings = context.Settings;
this.printer = printer;
}
示例5: 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 ();
}
}
}
示例6: MCSCompiler
public MCSCompiler(string assemblyFileName, ReportPrinter reporter)
{
// Загружаем сборку компилятора
_dmcsAssembly = Assembly.LoadFile(assemblyFileName);
// Пробуем получить тип драйвера компиляции
_driverType = ReflectionUtils.ExtractTypeByName(_dmcsAssembly, "Mono.CSharp.Driver");
// Если не удалось
if (_driverType == null)
{
SuccessfulCreated = false;
throw new ClassDriverNotFoundException(String.Format("В сборке \"{0}\" не найден тип драйвера компиляции", assemblyFileName));
}
SuccessfulCreated = true;
_reporter = reporter;
}
示例7: 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;
Location.AddFile (null, inputFile);
Location.Initialize ();
// TODO: encoding from driver
SeekableStreamReader reader = new SeekableStreamReader (input, Encoding.Default);
CompilerContext ctx = new CompilerContext (new Report (reportPrinter));
RootContext.ToplevelTypes = new ModuleContainer (ctx);
CompilationUnit unit = null;
try {
unit = (CompilationUnit) Location.SourceFiles [0];
} catch (Exception) {
string path = Path.GetFullPath (inputFile);
unit = new CompilationUnit (inputFile, path, 0);
}
CSharpParser parser = new CSharpParser (reader, unit, RootContext.ToplevelTypes);
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 };
} finally {
Reset ();
}
}
}
示例8: CompilerContext
public CompilerContext (CompilerSettings settings, ReportPrinter reportPrinter)
{
this.settings = settings;
this.report = new Report (this, reportPrinter);
this.builtin_types = new BuiltinTypes ();
this.TimeReporter = DisabledTimeReporter;
}
示例9: Merge
//
// Prints collected messages, common messages have a priority
//
public bool Merge (ReportPrinter dest)
{
ArrayList messages_to_print = merged_messages;
if (common_messages != null && common_messages.Count > 0) {
messages_to_print = common_messages;
}
if (messages_to_print == null)
return false;
foreach (AbstractMessage msg in messages_to_print)
dest.Print (msg);
return true;
}
示例10: SetPrinter
public ReportPrinter SetPrinter (ReportPrinter printer)
{
ReportPrinter old = this.printer;
this.printer = printer;
return old;
}
示例11: SetPrinter
internal static ReportPrinter SetPrinter (ReportPrinter report_printer)
{
return ctx.Report.SetPrinter (report_printer);
}
示例12: Merge
//
// Prints collected messages, common messages have a priority
//
public bool Merge (ReportPrinter dest)
{
var messages_to_print = merged_messages;
if (common_messages != null && common_messages.Count > 0) {
messages_to_print = common_messages;
}
if (messages_to_print == null)
return false;
bool error_msg = false;
foreach (AbstractMessage msg in messages_to_print) {
dest.Print (msg);
error_msg |= !msg.IsWarning;
}
return error_msg;
}
示例13: Merge
//
// Prints collected messages, common messages have a priority
//
public bool Merge (ReportPrinter dest)
{
var messages_to_print = merged_messages;
if (common_messages != null && common_messages.Count > 0) {
messages_to_print = common_messages;
}
if (messages_to_print == null)
return false;
bool error_msg = false;
foreach (AbstractMessage msg in messages_to_print) {
dest.Print (msg, showFullPaths);
error_msg |= !msg.IsWarning;
}
if (reported_missing_definitions != null) {
foreach (var missing in reported_missing_definitions)
dest.MissingTypeReported (missing);
}
return error_msg;
}