UNPKG

minigrace

Version:

A compiler for the Grace programming language

1,046 lines 209 kB
let gracecode_util_sourceFile = "/Users/black/Development/mg/gracelang/minigrace/util.grace"; let gracecode_util_sha256 = "86a02a5026652f7bc75be3d9644955328c5191b8c48ee0c82b0738fac7882554"; let gracecode_util_minigraceRevision = "b57591d29fc5ee5270d114920bf671367b8c3ecb"; let gracecode_util_minigraceGeneration = "5171"; if (typeof gctCache !== "undefined") gctCache["util"] = "dialect:\n standard\nfreshScopes:\nmodules:\n io\n standard\n sys\n unixFilePath\npath:\n /Users/black/Development/mg/gracelang/minigrace/util.grace\nscope:$100:\n asDebugString String (go) $scope_string\n asString String (go) $scope_string\n basicAsString String (go) $scope_string\n buildtype Unknown (mth) $scope_done\n cLines Unknown (def) $scope_done readable\n column Unknown (mth) $scope_done\n createDirectoryIfNecessary(1) Unknown (mth) $scope_done confidential\n defaultTarget Unknown (def) $scope_string public\n defaultVerbosity Unknown (def) $scope_number public\n dynamicModule Unknown (var) $scopeEmpty public\n dynamicModule:=(1) Unknown (var) $scopeEmpty public\n execDir Unknown (mth) $scope_done\n extensions Unknown (mth) $scope_done\n file(1)onPath(1)otherwise(1) Unknown (mth) $scope_done\n generalError(5) Unknown (mth) $scope_done\n gracelibPath Unknown (mth) $scope_done\n gracelibPath:=(1) Unknown (mth) $scope_done\n infile Unknown (mth) $scope_done\n isMe(1) Boolean (go) $scope_boolean\n linenum Unknown (mth) $scope_done\n lines Unknown (def) $scope_done readable\n log(1)verbose(1) Unknown (mth) $scope_done\n log_verbose(1) Unknown (mth) $scope_done\n modname Unknown (mth) $scope_done\n myIdentityHash Number (go) $scope_number\n noexec Unknown (mth) $scope_done\n outDir Unknown (mth) $scope_done\n outDir:=(1) Unknown (mth) $scope_done\n outfile Unknown (mth) $scope_done\n outprint(1) Unknown (mth) $scope_done\n padl(1) Unknown (mth) $scope_done\n parseargs(1) Unknown (mth) $scope_done\n printhelp Unknown (mth) $scope_done\n processExtension(1) Unknown (mth) $scope_done\n semantic_error(1) Unknown (mth) $scope_done\n setPosition(2) Unknown (mth) $scope_done\n setline(1) Unknown (mth) $scope_done\n sourceDir Unknown (mth) $scope_done\n startupFailure(1) Unknown (mth) $scope_done\n str(1)lastIndexOf(1) Unknown (mth) $scope_done\n target Unknown (mth) $scope_done\n type_error(1) Unknown (mth) $scope_done\n verbosity Unknown (var) $scopeEmpty public\n verbosity:=(1) Unknown (var) $scopeEmpty public\n vtag Unknown (mth) $scope_done\n warning(1) Unknown (mth) $scope_done\nself:\n $100\ntypes:\n"; if (typeof originalSourceLines !== "undefined") { originalSourceLines["util"] = [ "dialect \"standard\"", "import \"io\" as io", "import \"sys\" as sys", "import \"unixFilePath\" as filePath", "", "def defaultVerbosity is public = 30", "def defaultTarget is public = \"js\"", "var verbosity is public := defaultVerbosity", "var outfilev := io.output", "var infilev := io.input", "var modnamev := \"standardInput\"", "var buildtypev := \"run\"", "var gracelibPathv := false", "var linenumv := 1", "var columnv := 1", "var vtagv := false", "var noexecv := false", "var targetv := defaultTarget", "var extensionsv := dictionary.empty", "var recurse is readable := true", "var dynamicModule is public := false", "def lines is readable = list [ ] // contains all of the input lines", "def cLines is readable = list [ ] // as above, with C escapes for \\ and \"", "def nullFile = filePath.null // don't modify this one", "var filename is readable := nullFile", "var commandLineExtensions is readable := \"\"", "var buildinfo is readable // injected from compiler", "", "", "def targets = set.withAll [", " \"lex\", \"parse\", \"grace\", \"ast\", \"processed-ast\", \"symbols\", \"imports\", \"js\"", "]", "", "var errno is readable := 0", "", "method parseargs(bi) {", " buildinfo := bi", " var argv := sys.argv", " var toStdout := false", " if (argv.size > 1) then {", " var indices := argv.indices", " var arg", " var skip := true", " for (indices) do { ai->", " arg := argv.at(ai)", " if (!skip && (arg.at(1) == \"-\")) then {", " match(arg)", " case { == \"-o\" ->", " if(argv.size < (ai + 1)) then {", " startupFailure \"-o requires an argument.\"", " }", " outfilev := io.open(argv.at(ai + 1), \"w\")", " skip := true", " } case { == \"--verbose\" ->", " verbosity := 40", " if (argv.size >= (ai + 1)) then {", " def nextArg = argv.at(ai + 1)", " def firstCh = nextArg.at(1)", " if ((firstCh >= \"0\") && (firstCh <= \"9\")) then {", " skip := true", " verbosity := nextArg.asNumber", " }", " }", " } case { == \"--help\" ->", " printhelp", " } case { == \"--vtag\" ->", " skip := true", " if(argv.size < (ai + 1)) then {", " startupFailure \"--vtag requires an argument.\"", " }", " vtagv := argv.at(ai + 1)", " } case { == \"--make\" ->", " buildtypev := \"bc\"", " } case { == \"--no-recurse\" ->", " recurse := false", " } case { == \"--run\" ->", " buildtypev := \"run\"", " } case { == \"--dir\" ->", " skip := true", " if(argv.size < (ai + 1)) then {", " startupFailure \"--dir requires an argument.\"", " }", " outDirCache := argv.at(ai + 1)", " dirFlag := true", " if (outDirCache.at(outDirCache.size) != \"/\") then {", " outDirCache := outDirCache ++ \"/\"", " }", " createDirectoryIfNecessary(outDirCache)", " } case { == \"--stdout\" ->", " toStdout := true", " } case { == \"-\" ->", " toStdout := true", " } case { == \"--module\" ->", " skip := true", " if(argv.size < (ai + 1)) then {", " startupFailure \"--module requires an argument.\"", " }", " modnamev := argv.at(ai + 1)", " } case { == \"--gracelib\" ->", " skip := true", " if(argv.size < (ai + 1)) then {", " startupFailure \"--gracelib requires an argument.\"", " }", " gracelibPathv := argv.at(ai + 1)", " } case { == \"--target\" ->", " skip := true", " if(argv.size < (ai + 1)) then {", " startupFailure \"--target requires an argument.\"", " }", " targetv := argv.at(ai + 1)", "", " if (targetv == \"help\") then {", " io.error.write \"Valid targets:\"", " list.withAll(targets).sort.do { t ->", " io.error.write \" {t}\"", " }", " sys.exit(0)", " }", " } case { == \"--gctfile\" ->", " extensionsv.at \"gctfile\" put true", " } case { == \"--version\" ->", " print(\"minigrace version \"", " ++ \"{buildinfo.gitgeneration}\")", " print(\"git revision \" ++ buildinfo.gitrevision)", " sys.exit(0)", " } else {", " if (arg.at(2) == \"X\") then {", " var ext := arg.substringFrom(3)to(arg.size)", " commandLineExtensions := \"{commandLineExtensions} {arg}\"", " processExtension(ext)", " } else {", " startupFailure \"invalid argument {arg}.\"", " }", " }", " } else {", " if (skip) then {", " skip := false", " } elseif { filename == nullFile } then {", " filename := filePath.fromString(arg)", " if (filename.extension != \".grace\") then {", " startupFailure \"filename '{filename}' does not end with '.grace'.\"", " }", " try {", " infilev := io.open(filename.asString, \"r\")", " } catch {", " ex:EnvironmentException ->", " startupFailure \"can't open file {filename}\"", " }", " if (modnamev == \"standardInput\") then {", " modnamev := filename.base", " }", " } else {", " startupFailure \"please provide a single Grace file.\"", " }", " }", " }", " }", " if ((false == vtagv) && {outDirCache != \"\"}) then {", " vtagv := outDirCache.substringFrom 1 to (outDirCache.size - 1)", " }", " if ((outfilev == io.output) && {!toStdout}) then {", " outfilev := match(targetv)", " case { == \"js\" -> io.open(outDir ++ modnamev ++ \".js\", \"w\") }", " case { == \"parse\" -> io.open(outDir ++ modnamev ++ \".parse\", \"w\") }", " case { == \"lex\" -> io.open(outDir ++ modnamev ++ \".lex\", \"w\") }", " case { == \"processed-ast\" -> io.open(outDir ++ modnamev ++ \".ast\", \"w\") }", " case { == \"ast\" -> io.open(outDir ++ modnamev ++ \".ast\", \"w\") }", " case { == \"symbols\" -> io.open(outDir ++ modnamev ++ \".symbols\", \"w\") }", " case { == \"grace\" -> io.open(outDir ++ modnamev ++ \"_new.grace\", \"w\") }", " case { == \"imports\" -> io.output }", " else { startupFailure \"unrecognized target '{targetv}'.\" }", " }", " if (target != \"js\") then {", " buildtypev := \"debug\"", " }", " if ((buildtype == \"run\") && (gracelibPathv == false)) then {", " def extension = \".\" ++ target", " def soughtLibrary = filePath.withDirectory(execDir)", " base \"gracelib\" extension(extension)", " if (soughtLibrary.exists) then {", " gracelibPathv := execDir", " } else {", " soughtLibrary.directory := \"\"", " def gracelib = file (soughtLibrary)", " onPath (sys.environ.at \"GRACE_MODULE_PATH\")", " otherwise { locs ->", " startupFailure(\"can't find {soughtLibrary.shortName};\\n\" ++", " \"looked in {locs}.\")", " }", " gracelibPathv := gracelib.directory", " }", " }", " if ((infilev == io.input) && {infilev.isatty}) then {", " print(\"minigrace {buildinfo.gitgeneration} / \"", " ++ buildinfo.gitrevision)", " print \"Copyright © 2011-2019 rests with the authors.\"", " print \"This is free software with absolutely no warranty. \"", " print \"\"", " print \"Provide a program on standard input, or put the name of a file containing\"", " print \"the program on the command line. This will compile & execute it\"", " print \"\"", " var executable := sys.argv.at 1", " def cwd = sys.cwd", " if (executable.startsWith(cwd)) then {", " executable := executable.substringFrom(cwd.size + 1)", " }", " print \"For help, execute {executable} --help\"", " }", "}", "", "method createDirectoryIfNecessary(d) is confidential {", " if (io.exists(d)) then { return }", " if (io.system \"mkdir \\\"{d}\\\"\") then { return }", " EnvironmentException.raise \"Unable to create directory \\\"{d}\\\".\"", "}", "", "var previousElapsed := 0", "", "method log_verbose(s) {", " log (defaultVerbosity + 1) verbose (s)", "}", "", "method log(level) verbose(s) {", " if (verbosity >= level) then {", " var vtagw := \"\"", " if (false != vtagv) then {", " vtagw := \"[\" ++ vtagv ++ \"]\"", " }", " def elapsed = (sys.elapsedTime * 100).rounded / 100", " io.error.write(\"minigrace{vtagw}: {modnamev}: \"", " ++ \"{elapsed} (+{elapsed - previousElapsed}): {s}\")", " previousElapsed := elapsed", " }", "}", "", "method outprint(s) {", " outfilev.write(s)", " outfilev.write(\"\\n\")", "}", "", "method startupFailure (message) {", " // Terminates the compilation because of an error in the commmand line", "", " io.error.write \"{sys.argv.at(1)}: {message}\"", " sys.exit 1", "}", "", "def lineNumberWidth = 4", "def leader = \"-\" * (lineNumberWidth+2) // +2 for the \": \" between number and line", "", "method padl(num) {", " def str = num.asString", " (\" \" * (lineNumberWidth - str.size)) ++ str", "}", "", "method generalError(message, errlinenum, position, arr, suggestions) {", " if (false ≠ vtagv) then {", " io.error.write(\"[\" ++ vtagv ++ \"]\")", " }", " io.error.write(\"{modnamev}.grace[{errlinenum}:{position}]: {message}\")", " if ((errlinenum > 1) && (lines.size >= (errlinenum - 1))) then {", " io.error.write(\"{padl(errlinenum - 1)}: {lines.at(errlinenum - 1)}\")", " }", " if ((errlinenum > 0) && (lines.size >= errlinenum)) then {", " io.error.write \"{padl(errlinenum)}: {lines.at(errlinenum)}\"", " io.error.write \"{leader}{arr}\"", " }", " if (suggestions.size > 0) then {", " for(suggestions) do { s ->", " io.error.write \"\\nDid you mean:\"", " s.print", " }", " }", " def outputfilePath = outfile.pathname", " outfile.close", " if (outputfilePath ≠ \"/dev/null\") then {", " io.spawn(\"/bin/rm\", [\"-f\", outputfilePath]) // remove the bad output file", " }", " sys.exit(2)", "}", "", "method type_error(s) {", " if (extensionsv.containsKey(\"IgnoreTypes\")) then {", " return true", " }", " if (false ≠ vtagv) then {", " io.error.write(\"[\" ++ vtagv ++ \"]\")", " }", " io.error.write(\"{modnamev}.grace:{linenumv}:{columnv}: Type error: {s}\")", " io.error.write(lines.at(linenumv))", " sys.exit(2)", "}", "method semantic_error(s) {", " if (false ≠ vtagv) then {", " io.error.write(\"[\" ++ vtagv ++ \"]\")", " }", " io.error.write \"{modnamev}.grace:{linenumv}:{columnv}: Semantic error\"", " if (s == \"\") then {", " sys.exit(2)", " }", " io.error.write \": {s}\"", " if (linenumv > 1) then {", " if (lines.size > 0) then {", " io.error.write(\"{padl(linenumv - 1)}: {lines.at(linenumv - 1)}\")", " }", " }", " def arr = \"-\" * (lineNumberWidth + columnv)", "", " if (lines.size >= linenumv) then {", " io.error.write(\"{padl(linenumv)}: {lines.at(linenumv)}\\n{leader}{arr}^\")", " }", " if (linenumv < lines.size) then {", " io.error.write(\"{padl(linenumv + 1)}: {lines.at(linenumv + 1)}\")", " }", " sys.exit(2)", "}", "method warning(s) {", " io.error.write(\"{modnamev}.grace:{linenumv}:{columnv}: warning: {s}\")", "}", "", "method outfile {", " outfilev", "}", "method infile {", " infilev", "}", "method modname {", " modnamev", "}", "method buildtype {", " buildtypev", "}", "method gracelibPath {", " gracelibPathv", "}", "method setline(l) {", " linenumv := l", "}", "method setPosition(l, c) {", " linenumv := l", " columnv := c", "}", "method linenum {", " linenumv", "}", "method column {", " columnv", "}", "method vtag {", " vtagv", "}", "method noexec {", " noexecv", "}", "method target {", " targetv", "}", "method extensions {", " extensionsv", "}", "method str(s) lastIndexOf(ch) {", " var ix := s.size", " while { ix > 0 } do {", " if (s.at(ix) == ch) then { return ix }", " ix := ix - 1", " }", " return 0", "}", "", "method sourceDir { filename.absolute.directory }", "", "var outDirCache := \"\"", "var dirFlag is readable := false", "method outDir {", " if (outDirCache == \"\") then {", " outDirCache := sourceDir", " }", " outDirCache", "}", "method outDir := (new) {", " // this method exists for testing, in particular, t179", " outDirCache := new", "}", "method gracelibPath := (new) {", " // this method exists for testing, in particular, t179", " gracelibPathv := new", "}", "", "var execDirCache := \"\"", "method execDir {", " if (execDirCache == \"\") then {", " execDirCache := sys.execPath", " if (execDirCache.at(execDirCache.size) != \"/\") then {", " execDirCache := execDirCache ++ \"/\"", " }", " }", " execDirCache", "}", "", "method file(name) onPath(pathString) otherwise(action) {", " // Returns the path of a file with base name that exists in origin, or on", " // a path in pathString, or in the output directory, or in the directory", " // where this executable is located.", " // If multiple such files exist, the first one found is returned.", " // If none exists, applies action to the list of directories that were tried", "", " def locations = filePath.split(pathString)", " if (locations.contains(outDir).not) then { locations.addFirst(outDir) }", " // it's important that outDir is first; if not, the compiler", " // might compile an imported file, but then be unable to find the", " // code that it just generated.", " if (locations.contains(execDir).not) then { locations.addLast(execDir) }", " def candidate = filePath.fromString(name.asString)", " def originalDir = name.directory", " if (originalDir.first == \"/\") then {", " if (candidate.exists) then {", " return candidate", " } else {", " return action.apply(list [originalDir])", " }", " }", " locations.do { each ->", " candidate.setDirectory(each ++ originalDir)", " if (candidate.exists) then { return candidate }", " }", " action.apply(locations)", "}", "", "method processExtension(ext) {", " var extn := \"\"", " var extv := true", " var seeneq := false", " for (ext) do {c->", " if (c == \"=\") then {", " seeneq := true", " extv := \"\"", " } else {", " if (!seeneq) then {", " extn := extn ++ c", " } else {", " extv := extv ++ c", " }", " }", " }", " extensionsv.at (extn) put (extv)", "}", "method printhelp {", " print \"Usage: {sys.argv.at(1)} [Mode] [Option]... FILE\"", " print \"Compile, process, or run a Grace source file.\"", " print \"\"", " print \"Modes:\"", " print \" --make Compile FILE, creating an executable.\"", " print \" --run Compile FILE and execute the program [default].\"", " print \"\"", " print \"Options:\"", " print \" --dir DIR Use the directory DIR for generated output files,\"", " print \" and for .gct files of imported modules.\"", " print \" --gctfile Write a separate gct file, in addition to putting the\"", " print \" gct information in the compiled code.\"", " print \" --gracelib DIR Look in DIR for gracelib. If not specified, looks in\"", " print \" the same directory as {sys.argv.at(1)}, and then on GRACE_MODULE_PATH.\"", " print \" --help This text\"", " print \" --module Override default module name (derived from FILE)\"", " print \" --no-recurse Do not compile imported modules\"", " print \" -o OFILE Output to OFILE instead of default\"", " print \" --stdout Output to standard output rather than a file\"", " print \" --target TGT Choose a non-default compilation target TGT\"", " print \" Use --target help to list supported targets.\"", " print \" --verbose n Give more detailed output (n is optional, default 40)\"", " print \" n ≥ 20 lists unexpected situations during compilation\"", " print \" n ≥ 40 also lists phases of the compilation\"", " print \" n ≥ 50 also lists initiation of sub-compiles\"", " print \" n ≥ 60 also describes searches for imports\"", " print \" n ≥ 100 also describes import logic\"", " print \" --version Print version information\"", " print \" -Xprag equivalent to putting `#pragma prag` in FILE\"", " print \"\"", " print \"By default, {sys.argv.at(1)} FILE will compile and execute FILE.\"", " print \"More detailed usage information is in the <doc/usage> file in the source tree.\"", " sys.exit(0)", "}" ]; } function gracecode_util() { importedModules["util"] = this; const var_$module = this; this.definitionModule = "util"; this.definitionLine = 1; setLineNumber(1); // compilenode dialect // Dialect "standard" const var_$dialect = do_import("standard", gracecode_standard); this.outer = var_$dialect; setLineNumber(2); // compilenode import // Import of "io" as io if (typeof gracecode_io == "undefined") throw new GraceExceptionPacket(EnvironmentExceptionObject, new GraceString("could not find module io")); var var_io = do_import("io", gracecode_io); var func0 = function(argcv) { // accessor method io, line 2 const numArgs = arguments.length - 1; if (numArgs > 0) raiseTypeArgError("io", 0, numArgs - 0); return var_io; }; // end of method io this.methods["io"] = func0; func0.methodName = "io"; func0.paramCounts = [0]; func0.paramNames = []; func0.definitionLine = 2; func0.definitionModule = "util"; func0.debug = "import"; func0.confidential = true; setLineNumber(3); // compilenode import // Import of "sys" as sys if (typeof gracecode_sys == "undefined") throw new GraceExceptionPacket(EnvironmentExceptionObject, new GraceString("could not find module sys")); var var_sys = do_import("sys", gracecode_sys); var func1 = function(argcv) { // accessor method sys, line 3 const numArgs = arguments.length - 1; if (numArgs > 0) raiseTypeArgError("sys", 0, numArgs - 0); return var_sys; }; // end of method sys this.methods["sys"] = func1; func1.methodName = "sys"; func1.paramCounts = [0]; func1.paramNames = []; func1.definitionLine = 3; func1.definitionModule = "util"; func1.debug = "import"; func1.confidential = true; setLineNumber(4); // compilenode import // Import of "unixFilePath" as filePath if (typeof gracecode_unixFilePath == "undefined") throw new GraceExceptionPacket(EnvironmentExceptionObject, new GraceString("could not find module unixFilePath")); var var_filePath = do_import("unixFilePath", gracecode_unixFilePath); var func2 = function(argcv) { // accessor method filePath, line 4 const numArgs = arguments.length - 1; if (numArgs > 0) raiseTypeArgError("filePath", 0, numArgs - 0); return var_filePath; }; // end of method filePath this.methods["filePath"] = func2; func2.methodName = "filePath"; func2.paramCounts = [0]; func2.paramNames = []; func2.definitionLine = 4; func2.definitionModule = "util"; func2.debug = "import"; func2.confidential = true; this.closureKeys = this.closureKeys || []; this.closureKeys.push("outer_util_1"); this.outer_util_1 = var_$dialect; var func3 = function(argcv, var_bi) { // method parseargs(_), line 36 var returnTarget = invocationCount; invocationCount++; const numArgs = arguments.length - 1; if ((numArgs > 1) && (numArgs !== 1)) { raiseTypeArgError("parseargs(_)", 0, numArgs - 1); } setLineNumber(37); // compilenode call var call4 = selfRequest(var_$module, "buildinfo:=(1)", [1], var_bi); setLineNumber(38); // compilenode member // call case 4: other requests var call5 = request(var_sys, "argv", [0]); var var_argv = call5; setLineNumber(39); // compilenode member var var_toStdout = GraceFalse; var if7 = GraceDone; setLineNumber(40); // compilenode num // call case 4: other requests // call case 4: other requests if (var_argv === undefined) raiseUninitializedVariable("argv"); var call9 = request(var_argv, "size", [0]); var term8 = request(call9, ">(1)", [1], new GraceNum(1)); if (Grace_isTrue(term8)) { setLineNumber(41); // compilenode member // call case 4: other requests if (var_argv === undefined) raiseUninitializedVariable("argv"); var call10 = request(var_argv, "indices", [0]); var var_indices = call10; setLineNumber(42); // compilenode vardec var var_arg; setLineNumber(43); // compilenode member var var_skip = GraceTrue; setLineNumber(44); // compilenode block var block13 = new GraceBlock(this, 44, 1); block13.guard = jsTrue; block13.real = function block13(var_ai) { setLineNumber(45); // compilenode call // call case 4: other requests if (var_argv === undefined) raiseUninitializedVariable("argv"); var call14 = request(var_argv, "at(1)", [1], var_ai); var_arg = call14; var if15 = GraceDone; setLineNumber(46); // compilenode string var string18 = new GraceString("-"); // call case 4: other requests // call case 4: other requests var call19 = request(var_arg, "at(1)", [1], new GraceNum(1)); var term17 = request(call19, "==(1)", [1], string18); // call case 4: other requests // call case 4: other requests if (var_skip === undefined) raiseUninitializedVariable("skip"); var call20 = request(var_skip, "prefix!", [0]); var term16 = request(call20, "&&(1)", [1], term17); if (Grace_isTrue(term16)) { setLineNumber(47); // compilenode matchcase if (var_arg === undefined) raiseUninitializedVariable("arg"); var cases21 = []; setLineNumber(48); // compilenode block var block22 = new GraceBlock(this, 48, 1); // call case 4: other requests var string24 = new GraceString("-o"); var call23 = request(string24, "prefix==", [0]); block22.paramTypes = [call23]; var matches25 = function(var___95____95__1) { // call case 4: other requests var string27 = new GraceString("-o"); var call26 = request(string27, "prefix==", [0]); if (!Grace_isTrue(request(call26, "matches(1)", [1], var___95____95__1))) return false; return true; }; block22.guard = matches25; block22.real = function block22(var___95____95__1) { var if28 = GraceDone; setLineNumber(49); // compilenode num // call case 4: other requests var sum30 = request(var_ai, "+(1)", [1], new GraceNum(1)); // call case 4: other requests // call case 4: other requests if (var_argv === undefined) raiseUninitializedVariable("argv"); var call31 = request(var_argv, "size", [0]); var term29 = request(call31, "<(1)", [1], sum30); if (Grace_isTrue(term29)) { setLineNumber(50); // compilenode string var string33 = new GraceString("-o requires an argument."); var call32 = selfRequest(var_$module, "startupFailure(1)", [1], string33); if28 = call32; } setLineNumber(52); // compilenode num // call case 4: other requests var sum37 = request(var_ai, "+(1)", [1], new GraceNum(1)); // call case 4: other requests if (var_argv === undefined) raiseUninitializedVariable("argv"); var call36 = request(var_argv, "at(1)", [1], sum37); var string38 = new GraceString("w"); // call case 4: other requests var call35 = request(var_io, "open(2)", [2], call36, string38); var call34 = selfRequest(var_$module, "outfilev:=(1)", [1], call35); setLineNumber(53); // compilenode member var_skip = GraceTrue; return GraceDone; }; let applyMeth22 = function apply_1 (argcv, ...args) { if (this.guard.apply(this.receiver, args)) return this.real.apply(this.receiver, args); badBlockArgs.apply(this, args); }; applyMeth22.methodName = "apply(1)"; applyMeth22.paramCounts = [1]; applyMeth22.paramNames = ["__1"]; applyMeth22.definitionLine = 48; applyMeth22.definitionModule = "util"; block22.methods["apply(1)"] = applyMeth22; let matchesMeth22 = function matches_1 (argcv, ...args) { return this.guard.apply(this.receiver, args) ? GraceTrue : GraceFalse; }; matchesMeth22.methodName = "matches(1)"; matchesMeth22.paramCounts = [1]; matchesMeth22.paramNames = ["__1"]; matchesMeth22.definitionLine = 48; matchesMeth22.definitionModule = "util"; block22.methods["matches(1)"] = matchesMeth22; cases21.push(block22); setLineNumber(54); // compilenode block var block40 = new GraceBlock(this, 54, 1); // call case 4: other requests var string42 = new GraceString("--verbose"); var call41 = request(string42, "prefix==", [0]); block40.paramTypes = [call41]; var matches43 = function(var___95____95__2) { // call case 4: other requests var string45 = new GraceString("--verbose"); var call44 = request(string45, "prefix==", [0]); if (!Grace_isTrue(request(call44, "matches(1)", [1], var___95____95__2))) return false; return true; }; block40.guard = matches43; block40.real = function block40(var___95____95__2) { setLineNumber(55); // compilenode num var call46 = selfRequest(var_$module, "verbosity:=(1)", [1], new GraceNum(40)); var if47 = GraceDone; setLineNumber(56); // compilenode num // call case 4: other requests var sum49 = request(var_ai, "+(1)", [1], new GraceNum(1)); // call case 4: other requests // call case 4: other requests if (var_argv === undefined) raiseUninitializedVariable("argv"); var call50 = request(var_argv, "size", [0]); var term48 = request(call50, "\u2265(1)", [1], sum49); if (Grace_isTrue(term48)) { setLineNumber(57); // compilenode num // call case 4: other requests var sum52 = request(var_ai, "+(1)", [1], new GraceNum(1)); // call case 4: other requests if (var_argv === undefined) raiseUninitializedVariable("argv"); var call51 = request(var_argv, "at(1)", [1], sum52); var var_nextArg = call51; setLineNumber(58); // compilenode num // call case 4: other requests if (var_nextArg === undefined) raiseUninitializedVariable("nextArg"); var call53 = request(var_nextArg, "at(1)", [1], new GraceNum(1)); var var_firstCh = call53; var if54 = GraceDone; setLineNumber(59); // compilenode string var string57 = new GraceString("9"); // call case 4: other requests if (var_firstCh === undefined) raiseUninitializedVariable("firstCh"); var term56 = request(var_firstCh, "\u2264(1)", [1], string57); // call case 4: other requests var string59 = new GraceString("0"); // call case 4: other requests var term58 = request(var_firstCh, "\u2265(1)", [1], string59); var term55 = request(term58, "&&(1)", [1], term56); if (Grace_isTrue(term55)) { setLineNumber(60); // compilenode member var_skip = GraceTrue; setLineNumber(61); // compilenode member // call case 4: other requests if (var_nextArg === undefined) raiseUninitializedVariable("nextArg"); var call62 = request(var_nextArg, "asNumber", [0]); var call61 = selfRequest(var_$module, "verbosity:=(1)", [1], call62); if54 = call61; } if47 = if54; } return if47; }; let applyMeth40 = function apply_1 (argcv, ...args) { if (this.guard.apply(this.receiver, args)) return this.real.apply(this.receiver, args); badBlockArgs.apply(this, args); }; applyMeth40.methodName = "apply(1)"; applyMeth40.paramCounts = [1]; applyMeth40.paramNames = ["__2"]; applyMeth40.definitionLine = 54; applyMeth40.definitionModule = "util"; block40.methods["apply(1)"] = applyMeth40; let matchesMeth40 = function matches_1 (argcv, ...args) { return this.guard.apply(this.receiver, args) ? GraceTrue : GraceFalse; }; matchesMeth40.methodName = "matches(1)"; matchesMeth40.paramCounts = [1]; matchesMeth40.paramNames = ["__2"]; matchesMeth40.definitionLine = 54; matchesMeth40.definitionModule = "util"; block40.methods["matches(1)"] = matchesMeth40; cases21.push(block40); setLineNumber(64); // compilenode block var block63 = new GraceBlock(this, 64, 1); // call case 4: other requests var string65 = new GraceString("--help"); var call64 = request(string65, "prefix==", [0]); block63.paramTypes = [call64]; var matches66 = function(var___95____95__3) { // call case 4: other requests var string68 = new GraceString("--help"); var call67 = request(string68, "prefix==", [0]); if (!Grace_isTrue(request(call67, "matches(1)", [1], var___95____95__3))) return false; return true; }; block63.guard = matches66; block63.real = function block63(var___95____95__3) { setLineNumber(65); // compilenode member var call69 = selfRequest(var_$module, "printhelp", [0]); return call69; }; let applyMeth63 = function apply_1 (argcv, ...args) { if (this.guard.apply(this.receiver, args)) return this.real.apply(this.receiver, args); badBlockArgs.apply(this, args); }; applyMeth63.methodName = "apply(1)"; applyMeth63.paramCounts = [1]; applyMeth63.paramNames = ["__3"]; applyMeth63.definitionLine = 64; applyMeth63.definitionModule = "util"; block63.methods["apply(1)"] = applyMeth63; let matchesMeth63 = function matches_1 (argcv, ...args) { return this.guard.apply(this.receiver, args) ? GraceTrue : GraceFalse; }; matchesMeth63.methodName = "matches(1)"; matchesMeth63.paramCounts = [1]; matchesMeth63.paramNames = ["__3"]; matchesMeth63.definitionLine = 64; matchesMeth63.definitionModule = "util"; block63.methods["matches(1)"] = matchesMeth63; cases21.push(block63); setLineNumber(66); // compilenode block var block70 = new GraceBlock(this, 66, 1); // call case 4: other requests var string72 = new GraceString("--vtag"); var call71 = request(string72, "prefix==", [0]); block70.paramTypes = [call71]; var matches73 = function(var___95____95__4) { // call case 4: other requests var string75 = new GraceString("--vtag"); var call74 = request(string75, "prefix==", [0]); if (!Grace_isTrue(request(call74, "matches(1)", [1], var___95____95__4))) return false; return true; }; block70.guard = matches73; block70.real = function block70(var___95____95__4) { setLineNumber(67); // compilenode member var_skip = GraceTrue; var if77 = GraceDone; setLineNumber(68); // compilenode num // call case 4: other requests var sum79 = request(var_ai, "+(1)", [1], new GraceNum(1)); // call case 4: other requests // call case 4: other requests if (var_argv === undefined) raiseUninitializedVariable("argv"); var call80 = request(var_argv, "size", [0]); var term78 = request(call80, "<(1)", [1], sum79); if (Grace_isTrue(term78)) { setLineNumber(69); // compilenode string var string82 = new GraceString("--vtag requires an argument."); var call81 = selfRequest(var_$module, "startupFailure(1)", [1], string82); if77 = call81; } setLineNumber(71); // compilenode num // call case 4: other requests var sum85 = request(var_ai, "+(1)", [1], new GraceNum(1)); // call case 4: other requests if (var_argv === undefined) raiseUninitializedVariable("argv"); var call84 = request(var_argv, "at(1)", [1], sum85); var call83 = selfRequest(var_$module, "vtagv:=(1)", [1], call84); return call83; }; let applyMeth70 = function apply_1 (argcv, ...args) { if (this.guard.apply(this.receiver, args)) return this.real.apply(this.receiver, args); badBlockArgs.apply(this, args); }; applyMeth70.methodName = "apply(1)"; applyMeth70.paramCounts = [1]; applyMeth70.paramNames = ["__4"]; applyMeth70.definitionLine = 66; applyMeth70.definitionModule = "util"; block70.methods["apply(1)"] = applyMeth70; let matchesMeth70 = function matches_1 (argcv, ...args) { return this.guard.apply(this.receiver, args) ? GraceTrue : GraceFalse; }; matchesMeth70.methodName = "matches(1)"; matchesMeth70.paramCounts = [1]; matchesMeth70.paramNames = ["__4"]; matchesMeth70.definitionLine = 66; matchesMeth70.definitionModule = "util"; block70.methods["matches(1)"] = matchesMeth70; cases21.push(block70); setLineNumber(72); // compilenode block var block86 = new GraceBlock(this, 72, 1); // call case 4: other requests var string88 = new GraceString("--make"); var call87 = request(string88, "prefix==", [0]); block86.paramTypes = [call87]; var matches89 = function(var___95____95__5) { // call case 4: other requests var string91 = new GraceString("--make"); var call90 = request(string91, "prefix==", [0]); if (!Grace_isTrue(request(call90, "matches(1)", [1], var___95____95__5))) return false; return true; }; block86.guard = matches89; block86.real = function block86(var___95____95__5) { setLineNumber(73); // compilenode string var string93 = new GraceString("bc"); var call92 = selfRequest(var_$module, "buildtypev:=(1)", [1], string93); return call92; }; let applyMeth86 = function apply_1 (argcv, ...args) { if (this.guard.apply(this.receiver, args)) return this.real.apply(this.receiver, args); badBlockArgs.apply(this, args); }; applyMeth86.methodName = "apply(1)"; applyMeth86.paramCounts = [1]; applyMeth86.paramNames = ["__5"]; applyMeth86.definitionLine = 72; applyMeth86.definitionModule = "util"; block86.methods["apply(1)"] = applyMeth86; let matchesMeth86 = function matches_1 (argcv, ...args) { return this.guard.apply(this.receiver, args) ? GraceTrue : GraceFalse; }; matchesMeth86.methodName = "matches(1)"; matchesMeth86.paramCounts = [1]; matchesMeth86.paramNames = ["__5"]; matchesMeth86.definitionLine = 72; matchesMeth86.definitionModule = "util"; block86.methods["matches(1)"] = matchesMeth86; cases21.push(block86); setLineNumber(74); // compilenode block var block94 = new GraceBlock(this, 74, 1); // call case 4: other requests var string96 = new GraceString("--no-recurse"); var call95 = request(string96, "prefix==", [0]); block94.paramTypes = [call95]; var matches97 = function(var___95____95__6) { // call case 4: other requests var string99 = new GraceString("--no-recurse"); var call98 = request(string99, "prefix==", [0]); if (!Grace_isTrue(request(call98, "matches(1)", [1], var___95____95__6))) return false; return true; }; block94.guard = matches97; block94.real = function block94(var___95____95__6) { setLineNumber(75); // compilenode member var call100 = selfRequest(var_$module, "recurse:=(1)", [1], GraceFalse); return call100; }; let applyMeth94 = function apply_1 (argcv, ...args) { if (this.guard.apply(this.receiver, args)) return this.real.apply(this.receiver, args); badBlockArgs.apply(this, args); }; applyMeth94.methodName = "apply(1)"; applyMeth94.paramCounts = [1]; applyMeth94.paramNames = ["__6"]; applyMeth94.definitionLine = 74; applyMeth94.definitionModule = "util"; block94.methods["apply(1)"] = applyMeth94; let matchesMeth94 = function matches_1 (argcv, ...args) { return this.guard.apply(this.receiver, args) ? GraceTrue : GraceFalse; }; matchesMeth94.methodName = "matches(1)"; matchesMeth94.paramCounts = [1]; matchesMeth94.paramNames = ["__6"]; matchesMeth94.definitionLine = 74; matchesMeth94.definitionModule = "util"; block94.methods["matches(1)"] = matchesMeth94; cases21.push(block94); setLineNumber(76); // compilenode block var block102 = new GraceBlock(this, 76, 1); // call case 4: other requests var string104 = new GraceString("--run"); var call103 = request(string104, "prefix==", [0]); block102.paramTypes = [call103]; var matches105 = function(var___95____95__7) { // call case 4: other requests var string107 = new GraceString("--run"); var call106 = request(string107, "prefix==", [0]); if (!Grace_isTrue(request(call106, "matches(1)", [1], var___95____95__7))) return false; return true; }; block102.guard = matches105; block102.real = function block102(var___95____95__7) { setLineNumber(77); // compilenode string var string109 = new GraceString("run"); var call108 = selfRequest(var_$module, "buildtypev:=(1)", [1], string109); return call108; }; let applyMeth102 = function apply_1 (argcv, ...args) { if (this.guard.apply(this.receiver, args)) return this.real.apply(this.receiver, args); badBlockArgs.apply(this, args); }; applyMeth102.methodName = "apply(1)"; applyMeth102.paramCounts = [1]; applyMeth102.paramNames = ["__7"]; applyMeth102.definitionLine = 76; applyMeth102.definitionModule = "util"; block102.methods["apply(1)"] = applyMeth102; let matchesMeth102 = function matches_1 (argcv, ...args) { return this.guard.apply(this.receiver, args) ? GraceTrue : GraceFalse; }; matchesMeth102.methodName = "matches(1)"; matchesMeth102.paramCounts = [1]; matchesMeth102.paramNames = ["__7"]; matchesMeth102.definitionLine = 76; matchesMeth102.definitionModule = "util"; block102.methods["matches(1)"] = matchesMeth102; cases21.push(block102); setLineNumber(78); // compilenode block var block110 = new GraceBlock(this, 78, 1); // call case 4: other requests var string112 = new GraceString("--dir"); var call111 = request(string112, "prefix==", [0]); block110.paramTypes = [call111]; var matches113 = function(var___95____95__8) { // call case 4: other requests var string115 = new GraceString("--dir"); var call114 = request(string115, "prefix==", [0]); if (!Grace_isTrue(request(call114, "matches(1)", [1], var___95____95__8))) return false; return true; }; block110.guard = matches113; block110.real = function block110(var___95____95__8) { setLineNumber(79); // compilenode member var_skip = GraceTrue; var if117 = GraceDone; setLineNumber(80); // compilenode num // call case 4: other requests var sum119 = request(var_ai, "+(1)", [1], new GraceNum(1)); // call case 4: other requests // call case 4: other requests if (var_argv === undefined) raiseUninitializedVariable("argv"); var call120 = request(var_argv, "size", [0]); var term118 = request(call120, "<(1)", [1], sum119); if (Grace_isTrue(term118)) { setLineNumber(81); // compilenode string var string122 = new GraceString("--dir requires an argument."); var call121 = selfRequest(var_$module, "startupFailure(1)", [1], string122); if117 = call121; } setLineNumber(83); // compilenode num // call case 4: other requests var sum125 = request(var_ai, "+(1)", [1], new GraceNum(1)); // call case 4: other requests if (var_argv === undefined) raiseUninitializedVariable("argv"); var call124 = request(var_argv, "at(1)", [1], sum125); var call123 = selfRequest(var_$module, "outDirCache:=(1)", [1], call124); setLineNumber(84); // compilenode member var call126 = selfRequest(var_$module, "dirFlag:=(1)", [1], GraceTrue); var if128 = GraceDone; setLineNumber(85); // compilenode string var string130 = new GraceString("/"); // call case 4: other requests // call case 4: other requests if (var_outDirCache === undefined) raiseUninitializedVariable("outDirCache"); var call132 = request(var_outDir