2019-10-04 18:01:16 +08:00
|
|
|
!function(i){var e={};function o(d){if(e[d])return e[d].exports;var _=e[d]={i:d,l:!1,exports:{}};return i[d].call(_.exports,_,_.exports,o),_.l=!0,_.exports}o.m=i,o.c=e,o.d=function(i,e,d){o.o(i,e)||Object.defineProperty(i,e,{enumerable:!0,get:d})},o.r=function(i){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},o.t=function(i,e){if(1&e&&(i=o(i)),8&e)return i;if(4&e&&"object"==typeof i&&i&&i.__esModule)return i;var d=Object.create(null);if(o.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:i}),2&e&&"string"!=typeof i)for(var _ in i)o.d(d,_,function(e){return i[e]}.bind(null,_));return d},o.n=function(i){var e=i&&i.__esModule?function(){return i.default}:function(){return i};return o.d(e,"a",e),e},o.o=function(i,e){return Object.prototype.hasOwnProperty.call(i,e)},o.p="",o(o.s="yL6M")}({"8hIv":function(i,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const d=new DataView(new ArrayBuffer(4));e.reinterpret_i32_as_f32=function(i){return d.setInt32(0,i),d.getFloat32(0)},e.reinterpret_f32_as_i32=function(i){return d.setFloat32(0,i),d.getInt32(0)}},GGSb:function(i,e,o){var d,_;
|
2019-11-05 01:03:54 +08:00
|
|
|
*/!function(O){"use strict";var v,n={};n.VERSION="1.6.0";var t={},P=function(i,e){return function(){return e.apply(i,arguments)}},s=function(){var i,e,o=arguments,d=o[0];for(e=1;e<o.length;e++)for(i in o[e])i in d||!o[e].hasOwnProperty(i)||(d[i]=o[e][i]);return d},E=function(i,e){return{value:i,name:e}};n.TRACE=E(1,"TRACE"),n.DEBUG=E(2,"DEBUG"),n.INFO=E(3,"INFO"),n.TIME=E(4,"TIME"),n.WARN=E(5,"WARN"),n.ERROR=E(8,"ERROR"),n.OFF=E(99,"OFF");var r=function(i){this.context=i,this.setLevel(i.filterLevel),this.log=this.info};r.prototype={setLevel:function(i){i&&"value"in i&&(this.context.filterLevel=i)},getLevel:function(){return this.context.filterLevel},enabledFor:function(i){var e=this.context.filterLevel;return i.value>=e.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(i){"string"==typeof i&&i.length>0&&this.invoke(n.TIME,[i,"start"])},timeEnd:function(i){"string"==typeof i&&i.length>0&&this.invoke(n.TIME,[i,"end"])},invoke:function(i,e){v&&this.enabledFor(i)&&v(e,s({level:i},this.context))}};var D,a=new r({filterLevel:n.OFF});(D=n).enabledFor=P(a,a.enabledFor),D.trace=P(a,a.trace),D.debug=P(a,a.debug),D.time=P(a,a.time),D.timeEnd=P(a,a.timeEnd),D.info=P(a,a.info),D.warn=P(a,a.warn),D.error=P(a,a.error),D.log=D.info,n.setHandler=function(i){v=i},n.setLevel=function(i){for(var e in a.setLevel(i),t)t.hasOwnProperty(e)&&t[e].setLevel(i)},n.getLevel=function(){return a.getLevel()},n.get=function(i){return t[i]||(t[i]=new r(s({name:i},a.context)))},n.createDefaultHandler=function(i){(i=i||{}).formatter=i.formatter||function(i,e){e.name&&i.unshift("["+e.name+"]")};var e={},o=function(i,e){Function.prototype.apply.call(i,console,e)};return"undefined"==typeof console?function(){}:function(d,_){d=Array.prototype.slice.call(d);var O,v=console.log;_.level===n.TIME?(O=(_.name?"["+_.name+"] ":"")+d[0],"start"===d[1]?console.time?console.time(O):e[O]=(new Date).getTime():console.timeEnd?console.timeEnd(O):o(v,[O+": "+((new Date).getTime()-e[O])+"ms"])):(_.level===n.WARN&&console.warn?v=console.warn:_.level===n.ERROR&&console.error?v=console.error:_.level===n.INFO&&console.info?v=console.info:_.level===n.DEBUG&&console.debug?v=console.debug:_.level===n.TRACE&&console.trace&&(v=console.trace),i.formatter(d,_),o(v,d))}},n.useDefaults=function(i){n.setLevel(i&&i.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(i))},void 0===(_="function"==typeof(d=n)?d.call(e,o,e,i):d)||(i.exports=_)}()},JLhb:function(i,e,o){"use strict";var d=this&&this.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(e,"__esModule",{value:!0});const _=d(o("GGSb")),O=o("8hIv"),v=o("ZBxL"),n=o("lg9k"),t=o("ZPAt"),P=_.default.get("quest_editor/scripting/assembly");e.assemble=function(i,e=!1){P.trace("assemble start");const o=new s(i,e).assemble();return P.trace(`assemble end with ${o.warnings.length} warnings and ${o.errors.length} errors.`),o};class s{constructor(i,e){this.assembly=i,this.manual_stack=e,this.lexer=new v.AssemblyLexer,this.first_section_marker=!0,this.prev_line_had_label=!1}assemble(){this.line_no=1,this.object_code=[],this.warnings=[],this.errors=[],this.labels=new Set,this.section=n.SegmentType.Instructions,this.first_section_marker=!0,this.prev_line_had_label=!1;for(const i of this.assembly){if(this.tokens=this.lexer.tokenize_line(i),this.tokens.length>0){const i=this.tokens.shift();let e=!1;switch(i.type){case v.TokenType.Label:this.parse_label(i),e=!0;break;case v.TokenType.CodeSection:case v.TokenType.DataSection:case v.TokenType.StringSection:this.parse_section(i);break;case v.TokenType.Int:this.section===n.SegmentType.Data?this.parse_bytes(i):this.add_error({col:i.col,length:i.len,message:"Unexpected token."});break;case v.TokenType.String:this.section===n.SegmentType.String?this.parse_string(i):this.add_error({col:i.col,length:i.len,message:"Unexpected token."});break;case v.TokenType.Ide
|