mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
Add -warnings
This commit is contained in:
parent
050c8b4967
commit
12d02666e3
@ -30,6 +30,8 @@ namespace RusticiSoftware.Translator.CSharp
|
||||
|
||||
public int DebugLevel { get; set; }
|
||||
|
||||
public bool Warnings { get; set; }
|
||||
|
||||
public CS2JSettings ()
|
||||
{
|
||||
|
||||
@ -54,6 +56,7 @@ namespace RusticiSoftware.Translator.CSharp
|
||||
EnumDir = Path.Combine(Directory.GetCurrentDirectory(), "enums");
|
||||
Verbosity = 0;
|
||||
DebugLevel = 0;
|
||||
Warnings = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ namespace RusticiSoftware.Translator.CSharp
|
||||
OptionSet p = new OptionSet ()
|
||||
.Add ("v", v => cfg.Verbosity++)
|
||||
.Add ("debug=", v => cfg.DebugLevel = Int32.Parse(v))
|
||||
.Add ("warnings", v => cfg.Warnings = true)
|
||||
.Add ("version", v => showVersion())
|
||||
.Add ("help|h|?", v => showUsage())
|
||||
.Add ("dumpcsharp", v => cfg.DumpCSharp = true)
|
||||
@ -236,7 +237,8 @@ namespace RusticiSoftware.Translator.CSharp
|
||||
{
|
||||
|
||||
TemplateExtracter templateWalker = new TemplateExtracter(csTree);
|
||||
templateWalker.compilation_unit(cfg);
|
||||
templateWalker.Filename = fullName;
|
||||
templateWalker.compilation_unit(cfg, AppEnv);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,11 +10,18 @@ namespace RusticiSoftware.Translator.CSharp
|
||||
public class CommonWalker : TreeParser
|
||||
{
|
||||
protected CS2JSettings Cfg { get; set; }
|
||||
public string Filename { get; set; }
|
||||
|
||||
protected CommonWalker(ITreeNodeStream input, RecognizerSharedState state)
|
||||
: base(input, state)
|
||||
{ }
|
||||
|
||||
protected void Warning(String s)
|
||||
{
|
||||
if (Cfg.Warnings)
|
||||
Console.Out.WriteLine("{0} WARNING: {1}", Filename, s);
|
||||
}
|
||||
|
||||
protected void Debug(String s)
|
||||
{
|
||||
Debug(1, s);
|
||||
|
Loading…
x
Reference in New Issue
Block a user