protected override bool ParseOption(string name, Bpl.CommandLineOptionEngine.CommandLineParseState ps) { var args = ps.args; // convenient synonym switch (name) { case "dprelude": if (ps.ConfirmArgumentCount(1)) { DafnyPrelude = args[ps.i]; } return(true); case "dprint": if (ps.ConfirmArgumentCount(1)) { DafnyPrintFile = args[ps.i]; } return(true); case "printMode": if (ps.ConfirmArgumentCount(1)) { if (args[ps.i].Equals("Everything")) { PrintMode = PrintModes.Everything; } else if (args[ps.i].Equals("NoIncludes")) { PrintMode = PrintModes.NoIncludes; } else if (args[ps.i].Equals("NoGhost")) { PrintMode = PrintModes.NoGhost; } else if (args[ps.i].Equals("DllEmbed")) { PrintMode = PrintModes.DllEmbed; } else { throw new Exception("Invalid value for printMode"); } } return(true); case "rprint": if (ps.ConfirmArgumentCount(1)) { DafnyPrintResolvedFile = args[ps.i]; } return(true); case "view": if (ps.ConfirmArgumentCount(1)) { DafnyPrintExportedViews = args[ps.i].Split(',').ToList(); } return(true); case "compile": { int compile = 0; if (ps.GetNumericArgument(ref compile, 4)) { // convert option to two booleans Compile = compile != 0; ForceCompile = compile == 2; RunAfterCompile = compile == 3; } return(true); } case "dafnyVerify": { int verify = 0; if (ps.GetNumericArgument(ref verify, 2)) { DafnyVerify = verify != 0; // convert to boolean } return(true); } case "spillTargetCode": { int spill = 0; if (ps.GetNumericArgument(ref spill, 2)) { SpillTargetCode = spill != 0; // convert to a boolean } return(true); } case "out": { if (ps.ConfirmArgumentCount(1)) { DafnyPrintCompiledFile = args[ps.i]; } return(true); } case "dafnycc": Dafnycc = true; Induction = 0; Compile = false; UseAbstractInterpretation = false; // /noinfer return(true); case "noCheating": { int cheat = 0; // 0 is default, allows cheating if (ps.GetNumericArgument(ref cheat, 2)) { DisallowSoundnessCheating = cheat == 1; } return(true); } case "induction": ps.GetNumericArgument(ref Induction, 4); return(true); case "inductionHeuristic": ps.GetNumericArgument(ref InductionHeuristic, 7); return(true); case "noIncludes": DisallowIncludes = true; return(true); case "noNLarith": DisableNLarith = true; this.AddZ3Option("smt.arith.nl=false"); return(true); case "autoReqPrint": if (ps.ConfirmArgumentCount(1)) { AutoReqPrintFile = args[ps.i]; } return(true); case "noAutoReq": ignoreAutoReq = true; return(true); case "allowGlobals": AllowGlobals = true; return(true); case "stats": PrintStats = true; return(true); case "funcCallGraph": PrintFunctionCallGraph = true; return(true); case "warnShadowing": WarnShadowing = true; return(true); case "verifyAllModules": VerifyAllModules = true; return(true); case "separateModuleOutput": SeparateModuleOutput = true; return(true); case "deprecation": { int d = 1; if (ps.GetNumericArgument(ref d, 3)) { DeprecationNoise = d; } return(true); } case "allocatedAll": { Allocated = 5; return(true); } case "allocated": { ps.GetNumericArgument(ref Allocated, 6); if (Allocated == 3 || Allocated == 4) { Allocated = 1; throw new Exception("/allocated:3 and /allocated:4 are not yet implemented"); } return(true); } case "countVerificationErrors": { int countErrors = 1; // defaults to reporting verification errors if (ps.GetNumericArgument(ref countErrors, 2)) { CountVerificationErrors = countErrors == 1; } return(true); } case "printTooltips": PrintTooltips = true; return(true); case "autoTriggers": { int autoTriggers = 0; if (ps.GetNumericArgument(ref autoTriggers, 2)) { AutoTriggers = autoTriggers == 1; } return(true); } case "rewriteFocalPredicates": { int rewriteFocalPredicates = 0; if (ps.GetNumericArgument(ref rewriteFocalPredicates, 2)) { RewriteFocalPredicates = rewriteFocalPredicates == 1; } return(true); } case "optimize": { Optimize = true; return(true); } case "kremlin": { Kremlin = true; return(true); } case "noIronDafny": { IronDafny = false; return(true); } case "ironDafny": { IronDafny = true; return(true); } case "optimizeResolution": { int d = 2; if (ps.GetNumericArgument(ref d, 3)) { OptimizeResolution = d; } return(true); } case "useRuntimeLib": { UseRuntimeLib = true; return(true); } case "disableScopes": { DisableScopes = true; return(true); } case "printIncludes": if (ps.ConfirmArgumentCount(1)) { if (args[ps.i].Equals("None")) { PrintIncludesMode = IncludesModes.None; } else if (args[ps.i].Equals("Immediate")) { PrintIncludesMode = IncludesModes.Immediate; } else if (args[ps.i].Equals("Transitive")) { PrintIncludesMode = IncludesModes.Transitive; } else { throw new Exception("Invalid value for includesMode"); } if (PrintIncludesMode == IncludesModes.Immediate || PrintIncludesMode == IncludesModes.Transitive) { Compile = false; DontShowLogo = true; DafnyVerify = false; } } return(true); default: break; } // not a Dafny-specific option, so defer to superclass return(base.ParseOption(name, ps)); }
protected override bool ParseOption(string name, Bpl.CommandLineOptionEngine.CommandLineParseState ps) { var args = ps.args; // convenient synonym switch (name) { case "dprelude": if (ps.ConfirmArgumentCount(1)) { DafnyPrelude = args[ps.i]; } return(true); case "dprint": if (ps.ConfirmArgumentCount(1)) { DafnyPrintFile = args[ps.i]; } return(true); case "printMode": if (ps.ConfirmArgumentCount(1)) { if (args[ps.i].Equals("Everything")) { PrintMode = PrintModes.Everything; } else if (args[ps.i].Equals("NoIncludes")) { PrintMode = PrintModes.NoIncludes; } else if (args[ps.i].Equals("NoGhost")) { PrintMode = PrintModes.NoGhost; } else if (args[ps.i].Equals("DllEmbed")) { PrintMode = PrintModes.DllEmbed; } else { throw new Exception("Invalid value for printMode"); } } return(true); case "rprint": if (ps.ConfirmArgumentCount(1)) { DafnyPrintResolvedFile = args[ps.i]; } return(true); case "view": if (ps.ConfirmArgumentCount(1)) { DafnyPrintExportedViews = args[ps.i].Split(',').ToList(); } return(true); case "compile": { int compile = 0; if (ps.GetNumericArgument(ref compile, 5)) { // convert option to two booleans Compile = compile != 0; ForceCompile = compile == 2 || compile == 4; RunAfterCompile = compile == 3 || compile == 4; } return(true); } case "compileTarget": if (ps.ConfirmArgumentCount(1)) { if (args[ps.i].Equals("cs")) { CompileTarget = CompilationTarget.Csharp; } else if (args[ps.i].Equals("js")) { CompileTarget = CompilationTarget.JavaScript; } else if (args[ps.i].Equals("go")) { CompileTarget = CompilationTarget.Go; } else if (args[ps.i].Equals("java")) { CompileTarget = CompilationTarget.Java; } else if (args[ps.i].Equals("php")) { CompileTarget = CompilationTarget.Php; } else { throw new Exception("Invalid value for compileTarget"); } } return(true); case "compileVerbose": { int verbosity = 0; if (ps.GetNumericArgument(ref verbosity, 2)) { CompileVerbose = verbosity == 1; } return(true); } case "dafnyVerify": { int verify = 0; if (ps.GetNumericArgument(ref verify, 2)) { DafnyVerify = verify != 0; // convert to boolean } return(true); } case "spillTargetCode": { int spill = 0; if (ps.GetNumericArgument(ref spill, 4)) { SpillTargetCode = spill; } return(true); } case "out": { if (ps.ConfirmArgumentCount(1)) { DafnyPrintCompiledFile = args[ps.i]; } return(true); } case "coverage": { if (ps.ConfirmArgumentCount(1)) { CoverageLegendFile = args[ps.i]; } return(true); } case "dafnycc": Dafnycc = true; Induction = 0; Compile = false; UseAbstractInterpretation = false; // /noinfer return(true); case "noCheating": { int cheat = 0; // 0 is default, allows cheating if (ps.GetNumericArgument(ref cheat, 2)) { DisallowSoundnessCheating = cheat == 1; } return(true); } case "pmtrace": MatchCompilerDebug = true; return(true); case "titrace": TypeInferenceDebug = true; return(true); case "induction": ps.GetNumericArgument(ref Induction, 4); return(true); case "inductionHeuristic": ps.GetNumericArgument(ref InductionHeuristic, 7); return(true); case "noIncludes": DisallowIncludes = true; return(true); case "noExterns": DisallowExterns = true; return(true); case "noNLarith": DisableNLarith = true; return(true); case "arith": { int a = 0; if (ps.GetNumericArgument(ref a, 11)) { ArithMode = a; } return(true); } case "autoReqPrint": if (ps.ConfirmArgumentCount(1)) { AutoReqPrintFile = args[ps.i]; } return(true); case "noAutoReq": ignoreAutoReq = true; return(true); case "allowGlobals": AllowGlobals = true; return(true); case "stats": PrintStats = true; return(true); case "funcCallGraph": PrintFunctionCallGraph = true; return(true); case "warnShadowing": WarnShadowing = true; return(true); case "verifyAllModules": VerifyAllModules = true; return(true); case "separateModuleOutput": SeparateModuleOutput = true; return(true); case "deprecation": { int d = 1; if (ps.GetNumericArgument(ref d, 3)) { DeprecationNoise = d; } return(true); } case "countVerificationErrors": { int countErrors = 1; // defaults to reporting verification errors if (ps.GetNumericArgument(ref countErrors, 2)) { CountVerificationErrors = countErrors == 1; } return(true); } case "printTooltips": PrintTooltips = true; return(true); case "autoTriggers": { int autoTriggers = 0; if (ps.GetNumericArgument(ref autoTriggers, 2)) { AutoTriggers = autoTriggers == 1; } return(true); } case "rewriteFocalPredicates": { int rewriteFocalPredicates = 0; if (ps.GetNumericArgument(ref rewriteFocalPredicates, 2)) { RewriteFocalPredicates = rewriteFocalPredicates == 1; } return(true); } case "optimize": { Optimize = true; return(true); } case "allocated": { ps.GetNumericArgument(ref Allocated, 5); return(true); } case "noIronDafny": { IronDafny = false; return(true); } case "ironDafny": { IronDafny = true; return(true); } case "optimizeResolution": { int d = 2; if (ps.GetNumericArgument(ref d, 3)) { OptimizeResolution = d; } return(true); } case "definiteAssignment": { int da = 0; if (ps.GetNumericArgument(ref da, 4)) { DefiniteAssignmentLevel = da; } return(true); } case "useRuntimeLib": { UseRuntimeLib = true; return(true); } case "disableScopes": { DisableScopes = true; return(true); } case "printIncludes": if (ps.ConfirmArgumentCount(1)) { if (args[ps.i].Equals("None")) { PrintIncludesMode = IncludesModes.None; } else if (args[ps.i].Equals("Immediate")) { PrintIncludesMode = IncludesModes.Immediate; } else if (args[ps.i].Equals("Transitive")) { PrintIncludesMode = IncludesModes.Transitive; } else { throw new Exception("Invalid value for includesMode"); } if (PrintIncludesMode == IncludesModes.Immediate || PrintIncludesMode == IncludesModes.Transitive) { Compile = false; DontShowLogo = true; DafnyVerify = false; } } return(true); default: break; } // not a Dafny-specific option, so defer to superclass return(base.ParseOption(name, ps)); }
protected override bool ParseOption(string name, Bpl.CommandLineOptionEngine.CommandLineParseState ps) { var args = ps.args; // convenient synonym switch (name) { case "dprelude": if (ps.ConfirmArgumentCount(1)) { DafnyPrelude = args[ps.i]; } return(true); case "dprint": if (ps.ConfirmArgumentCount(1)) { DafnyPrintFile = args[ps.i]; } return(true); case "printMode": if (ps.ConfirmArgumentCount(1)) { if (args[ps.i].Equals("Everything")) { PrintMode = PrintModes.Everything; } else if (args[ps.i].Equals("NoIncludes")) { PrintMode = PrintModes.NoIncludes; } else if (args[ps.i].Equals("NoGhost")) { PrintMode = PrintModes.NoGhost; } else { throw new Exception("Invalid value for printMode"); } } return(true); case "rprint": if (ps.ConfirmArgumentCount(1)) { DafnyPrintResolvedFile = args[ps.i]; } return(true); case "view": if (ps.ConfirmArgumentCount(1)) { DafnyPrintExportedViews = args[ps.i].Split(',').ToList(); } return(true); case "compile": { int compile = 0; if (ps.GetNumericArgument(ref compile, 4)) { // convert option to two booleans Compile = compile != 0; ForceCompile = compile == 2; RunAfterCompile = compile == 3; } return(true); } case "dafnyVerify": { int verify = 0; if (ps.GetNumericArgument(ref verify, 2)) { DafnyVerify = verify != 0; // convert to boolean } return(true); } case "spillTargetCode": { int spill = 0; if (ps.GetNumericArgument(ref spill, 2)) { SpillTargetCode = spill != 0; // convert to a boolean } return(true); } case "dafnycc": Dafnycc = true; Induction = 0; Compile = false; UseAbstractInterpretation = false; // /noinfer return(true); case "noCheating": { int cheat = 0; // 0 is default, allows cheating if (ps.GetNumericArgument(ref cheat, 2)) { DisallowSoundnessCheating = cheat == 1; } return(true); } case "induction": ps.GetNumericArgument(ref Induction, 4); return(true); case "inductionHeuristic": ps.GetNumericArgument(ref InductionHeuristic, 7); return(true); case "noIncludes": DisallowIncludes = true; return(true); case "noNLarith": DisableNLarith = true; this.AddZ3Option("smt.arith.nl=false"); return(true); case "autoReqPrint": if (ps.ConfirmArgumentCount(1)) { AutoReqPrintFile = args[ps.i]; } return(true); case "noAutoReq": ignoreAutoReq = true; return(true); case "allowGlobals": AllowGlobals = true; return(true); case "stats": PrintStats = true; return(true); case "funcCallGraph": PrintFunctionCallGraph = true; return(true); case "warnShadowing": WarnShadowing = true; return(true); case "countVerificationErrors": { int countErrors = 1; // defaults to reporting verification errors if (ps.GetNumericArgument(ref countErrors, 2)) { CountVerificationErrors = countErrors == 1; } return(true); } case "printTooltips": PrintTooltips = true; return(true); case "autoTriggers": { int autoTriggers = 0; if (ps.GetNumericArgument(ref autoTriggers, 2)) { AutoTriggers = autoTriggers == 1; } return(true); } case "rewriteFocalPredicates": { int rewriteFocalPredicates = 0; if (ps.GetNumericArgument(ref rewriteFocalPredicates, 2)) { RewriteFocalPredicates = rewriteFocalPredicates == 1; } return(true); } case "optimize": { Optimize = true; return(true); } case "noIronDafny": { IronDafny = false; return(true); } case "ironDafny": { IronDafny = true; return(true); } default: break; } // not a Dafny-specific option, so defer to superclass return(base.ParseOption(name, ps)); }