runtime.js
来自「《JavaScript王者归来》examples.rar」· JavaScript 代码 · 共 169 行 · 第 1/3 页
JS
169 行
// code = code.replace(regExps_comments[0], "").replace(regExps_comments[1], ""); code = code.replace(regExp_package, "$1\r\n$package(\"$5\")"); var packageName = RegExp.$5; code = code.replace(regExp_import, "$1\r\nvar $7 = $import(\"$5\")"); code = code.replace(regExp_super, "$1$class.$super$2"); if (regExp_class.test(code)) { var className = RegExp.$5; var superName = RegExp.$7.replace(/(\s*)extends(\s+)/, ""); var shortClassName = className; if (className.indexOf(".") == -1) { className = packageName + "." + className; } else { shortClassName = className.replace(/\w*\./g, ""); } var str = "\r\nvar $class = " + className + " = function(){return $" + shortClassName + ".apply(this,arguments);};\r\nvar " + shortClassName + " = $class;\r\n"; if (superName == "") { str += "$class.$extends(_JSVM_Namespace.kernel.Object);"; } else { str += "$class.$extends(" + superName + ");"; } str += "\r\nvar $" + shortClassName + " = function("; code = code.replace(regExp_class, "$1\r\n" + str); } else { throw new Exception("JSVM/compiler/jsvm2-parser.parse() " + "error: can't found keyword 'class'."); } for (var i = constStrs.length - 1; i >= 0; i--) { code = code.replace(strings_prefix + i + strings_suffix, constStrs[i]); } return code; }}; })()); // Sets a new console for jsvm2 JSVM.setConsole((function () { var printer; return { "write" : function(msg) { if (!printer) { printer = jsre.JSVM.loadClass("js.io.WebPrinter").newInstance(); printer.prompt = "JSVM Console Output Window [Version " + jsre.currentVersion + "]<br>(C) All Copyright" + " 2004-2007 Homolo Co., Ltd.<br/><br/>"; } printer.print(msg); }, "read" : function () { return window.prompt("JSVM Console; Input: "); } }; })());});
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?