nadesiko3 3.6.21 → 3.6.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/batch/command.txt +31 -30
- package/batch/copy_core.nako3 +4 -1
- package/core/README.md +4 -10
- package/core/package-lock.json +5 -5
- package/core/package.json +1 -1
- package/core/src/nako_ast.mts +1 -0
- package/core/src/nako_core_version.mjs +2 -2
- package/core/src/nako_core_version.mts +2 -2
- package/core/src/nako_gen.mjs +8 -5
- package/core/src/nako_gen.mts +8 -5
- package/core/src/nako_parser3.mjs +8 -0
- package/core/src/nako_parser3.mts +4 -2
- package/core/test/dncl2_test.mjs +2 -2
- package/core/test/flow_test.mjs +18 -0
- package/package.json +4 -3
- package/release/_hash.txt +28 -28
- package/release/_script-tags.txt +33 -33
- package/release/command.json +1 -1
- package/release/command.json.js +1 -1
- package/release/command_cnako3.json +1 -1
- package/release/command_list.json +1 -1
- package/release/edit_main.js +1 -1
- package/release/edit_main.js.map +2 -2
- package/release/editor.js +1 -1
- package/release/version.js +1 -1
- package/release/version_main.js +1 -1
- package/release/version_main.js.map +1 -1
- package/release/wnako3.js +36 -35
- package/release/wnako3.js.map +3 -3
- package/release/wnako3webworker.js +50 -49
- package/release/wnako3webworker.js.map +3 -3
- package/src/nako_version.mjs +2 -2
- package/src/nako_version.mts +2 -2
- package/src/plugin_browser_dom_parts.mjs +16 -1
- package/src/plugin_browser_dom_parts.mts +12 -1
- package/tools/nako3edit/html/files.html +5 -1
- package/tools/nako3edit/html/plugins.html +134 -0
- package/tools/nako3edit/index.mjs +55 -7
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";(()=>{var C={and:1,or:1,eq:2,noteq:2,"===":2,"!==":2,gt:2,gteq:2,lt:2,lteq:2,"&":3,"+":4,"-":4,shift_l:4,shift_r:4,shift_r0:4,"*":5,"/":5,"\xF7":5,"\xF7\xF7":5,"%":5,"^":6,"**":6},R=["\u3044\u3066","\u3048\u3066","\u304D\u3066","\u3051\u3066","\u3057\u3066","\u3063\u3066","\u306B\u3066","\u307F\u3066","\u3081\u3066","\u306D\u3066","\u306B\u306F","\u3093\u3067"],K=[];for(let n in C)K.push(n);function j(n="?",e="",t=-1,r=0,s="main.nako3"){return{type:n,value:e,indent:t,line:r,column:0,file:s,josi:""}}var Z=class{constructor(e){this.logger=e,this.stackList=[],this.tokens=[],this.usedFuncs=new Set,this.stack=[],this.index=0,this.y=[],this.modName="inline",this.namespaceStack=[],this.modList=[],this.funclist=new Map,this.funcLevel=0,this.usedAsyncFn=!1,this.localvars=new Map([["\u305D\u308C",{type:"var",value:""}]]),this.genMode="sync",this.arrayIndexFrom=0,this.flagReverseArrayIndex=!1,this.flagCheckArrayInit=!1,this.recentlyCalledFunc=[],this.isReadingCalc=!1,this.isExportDefault=!0,this.isExportStack=[],this.moduleExport=new Map,this.isModifiedNodes=!1,this.init()}init(){this.funclist=new Map,this.moduleExport=new Map,this.reset()}reset(){this.tokens=[],this.index=0,this.stack=[],this.y=[],this.genMode="sync"}setFuncList(e){this.funclist=e}setModuleExport(e){this.moduleExport=e}popStack(e=void 0){if(!e){let t=this.stack.pop();return t||null}for(let t=this.stack.length-1;t>=0;t--){let r=this.stack[t];if(e.length===0||e.indexOf(r.josi)>=0)return this.stack.splice(t,1),this.logger.trace("POP :"+JSON.stringify(r)),r}return null}saveStack(){this.stackList.push(this.stack),this.stack=[]}loadStack(){this.stack=this.stackList.pop()}findVar(e){if(this.localvars.get(e))return{name:e,scope:"local",info:this.localvars.get(e)};if(e.indexOf("__")>=0)return this.funclist.get(e)?{name:e,scope:"global",info:this.funclist.get(e)}:void 0;let t=`${this.modName}__${e}`;if(this.funclist.get(t))return{name:t,scope:"global",info:this.funclist.get(t)};for(let r of this.modList){let s=`${r}__${e}`,i=this.moduleExport.get(r),o=this.funclist.get(s);if(o&&(o.isExport===!0||o.isExport!==!1&&i!==!1))return{name:s,scope:"global",info:this.funclist.get(s)}}if(this.funclist.get(e))return{name:e,scope:"system",info:this.funclist.get(e)}}pushStack(e){this.logger.trace("PUSH:"+JSON.stringify(e)),this.stack.push(e)}isEOF(){return this.index>=this.tokens.length}getIndex(){return this.index}check(e){return this.tokens[this.index].type===e}check2(e){for(let t=0;t<e.length;t++){let r=t+this.index;if(this.tokens.length<=r)return!1;if(e[t]==="*")continue;let s=this.tokens[r];if(e[t]instanceof Array){if(e[t].indexOf(s.type)<0)return!1;continue}if(s.type!==e[t])return!1}return!0}checkTypes(e){let t=this.tokens[this.index].type;return e.indexOf(t)>=0}accept(e){let t=[],r=this.index,s=()=>(this.index=r,!1);for(let i=0;i<e.length;i++){if(this.isEOF())return s();let o=e[i];if(o==null)return s();if(typeof o=="string"){let u=this.get();if(u&&u.type!==o)return s();t[i]=u;continue}if(typeof o=="function"){let c=o.bind(this)(t);if(c===null)return s();t[i]=c;continue}if(o instanceof Array){if(!this.checkTypes(o))return s();t[i]=this.get();continue}throw new Error("System Error : accept broken : "+typeof o)}return this.y=t,!0}get(){return this.isEOF()?null:this.tokens[this.index++]}getCur(){if(this.isEOF())throw new Error("\u30C8\u30FC\u30AF\u30F3\u304C\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3002");let e=this.tokens[this.index++];if(!e)throw new Error("\u30C8\u30FC\u30AF\u30F3\u304C\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3002");return e}unget(){this.index>0&&this.index--}peek(e=0){return this.isEOF()?null:this.tokens[this.index+e]}peekDef(e=null){return this.isEOF()?(e||(e=j()),e):this.tokens[this.index]}peekSourceMap(e=void 0){let t=e===void 0?this.peek():e;return t===null?{startOffset:void 0,endOffset:void 0,file:void 0,line:0,column:0}:{startOffset:t.startOffset,endOffset:t.endOffset,file:t.file,line:t.line,column:t.column}}nodeToStr(e,t,r){let s=t.depth-1,i=u=>t.typeName!==void 0?t.typeName:u,o=r?" debug: "+JSON.stringify(e,null,2):"";if(!e)return"(NULL)";switch(e.type){case"not":if(s>=0){let u=e.blocks[0];return`${i("")}\u300E${this.nodeToStr(u,{depth:s},r)}\u306B\u6F14\u7B97\u5B50\u300Enot\u300F\u3092\u9069\u7528\u3057\u305F\u5F0F${o}\u300F`}else return`${i("\u6F14\u7B97\u5B50")}\u300Enot\u300F`;case"op":{let u=e,c=u.operator||"",a={eq:"\uFF1D",not:"!",gt:">",lt:"<",and:"\u304B\u3064",or:"\u307E\u305F\u306F"};if(c in a&&(c=a[c]),s>=0){let f=this.nodeToStr(u.blocks[0],{depth:s},r),l=this.nodeToStr(u.blocks[1],{depth:s},r);return u.operator==="eq"?`${i("")}\u300E${f}\u3068${l}\u304C\u7B49\u3057\u3044\u304B\u3069\u3046\u304B\u306E\u6BD4\u8F03${o}\u300F`:`${i("")}\u300E${f}\u3068${l}\u306B\u6F14\u7B97\u5B50\u300E${c}\u300F\u3092\u9069\u7528\u3057\u305F\u5F0F${o}\u300F`}else return`${i("\u6F14\u7B97\u5B50")}\u300E${c}${o}\u300F`}case"number":return`${i("\u6570\u5024")}${e.value}`;case"bigint":return`${i("\u5DE8\u5927\u6574\u6570")}${e.value}`;case"string":return`${i("\u6587\u5B57\u5217")}\u300E${e.value}${o}\u300F`;case"word":return`${i("\u5358\u8A9E")}\u300E${e.value}${o}\u300F`;case"func":return`${i("\u95A2\u6570")}\u300E${e.name||e.value}${o}\u300F`;case"eol":return"\u884C\u306E\u672B\u5C3E";case"eof":return"\u30D5\u30A1\u30A4\u30EB\u306E\u672B\u5C3E";default:{let u=e.name;return u&&(u=e.value),typeof u!="string"&&(u=e.type),`${i("")}\u300E${u}${o}\u300F`}}}};var O=class extends Error{constructor(e,t,r=void 0,s=void 0){let i=`${r||""}${s===void 0?"":`(${s+1}\u884C\u76EE): `}`;t=t.replace(/『main__(.+?)』/g,"\u300E$1\u300F"),super(`[${e}]${i}${t}`),this.name="NakoError",this.type="NakoError",this.tag="["+e+"]",this.positionJa=i,this.msg=t}},Q=class extends O{constructor(e,t,r){super("\u30A4\u30F3\u30C7\u30F3\u30C8\u30A8\u30E9\u30FC",e,r,t),this.type="NakoIndentError",this.line=t,this.file=r}},M=class extends O{constructor(e,t,r,s,i){super("\u5B57\u53E5\u89E3\u6790\u30A8\u30E9\u30FC\uFF08\u5185\u90E8\u30A8\u30E9\u30FC\uFF09",e,i,s),this.type="InternalLexerError",this.preprocessedCodeStartOffset=t,this.preprocessedCodeEndOffset=r,this.line=s,this.file=i}},P=class extends O{constructor(e,t,r,s,i){super("\u5B57\u53E5\u89E3\u6790\u30A8\u30E9\u30FC",e,i,s),this.type="NakoLexerError",this.startOffset=t,this.endOffset=r,this.line=s,this.file=i}},d=class n extends O{static fromNode(e,t,r=void 0){if(!t)return new n(e,void 0,void 0,void 0,void 0);let s=typeof t.startOffset=="number"?t.startOffset:void 0,i=r&&typeof r.endOffset=="number"?r.endOffset:typeof t.endOffset=="number"?t.endOffset:void 0;return new n(e,t.line,s,i,t.file)}constructor(e,t,r,s,i){super("\u6587\u6CD5\u30A8\u30E9\u30FC",e,i,t),this.type="NakoSyntaxError",this.file=i,this.line=t,this.startOffset=r,this.endOffset=s}},D=class n extends O{constructor(e,t){let r="unknown";typeof e=="string"?r=e:e instanceof n||e instanceof O?r=e.msg:e instanceof Error&&(e.name==="Error"?r=e.message:r=`${e.name}: ${e.message}`);let s,i,o;t===void 0?(s=void 0,i=void 0):(o=/^l(-?\d+):(.*)$/.exec(t))?(s=parseInt(o[1]),i=o[2]):(o=/^l(-?\d+)$/.exec(t))?(s=parseInt(o[1]),i="main.nako3"):(s=0,i=t),super("\u5B9F\u884C\u6642\u30A8\u30E9\u30FC",r,i,s),this.type="NakoRuntimeError",this.lineNo=t,this.line=s,this.file=i}},q=class extends O{constructor(e,t,r){super("\u53D6\u308A\u8FBC\u307F\u30A8\u30E9\u30FC",e,t,r),this.file=t,this.line=r}};var nt=new Map([["\u3082\u3057","\u3082\u3057"],["\u56DE","\u56DE"],["\u56DE\u7E70\u8FD4","\u56DE"],["\u9593","\u9593"],["\u9593\u7E70\u8FD4","\u9593"],["\u7E70\u8FD4","\u7E70\u8FD4"],["\u5897\u7E70\u8FD4","\u5897\u7E70\u8FD4"],["\u6E1B\u7E70\u8FD4","\u6E1B\u7E70\u8FD4"],["\u5F8C\u5224\u5B9A","\u5F8C\u5224\u5B9A"],["\u53CD\u5FA9","\u53CD\u5FA9"],["\u629C","\u629C\u3051\u308B"],["\u7D9A","\u7D9A\u3051\u308B"],["\u623B","\u623B\u308B"],["\u5148","\u5148\u306B"],["\u6B21","\u6B21\u306B"],["\u4EE3\u5165","\u4EE3\u5165"],["\u5B9F\u884C\u901F\u5EA6\u512A\u5148","\u5B9F\u884C\u901F\u5EA6\u512A\u5148"],["\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u30E2\u30CB\u30BF\u9069\u7528","\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u30E2\u30CB\u30BF\u9069\u7528"],["\u5B9A","\u5B9A\u3081\u308B"],["\u9010\u6B21\u5B9F\u884C","\u9010\u6B21\u5B9F\u884C"],["\u6761\u4EF6\u5206\u5C90","\u6761\u4EF6\u5206\u5C90"],["\u5897","\u5897"],["\u6E1B","\u6E1B"],["\u5909\u6570","\u5909\u6570"],["\u5B9A\u6570","\u5B9A\u6570"],["\u30A8\u30E9\u30FC\u76E3\u8996","\u30A8\u30E9\u30FC\u76E3\u8996"],["\u30A8\u30E9\u30FC","\u30A8\u30E9\u30FC"],["\u305D\u308C","word"],["\u305D\u3046","word"],["\u95A2\u6570","def_func"],["\u30A4\u30F3\u30C7\u30F3\u30C8\u69CB\u6587","\u30A4\u30F3\u30C7\u30F3\u30C8\u69CB\u6587"],["\u975E\u540C\u671F\u30E2\u30FC\u30C9","\u975E\u540C\u671F\u30E2\u30FC\u30C9"],["DNCL\u30E2\u30FC\u30C9","DNCL\u30E2\u30FC\u30C9"],["DNCL2\u30E2\u30FC\u30C9","DNCL2\u30E2\u30FC\u30C9"],["\u30E2\u30FC\u30C9\u8A2D\u5B9A","\u30E2\u30FC\u30C9\u8A2D\u5B9A"],["\u53D6\u8FBC","\u53D6\u8FBC"],["\u30E2\u30B8\u30E5\u30FC\u30EB\u516C\u958B\u65E2\u5B9A\u5024","\u30E2\u30B8\u30E5\u30FC\u30EB\u516C\u958B\u65E2\u5B9A\u5024"],["\u53B3\u30C1\u30A7\u30C3\u30AF","\u53B3\u30C1\u30A7\u30C3\u30AF"]]),he=nt;function $e(n){let e=n.charCodeAt(0);return n===" "?4:n===" "||n==="|"?1:n==="\u30FB"||n==="\u3000"||n==="\u23CB"||n==="\u23CC"||e>=9472&&e<=9599||e>=9120&&e<=9135||e>=9144&&e<=9151?2:0}var te=["\u306B\u3064\u3044\u3066","\u304F\u3089\u3044","\u306A\u306E\u304B","\u307E\u3067\u3092","\u307E\u3067\u306E","\u306B\u3088\u308B","\u3068\u306F","\u304B\u3089","\u307E\u3067","\u3060\u3051","\u3088\u308A","\u307B\u3069","\u306A\u3069","\u3044\u3066","\u3048\u3066","\u304D\u3066","\u3051\u3066","\u3057\u3066","\u3063\u3066","\u306B\u3066","\u307F\u3066","\u3081\u3066","\u306D\u3066","\u3067\u306F","\u306B\u306F","\u306F~","\u3093\u3067","\u305A\u3064","\u306F","\u3092","\u306B","\u3078","\u3067","\u3068","\u304C","\u306E"],rt=["\u3067\u306A\u3051\u308C\u3070","\u306A\u3051\u308C\u3070","\u306A\u3089\u3070","\u306A\u3089","\u305F\u3089","\u308C\u3070"],st=["\u3053\u3068","\u3067\u3042\u308B","\u3067\u3059","\u3057\u307E\u3059","\u3067\u3057\u305F"],pe={};rt.forEach(n=>{te.push(n),pe[n]=!0});var G={};st.forEach(n=>{te.push(n),G[n]=!0});var ee=[];for(let n of te)ee.push("\u3082\u306E"+n),ee.push(n);ee.sort((n,e)=>e.length-n.length);var it="^[\\t ]*("+ee.join("|")+")",z=new RegExp(it),Ne=te;var ot=/^[\u3005\u4E00-\u9FCF_a-zA-Z0-9ァ-ヶー\u2460-\u24FF\u2776-\u277F\u3251-\u32BF]+/,Fe=/^[ぁ-ん]/,ut=/^[ぁ-ん]+$/,ct=/^.+(以上|以下|超|未満)$/,at=/^(かつ|または)/,Ae=n=>function(){throw new Error("\u7A81\u7136\u306E\u300E"+n+"\u300F\u304C\u3042\u308A\u307E\u3059\u3002")},Oe=/^(円|ドル|元|歩|㎡|坪|度|℃|°|個|つ|本|冊|才|歳|匹|枚|皿|セット|羽|人|件|行|列|機|品|m|mm|cm|km|g|kg|t|px|dot|pt|em|b|mb|kb|gb)/,Ee=[{name:"\u3053\u3053\u307E\u3067",pattern:/^;;;/},{name:"eol",pattern:/^\n/},{name:"eol",pattern:/^;/},{name:"space",pattern:/^(\x20|\x09|・|⎿ |└||)+/},{name:"comma",pattern:/^,/},{name:"line_comment",pattern:/^#[^\n]*/},{name:"line_comment",pattern:/^\/\/[^\n]*/},{name:"range_comment",pattern:/^\/\*/,cbParser:lt},{name:"def_test",pattern:/^●テスト:/},{name:"def_func",pattern:/^●/},{name:"\u2026",pattern:/^…/},{name:"\u2026",pattern:/^\.{2,3}/},{name:"bigint",pattern:/^0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*n/,readJosi:!0},{name:"bigint",pattern:/^0[oO][0-7]+(_[0-7]+)*n/,readJosi:!0},{name:"bigint",pattern:/^0[bB][0-1]+(_[0-1]+)*n/,readJosi:!0},{name:"bigint",pattern:/^\d+(_\d+)*?n/,readJosi:!0},{name:"number",pattern:/^0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*/,readJosi:!0,cb:B},{name:"number",pattern:/^0[oO][0-7]+(_[0-7]+)*/,readJosi:!0,cb:B},{name:"number",pattern:/^0[bB][0-1]+(_[0-1]+)*/,readJosi:!0,cb:B},{name:"number",pattern:/^\d+(_\d+)*\.(\d+(_\d+)*)?([eE][+|-]?\d+(_\d+)*)?/,readJosi:!0,cb:B},{name:"number",pattern:/^\.\d+(_\d+)*([eE][+|-]?\d+(_\d+)*)?/,readJosi:!0,cb:B},{name:"number",pattern:/^\d+(_\d+)*([eE][+|-]?\d+(_\d+)*)?/,readJosi:!0,cb:B},{name:"\u3053\u3053\u304B\u3089",pattern:/^(ここから),?/},{name:"\u3053\u3053\u307E\u3067",pattern:/^(ここまで|💧)/},{name:"\u3082\u3057",pattern:/^もしも?/},{name:"\u9055\u3048\u3070",pattern:/^違(えば)?/},{name:"shift_r0",pattern:/^>>>/},{name:"shift_r",pattern:/^>>/},{name:"shift_l",pattern:/^<</},{name:"===",pattern:/^===/},{name:"!==",pattern:/^!==/},{name:"gteq",pattern:/^(≧|>=|=>)/},{name:"lteq",pattern:/^(≦|<=|=<)/},{name:"noteq",pattern:/^(≠|<>|!=)/},{name:"\u2190",pattern:/^(←|<--)/},{name:"eq",pattern:/^(==|🟰🟰)/},{name:"eq",pattern:/^(=|🟰)/},{name:"line_comment",pattern:/^(!|💡)(インデント構文|ここまでだるい|DNCLモード|DNCL2モード|DNCL2)[^\n]*/},{name:"not",pattern:/^(!|💡)/},{name:"gt",pattern:/^>/},{name:"lt",pattern:/^</},{name:"and",pattern:/^(かつ|&&|and\s)/},{name:"or",pattern:/^(または|或いは|あるいは|or\s|\|\|)/},{name:"@",pattern:/^@/},{name:"+",pattern:/^\+/},{name:"-",pattern:/^-/},{name:"**",pattern:/^(××|\*\*)/},{name:"*",pattern:/^(×|\*)/},{name:"\xF7\xF7",pattern:/^÷÷/},{name:"\xF7",pattern:/^(÷|\/)/},{name:"%",pattern:/^%/},{name:"^",pattern:/^\^/},{name:"&",pattern:/^&/},{name:"[",pattern:/^\[/},{name:"]",pattern:/^]/,readJosi:!0},{name:"(",pattern:/^\(/},{name:")",pattern:/^\)/,readJosi:!0},{name:"|",pattern:/^\|/},{name:"??",pattern:/^\?\?/},{name:"string",pattern:/^🌿/,cbParser:n=>J("\u{1F33F}","\u{1F33F}",n)},{name:"string_ex",pattern:/^🌴/,cbParser:n=>J("\u{1F334}","\u{1F334}",n)},{name:"string_ex",pattern:/^「/,cbParser:n=>J("\u300C","\u300D",n)},{name:"string",pattern:/^『/,cbParser:n=>J("\u300E","\u300F",n)},{name:"string_ex",pattern:/^“/,cbParser:n=>J("\u201C","\u201D",n)},{name:"string_ex",pattern:/^"/,cbParser:n=>J('"','"',n)},{name:"string",pattern:/^'/,cbParser:n=>J("'","'",n)},{name:"\u300D",pattern:/^」/,cbParser:Ae("\u300D")},{name:"\u300F",pattern:/^』/,cbParser:Ae("\u300F")},{name:"func",pattern:/^\{関数\},?/},{name:"{",pattern:/^\{/},{name:"}",pattern:/^\}/,readJosi:!0},{name:":",pattern:/^:/},{name:"_eol",pattern:/^_\s*\n/},{name:"dec_lineno",pattern:/^‰/},{name:"word",pattern:/^[\uD800-\uDBFF][\uDC00-\uDFFF][_a-zA-Z0-9]*/,readJosi:!0},{name:"word",pattern:/^[\u1F60-\u1F6F][_a-zA-Z0-9]*/,readJosi:!0},{name:"word",pattern:/^《.+?》/,readJosi:!0},{name:"word",pattern:/^[_a-zA-Z\u3005\u4E00-\u9FCFぁ-んァ-ヶ\u2460-\u24FF\u2776-\u277F\u3251-\u32BF]/,cbParser:ht}];function ft(n){return Fe.test(n)?ut.test(n)?n:n.replace(/[ぁ-ん]+$/g,""):n.replace(/[ぁ-ん]+/g,"")}function lt(n){let e="",t="",r=0;n=n.substring(2);let s=n.indexOf("*/");s<0?(e=n,n=""):(e=n.substring(0,s),n=n.substring(s+2));for(let i=0;i<e.length;i++)e.charAt(i)===`
|
|
1
|
+
"use strict";(()=>{var C={and:1,or:1,eq:2,noteq:2,"===":2,"!==":2,gt:2,gteq:2,lt:2,lteq:2,"&":3,"+":4,"-":4,shift_l:4,shift_r:4,shift_r0:4,"*":5,"/":5,"\xF7":5,"\xF7\xF7":5,"%":5,"^":6,"**":6},R=["\u3044\u3066","\u3048\u3066","\u304D\u3066","\u3051\u3066","\u3057\u3066","\u3063\u3066","\u306B\u3066","\u307F\u3066","\u3081\u3066","\u306D\u3066","\u306B\u306F","\u3093\u3067"],K=[];for(let n in C)K.push(n);function x(n="?",e="",t=-1,r=0,s="main.nako3"){return{type:n,value:e,indent:t,line:r,column:0,file:s,josi:""}}var Z=class{constructor(e){this.logger=e,this.stackList=[],this.tokens=[],this.usedFuncs=new Set,this.stack=[],this.index=0,this.y=[],this.modName="inline",this.namespaceStack=[],this.modList=[],this.funclist=new Map,this.funcLevel=0,this.usedAsyncFn=!1,this.localvars=new Map([["\u305D\u308C",{type:"var",value:""}]]),this.genMode="sync",this.arrayIndexFrom=0,this.flagReverseArrayIndex=!1,this.flagCheckArrayInit=!1,this.recentlyCalledFunc=[],this.isReadingCalc=!1,this.isExportDefault=!0,this.isExportStack=[],this.moduleExport=new Map,this.isModifiedNodes=!1,this.init()}init(){this.funclist=new Map,this.moduleExport=new Map,this.reset()}reset(){this.tokens=[],this.index=0,this.stack=[],this.y=[],this.genMode="sync"}setFuncList(e){this.funclist=e}setModuleExport(e){this.moduleExport=e}popStack(e=void 0){if(!e){let t=this.stack.pop();return t||null}for(let t=this.stack.length-1;t>=0;t--){let r=this.stack[t];if(e.length===0||e.indexOf(r.josi)>=0)return this.stack.splice(t,1),this.logger.trace("POP :"+JSON.stringify(r)),r}return null}saveStack(){this.stackList.push(this.stack),this.stack=[]}loadStack(){this.stack=this.stackList.pop()}findVar(e){if(this.localvars.get(e))return{name:e,scope:"local",info:this.localvars.get(e)};if(e.indexOf("__")>=0)return this.funclist.get(e)?{name:e,scope:"global",info:this.funclist.get(e)}:void 0;let t=`${this.modName}__${e}`;if(this.funclist.get(t))return{name:t,scope:"global",info:this.funclist.get(t)};for(let r of this.modList){let s=`${r}__${e}`,i=this.moduleExport.get(r),o=this.funclist.get(s);if(o&&(o.isExport===!0||o.isExport!==!1&&i!==!1))return{name:s,scope:"global",info:this.funclist.get(s)}}if(this.funclist.get(e))return{name:e,scope:"system",info:this.funclist.get(e)}}pushStack(e){this.logger.trace("PUSH:"+JSON.stringify(e)),this.stack.push(e)}isEOF(){return this.index>=this.tokens.length}getIndex(){return this.index}check(e){return this.tokens[this.index].type===e}check2(e){for(let t=0;t<e.length;t++){let r=t+this.index;if(this.tokens.length<=r)return!1;if(e[t]==="*")continue;let s=this.tokens[r];if(e[t]instanceof Array){if(e[t].indexOf(s.type)<0)return!1;continue}if(s.type!==e[t])return!1}return!0}checkTypes(e){let t=this.tokens[this.index].type;return e.indexOf(t)>=0}accept(e){let t=[],r=this.index,s=()=>(this.index=r,!1);for(let i=0;i<e.length;i++){if(this.isEOF())return s();let o=e[i];if(o==null)return s();if(typeof o=="string"){let u=this.get();if(u&&u.type!==o)return s();t[i]=u;continue}if(typeof o=="function"){let c=o.bind(this)(t);if(c===null)return s();t[i]=c;continue}if(o instanceof Array){if(!this.checkTypes(o))return s();t[i]=this.get();continue}throw new Error("System Error : accept broken : "+typeof o)}return this.y=t,!0}get(){return this.isEOF()?null:this.tokens[this.index++]}getCur(){if(this.isEOF())throw new Error("\u30C8\u30FC\u30AF\u30F3\u304C\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3002");let e=this.tokens[this.index++];if(!e)throw new Error("\u30C8\u30FC\u30AF\u30F3\u304C\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3002");return e}unget(){this.index>0&&this.index--}peek(e=0){return this.isEOF()?null:this.tokens[this.index+e]}peekDef(e=null){return this.isEOF()?(e||(e=x()),e):this.tokens[this.index]}peekSourceMap(e=void 0){let t=e===void 0?this.peek():e;return t===null?{startOffset:void 0,endOffset:void 0,file:void 0,line:0,column:0}:{startOffset:t.startOffset,endOffset:t.endOffset,file:t.file,line:t.line,column:t.column}}nodeToStr(e,t,r){let s=t.depth-1,i=u=>t.typeName!==void 0?t.typeName:u,o=r?" debug: "+JSON.stringify(e,null,2):"";if(!e)return"(NULL)";switch(e.type){case"not":if(s>=0){let u=e.blocks[0];return`${i("")}\u300E${this.nodeToStr(u,{depth:s},r)}\u306B\u6F14\u7B97\u5B50\u300Enot\u300F\u3092\u9069\u7528\u3057\u305F\u5F0F${o}\u300F`}else return`${i("\u6F14\u7B97\u5B50")}\u300Enot\u300F`;case"op":{let u=e,c=u.operator||"",a={eq:"\uFF1D",not:"!",gt:">",lt:"<",and:"\u304B\u3064",or:"\u307E\u305F\u306F"};if(c in a&&(c=a[c]),s>=0){let f=this.nodeToStr(u.blocks[0],{depth:s},r),l=this.nodeToStr(u.blocks[1],{depth:s},r);return u.operator==="eq"?`${i("")}\u300E${f}\u3068${l}\u304C\u7B49\u3057\u3044\u304B\u3069\u3046\u304B\u306E\u6BD4\u8F03${o}\u300F`:`${i("")}\u300E${f}\u3068${l}\u306B\u6F14\u7B97\u5B50\u300E${c}\u300F\u3092\u9069\u7528\u3057\u305F\u5F0F${o}\u300F`}else return`${i("\u6F14\u7B97\u5B50")}\u300E${c}${o}\u300F`}case"number":return`${i("\u6570\u5024")}${e.value}`;case"bigint":return`${i("\u5DE8\u5927\u6574\u6570")}${e.value}`;case"string":return`${i("\u6587\u5B57\u5217")}\u300E${e.value}${o}\u300F`;case"word":return`${i("\u5358\u8A9E")}\u300E${e.value}${o}\u300F`;case"func":return`${i("\u95A2\u6570")}\u300E${e.name||e.value}${o}\u300F`;case"eol":return"\u884C\u306E\u672B\u5C3E";case"eof":return"\u30D5\u30A1\u30A4\u30EB\u306E\u672B\u5C3E";default:{let u=e.name;return u&&(u=e.value),typeof u!="string"&&(u=e.type),`${i("")}\u300E${u}${o}\u300F`}}}};var O=class extends Error{constructor(e,t,r=void 0,s=void 0){let i=`${r||""}${s===void 0?"":`(${s+1}\u884C\u76EE): `}`;t=t.replace(/『main__(.+?)』/g,"\u300E$1\u300F"),super(`[${e}]${i}${t}`),this.name="NakoError",this.type="NakoError",this.tag="["+e+"]",this.positionJa=i,this.msg=t}},Q=class extends O{constructor(e,t,r){super("\u30A4\u30F3\u30C7\u30F3\u30C8\u30A8\u30E9\u30FC",e,r,t),this.type="NakoIndentError",this.line=t,this.file=r}},M=class extends O{constructor(e,t,r,s,i){super("\u5B57\u53E5\u89E3\u6790\u30A8\u30E9\u30FC\uFF08\u5185\u90E8\u30A8\u30E9\u30FC\uFF09",e,i,s),this.type="InternalLexerError",this.preprocessedCodeStartOffset=t,this.preprocessedCodeEndOffset=r,this.line=s,this.file=i}},P=class extends O{constructor(e,t,r,s,i){super("\u5B57\u53E5\u89E3\u6790\u30A8\u30E9\u30FC",e,i,s),this.type="NakoLexerError",this.startOffset=t,this.endOffset=r,this.line=s,this.file=i}},d=class n extends O{static fromNode(e,t,r=void 0){if(!t)return new n(e,void 0,void 0,void 0,void 0);let s=typeof t.startOffset=="number"?t.startOffset:void 0,i=r&&typeof r.endOffset=="number"?r.endOffset:typeof t.endOffset=="number"?t.endOffset:void 0;return new n(e,t.line,s,i,t.file)}constructor(e,t,r,s,i){super("\u6587\u6CD5\u30A8\u30E9\u30FC",e,i,t),this.type="NakoSyntaxError",this.file=i,this.line=t,this.startOffset=r,this.endOffset=s}},D=class n extends O{constructor(e,t){let r="unknown";typeof e=="string"?r=e:e instanceof n||e instanceof O?r=e.msg:e instanceof Error&&(e.name==="Error"?r=e.message:r=`${e.name}: ${e.message}`);let s,i,o;t===void 0?(s=void 0,i=void 0):(o=/^l(-?\d+):(.*)$/.exec(t))?(s=parseInt(o[1]),i=o[2]):(o=/^l(-?\d+)$/.exec(t))?(s=parseInt(o[1]),i="main.nako3"):(s=0,i=t),super("\u5B9F\u884C\u6642\u30A8\u30E9\u30FC",r,i,s),this.type="NakoRuntimeError",this.lineNo=t,this.line=s,this.file=i}},q=class extends O{constructor(e,t,r){super("\u53D6\u308A\u8FBC\u307F\u30A8\u30E9\u30FC",e,t,r),this.file=t,this.line=r}};var nt=new Map([["\u3082\u3057","\u3082\u3057"],["\u56DE","\u56DE"],["\u56DE\u7E70\u8FD4","\u56DE"],["\u9593","\u9593"],["\u9593\u7E70\u8FD4","\u9593"],["\u7E70\u8FD4","\u7E70\u8FD4"],["\u5897\u7E70\u8FD4","\u5897\u7E70\u8FD4"],["\u6E1B\u7E70\u8FD4","\u6E1B\u7E70\u8FD4"],["\u5F8C\u5224\u5B9A","\u5F8C\u5224\u5B9A"],["\u53CD\u5FA9","\u53CD\u5FA9"],["\u629C","\u629C\u3051\u308B"],["\u7D9A","\u7D9A\u3051\u308B"],["\u623B","\u623B\u308B"],["\u5148","\u5148\u306B"],["\u6B21","\u6B21\u306B"],["\u4EE3\u5165","\u4EE3\u5165"],["\u5B9F\u884C\u901F\u5EA6\u512A\u5148","\u5B9F\u884C\u901F\u5EA6\u512A\u5148"],["\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u30E2\u30CB\u30BF\u9069\u7528","\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u30E2\u30CB\u30BF\u9069\u7528"],["\u5B9A","\u5B9A\u3081\u308B"],["\u9010\u6B21\u5B9F\u884C","\u9010\u6B21\u5B9F\u884C"],["\u6761\u4EF6\u5206\u5C90","\u6761\u4EF6\u5206\u5C90"],["\u5897","\u5897"],["\u6E1B","\u6E1B"],["\u5909\u6570","\u5909\u6570"],["\u5B9A\u6570","\u5B9A\u6570"],["\u30A8\u30E9\u30FC\u76E3\u8996","\u30A8\u30E9\u30FC\u76E3\u8996"],["\u30A8\u30E9\u30FC","\u30A8\u30E9\u30FC"],["\u305D\u308C","word"],["\u305D\u3046","word"],["\u95A2\u6570","def_func"],["\u30A4\u30F3\u30C7\u30F3\u30C8\u69CB\u6587","\u30A4\u30F3\u30C7\u30F3\u30C8\u69CB\u6587"],["\u975E\u540C\u671F\u30E2\u30FC\u30C9","\u975E\u540C\u671F\u30E2\u30FC\u30C9"],["DNCL\u30E2\u30FC\u30C9","DNCL\u30E2\u30FC\u30C9"],["DNCL2\u30E2\u30FC\u30C9","DNCL2\u30E2\u30FC\u30C9"],["\u30E2\u30FC\u30C9\u8A2D\u5B9A","\u30E2\u30FC\u30C9\u8A2D\u5B9A"],["\u53D6\u8FBC","\u53D6\u8FBC"],["\u30E2\u30B8\u30E5\u30FC\u30EB\u516C\u958B\u65E2\u5B9A\u5024","\u30E2\u30B8\u30E5\u30FC\u30EB\u516C\u958B\u65E2\u5B9A\u5024"],["\u53B3\u30C1\u30A7\u30C3\u30AF","\u53B3\u30C1\u30A7\u30C3\u30AF"]]),he=nt;function $e(n){let e=n.charCodeAt(0);return n===" "?4:n===" "||n==="|"?1:n==="\u30FB"||n==="\u3000"||n==="\u23CB"||n==="\u23CC"||e>=9472&&e<=9599||e>=9120&&e<=9135||e>=9144&&e<=9151?2:0}var te=["\u306B\u3064\u3044\u3066","\u304F\u3089\u3044","\u306A\u306E\u304B","\u307E\u3067\u3092","\u307E\u3067\u306E","\u306B\u3088\u308B","\u3068\u306F","\u304B\u3089","\u307E\u3067","\u3060\u3051","\u3088\u308A","\u307B\u3069","\u306A\u3069","\u3044\u3066","\u3048\u3066","\u304D\u3066","\u3051\u3066","\u3057\u3066","\u3063\u3066","\u306B\u3066","\u307F\u3066","\u3081\u3066","\u306D\u3066","\u3067\u306F","\u306B\u306F","\u306F~","\u3093\u3067","\u305A\u3064","\u306F","\u3092","\u306B","\u3078","\u3067","\u3068","\u304C","\u306E"],rt=["\u3067\u306A\u3051\u308C\u3070","\u306A\u3051\u308C\u3070","\u306A\u3089\u3070","\u306A\u3089","\u305F\u3089","\u308C\u3070"],st=["\u3053\u3068","\u3067\u3042\u308B","\u3067\u3059","\u3057\u307E\u3059","\u3067\u3057\u305F"],pe={};rt.forEach(n=>{te.push(n),pe[n]=!0});var G={};st.forEach(n=>{te.push(n),G[n]=!0});var ee=[];for(let n of te)ee.push("\u3082\u306E"+n),ee.push(n);ee.sort((n,e)=>e.length-n.length);var it="^[\\t ]*("+ee.join("|")+")",z=new RegExp(it),Ne=te;var ot=/^[\u3005\u4E00-\u9FCF_a-zA-Z0-9ァ-ヶー\u2460-\u24FF\u2776-\u277F\u3251-\u32BF]+/,Fe=/^[ぁ-ん]/,ut=/^[ぁ-ん]+$/,ct=/^.+(以上|以下|超|未満)$/,at=/^(かつ|または)/,Ae=n=>function(){throw new Error("\u7A81\u7136\u306E\u300E"+n+"\u300F\u304C\u3042\u308A\u307E\u3059\u3002")},Oe=/^(円|ドル|元|歩|㎡|坪|度|℃|°|個|つ|本|冊|才|歳|匹|枚|皿|セット|羽|人|件|行|列|機|品|m|mm|cm|km|g|kg|t|px|dot|pt|em|b|mb|kb|gb)/,Ee=[{name:"\u3053\u3053\u307E\u3067",pattern:/^;;;/},{name:"eol",pattern:/^\n/},{name:"eol",pattern:/^;/},{name:"space",pattern:/^(\x20|\x09|・|⎿ |└||)+/},{name:"comma",pattern:/^,/},{name:"line_comment",pattern:/^#[^\n]*/},{name:"line_comment",pattern:/^\/\/[^\n]*/},{name:"range_comment",pattern:/^\/\*/,cbParser:lt},{name:"def_test",pattern:/^●テスト:/},{name:"def_func",pattern:/^●/},{name:"\u2026",pattern:/^…/},{name:"\u2026",pattern:/^\.{2,3}/},{name:"bigint",pattern:/^0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*n/,readJosi:!0},{name:"bigint",pattern:/^0[oO][0-7]+(_[0-7]+)*n/,readJosi:!0},{name:"bigint",pattern:/^0[bB][0-1]+(_[0-1]+)*n/,readJosi:!0},{name:"bigint",pattern:/^\d+(_\d+)*?n/,readJosi:!0},{name:"number",pattern:/^0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*/,readJosi:!0,cb:B},{name:"number",pattern:/^0[oO][0-7]+(_[0-7]+)*/,readJosi:!0,cb:B},{name:"number",pattern:/^0[bB][0-1]+(_[0-1]+)*/,readJosi:!0,cb:B},{name:"number",pattern:/^\d+(_\d+)*\.(\d+(_\d+)*)?([eE][+|-]?\d+(_\d+)*)?/,readJosi:!0,cb:B},{name:"number",pattern:/^\.\d+(_\d+)*([eE][+|-]?\d+(_\d+)*)?/,readJosi:!0,cb:B},{name:"number",pattern:/^\d+(_\d+)*([eE][+|-]?\d+(_\d+)*)?/,readJosi:!0,cb:B},{name:"\u3053\u3053\u304B\u3089",pattern:/^(ここから),?/},{name:"\u3053\u3053\u307E\u3067",pattern:/^(ここまで|💧)/},{name:"\u3082\u3057",pattern:/^もしも?/},{name:"\u9055\u3048\u3070",pattern:/^違(えば)?/},{name:"shift_r0",pattern:/^>>>/},{name:"shift_r",pattern:/^>>/},{name:"shift_l",pattern:/^<</},{name:"===",pattern:/^===/},{name:"!==",pattern:/^!==/},{name:"gteq",pattern:/^(≧|>=|=>)/},{name:"lteq",pattern:/^(≦|<=|=<)/},{name:"noteq",pattern:/^(≠|<>|!=)/},{name:"\u2190",pattern:/^(←|<--)/},{name:"eq",pattern:/^(==|🟰🟰)/},{name:"eq",pattern:/^(=|🟰)/},{name:"line_comment",pattern:/^(!|💡)(インデント構文|ここまでだるい|DNCLモード|DNCL2モード|DNCL2)[^\n]*/},{name:"not",pattern:/^(!|💡)/},{name:"gt",pattern:/^>/},{name:"lt",pattern:/^</},{name:"and",pattern:/^(かつ|&&|and\s)/},{name:"or",pattern:/^(または|或いは|あるいは|or\s|\|\|)/},{name:"@",pattern:/^@/},{name:"+",pattern:/^\+/},{name:"-",pattern:/^-/},{name:"**",pattern:/^(××|\*\*)/},{name:"*",pattern:/^(×|\*)/},{name:"\xF7\xF7",pattern:/^÷÷/},{name:"\xF7",pattern:/^(÷|\/)/},{name:"%",pattern:/^%/},{name:"^",pattern:/^\^/},{name:"&",pattern:/^&/},{name:"[",pattern:/^\[/},{name:"]",pattern:/^]/,readJosi:!0},{name:"(",pattern:/^\(/},{name:")",pattern:/^\)/,readJosi:!0},{name:"|",pattern:/^\|/},{name:"??",pattern:/^\?\?/},{name:"string",pattern:/^🌿/,cbParser:n=>J("\u{1F33F}","\u{1F33F}",n)},{name:"string_ex",pattern:/^🌴/,cbParser:n=>J("\u{1F334}","\u{1F334}",n)},{name:"string_ex",pattern:/^「/,cbParser:n=>J("\u300C","\u300D",n)},{name:"string",pattern:/^『/,cbParser:n=>J("\u300E","\u300F",n)},{name:"string_ex",pattern:/^“/,cbParser:n=>J("\u201C","\u201D",n)},{name:"string_ex",pattern:/^"/,cbParser:n=>J('"','"',n)},{name:"string",pattern:/^'/,cbParser:n=>J("'","'",n)},{name:"\u300D",pattern:/^」/,cbParser:Ae("\u300D")},{name:"\u300F",pattern:/^』/,cbParser:Ae("\u300F")},{name:"func",pattern:/^\{関数\},?/},{name:"{",pattern:/^\{/},{name:"}",pattern:/^\}/,readJosi:!0},{name:":",pattern:/^:/},{name:"_eol",pattern:/^_\s*\n/},{name:"dec_lineno",pattern:/^‰/},{name:"word",pattern:/^[\uD800-\uDBFF][\uDC00-\uDFFF][_a-zA-Z0-9]*/,readJosi:!0},{name:"word",pattern:/^[\u1F60-\u1F6F][_a-zA-Z0-9]*/,readJosi:!0},{name:"word",pattern:/^《.+?》/,readJosi:!0},{name:"word",pattern:/^[_a-zA-Z\u3005\u4E00-\u9FCFぁ-んァ-ヶ\u2460-\u24FF\u2776-\u277F\u3251-\u32BF]/,cbParser:ht}];function ft(n){return Fe.test(n)?ut.test(n)?n:n.replace(/[ぁ-ん]+$/g,""):n.replace(/[ぁ-ん]+/g,"")}function lt(n){let e="",t="",r=0;n=n.substring(2);let s=n.indexOf("*/");s<0?(e=n,n=""):(e=n.substring(0,s),n=n.substring(s+2));for(let i=0;i<e.length;i++)e.charAt(i)===`
|
|
2
2
|
`&&r++;return e=e.replace(/(^\s+|\s+$)/,""),{src:n,res:e,josi:t,numEOL:r}}function ht(n,e=!0){let t="",r="";for(;n!=="";){if(t.length>0){if(at.exec(n))break;let c=z.exec(n);if(c){r=c[0].replace(/^\s+/,""),n=n.substring(c[0].length),n.charAt(0)===","&&(n=n.substring(1));break}}let i=ot.exec(n);if(i){t+=i[0],n=n.substring(i[0].length);continue}if(Fe.test(n)){t+=n.charAt(0),n=n.substring(1);continue}break}/[ぁ-ん]間$/.test(t)&&(n=t.charAt(t.length-1)+n,t=t.slice(0,-1));let s=ct.exec(t);return s&&(n=s[1]+r+n,r="",t=t.substring(0,t.length-s[1].length)),r.substring(0,2)==="\u3082\u306E"&&(r=r.substring(2)),G[r]&&(r=""),e&&(t=ft(t)),t===""&&r!==""&&(t=r,r=""),{src:n,res:t,josi:r,numEOL:0}}function J(n,e,t){let r="",s="",i=0;t=t.substring(n.length);let o=t.indexOf(e);if(o<0)r=t,t="";else if(r=t.substring(0,o),t=t.substring(o+e.length),r.indexOf(n)>=0)throw n==="\u300E"?new Error("\u300C\u300E\u300D\u3067\u59CB\u3081\u305F\u6587\u5B57\u5217\u306E\u4E2D\u306B\u300C\u300E\u300D\u3092\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002"):new Error(`\u300E${n}\u300F\u3067\u59CB\u3081\u305F\u6587\u5B57\u5217\u306E\u4E2D\u306B\u300E${n}\u300F\u3092\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002`);let u=z.exec(t);u&&(s=u[0].replace(/^\s+/,""),t=t.substring(u[0].length),t.charAt(0)===","&&(t=t.substring(1))),G[s]&&(s=""),s.substring(0,2)==="\u3082\u306E"&&(s=s.substring(2));for(let c=0;c<r.length;c++)r.charAt(c)===`
|
|
3
|
-
`&&i++;return{src:t,res:r,josi:s,numEOL:i}}function B(n){return Number(n.replace(/_/g,""))}var F=class n{constructor(e){this.logger=e,this.funclist=new Map,this.modList=[],this.result=[],this.modName="main.nako3",this.moduleExport=new Map,this.reservedWords=Array.from(he.keys()),this.josiList=Ne}setFuncList(e){this.funclist=e}setModuleExport(e){this.moduleExport=e}replaceTokens(e,t,r){if(this.result=e,this.modName=n.filenameToModName(r),n.preDefineFunc(e,this.logger,this.funclist,this.moduleExport),this._replaceWord(this.result),t)if(this.result.length>0){let s=this.result[this.result.length-1];this.result.push({type:"eol",line:s.line,column:0,indent:-1,file:s.file,josi:"",value:"---",startOffset:s.startOffset,endOffset:s.endOffset,rawJosi:""}),this.result.push({type:"eof",line:s.line,indent:-1,column:0,file:s.file,josi:"",value:"",startOffset:s.startOffset,endOffset:s.endOffset,rawJosi:""})}else this.result.push({type:"eol",line:0,column:0,indent:-1,file:"",josi:"",value:"---",startOffset:0,endOffset:0,rawJosi:""}),this.result.push({type:"eof",line:0,column:0,indent:-1,file:"",josi:"",value:"",startOffset:0,endOffset:0,rawJosi:""});return this.result}static preDefineFunc(e,t,r,s){let i=0,o=!1,u=()=>{let c=[],a={};if(e[i].type!=="(")return[];for(i++;e[i];){let _=e[i];if(i++,_.type===")")break;_.type==="func"?o=!0:_.type!=="|"&&_.type!=="comma"&&(o&&(_.funcPointer=!0,o=!1),c.push(_),a[_.value]||(a[_.value]=[]),a[_.value].push(_.josi))}let f=[],l=[],h=[],p={};for(let _ of c)if(!p[_.value]){let
|
|
4
|
-
`||p.name==="_eol")&&(
|
|
3
|
+
`&&i++;return{src:t,res:r,josi:s,numEOL:i}}function B(n){return Number(n.replace(/_/g,""))}var F=class n{constructor(e){this.logger=e,this.funclist=new Map,this.modList=[],this.result=[],this.modName="main.nako3",this.moduleExport=new Map,this.reservedWords=Array.from(he.keys()),this.josiList=Ne}setFuncList(e){this.funclist=e}setModuleExport(e){this.moduleExport=e}replaceTokens(e,t,r){if(this.result=e,this.modName=n.filenameToModName(r),n.preDefineFunc(e,this.logger,this.funclist,this.moduleExport),this._replaceWord(this.result),t)if(this.result.length>0){let s=this.result[this.result.length-1];this.result.push({type:"eol",line:s.line,column:0,indent:-1,file:s.file,josi:"",value:"---",startOffset:s.startOffset,endOffset:s.endOffset,rawJosi:""}),this.result.push({type:"eof",line:s.line,indent:-1,column:0,file:s.file,josi:"",value:"",startOffset:s.startOffset,endOffset:s.endOffset,rawJosi:""})}else this.result.push({type:"eol",line:0,column:0,indent:-1,file:"",josi:"",value:"---",startOffset:0,endOffset:0,rawJosi:""}),this.result.push({type:"eof",line:0,column:0,indent:-1,file:"",josi:"",value:"",startOffset:0,endOffset:0,rawJosi:""});return this.result}static preDefineFunc(e,t,r,s){let i=0,o=!1,u=()=>{let c=[],a={};if(e[i].type!=="(")return[];for(i++;e[i];){let _=e[i];if(i++,_.type===")")break;_.type==="func"?o=!0:_.type!=="|"&&_.type!=="comma"&&(o&&(_.funcPointer=!0,o=!1),c.push(_),a[_.value]||(a[_.value]=[]),a[_.value].push(_.josi))}let f=[],l=[],h=[],p={};for(let _ of c)if(!p[_.value]){let m=a[_.value];h.push(m),f.push(_.value),_.funcPointer?l.push(_.value):l.push(null),p[_.value]=!0}return[h,f,l]};for(;i<e.length;){let c=e[i];if(c.type==="not"&&e.length-i>3){let b={type:"eol"};if(i>=1&&(b=e[i-1]),b.type==="eol"){let w=e[i+1];if(w.type==="word"&&w.value==="\u30E2\u30B8\u30E5\u30FC\u30EB\u516C\u958B\u65E2\u5B9A\u5024"){if(w.type="\u30E2\u30B8\u30E5\u30FC\u30EB\u516C\u958B\u65E2\u5B9A\u5024",w=e[i+2],w.type==="string"&&w.value==="\u975E\u516C\u958B"){let j=n.filenameToModName(c.file);s.set(j,!1),i+=3;continue}else if(w.type==="string"&&w.value==="\u516C\u958B"){let j=n.filenameToModName(c.file);s.set(j,!0),i+=3;continue}}}}if(c.type==="word"&&c.josi==="\u306B\u306F"||c.type==="word"&&c.josi==="\u306F~"){c.josi="\u306B\u306F",e.splice(i+1,0,{type:"def_func",value:"\u95A2\u6570",indent:c.indent,line:c.line,column:c.column,file:c.file,josi:"",startOffset:c.endOffset,endOffset:c.endOffset,rawJosi:"",tag:"\u7121\u540D\u95A2\u6570"}),i++;continue}if(c.type==="word"&&c.value==="\u6C38\u9060"&&c.josi==="\u306B"){let b=e[i+1];b.value==="\u7E70\u8FD4"&&(b.value="\u9593",b.josi="\u306E"),i++;continue}if(c.type==="word"&&c.josi===""&&c.value.length>=2&&c.value.match(/回$/)){c.value=c.value.substring(0,c.value.length-1),c.endOffset||(c.endOffset=1);let b={type:"\u56DE",value:"\u56DE",indent:c.indent,line:c.line,column:c.column,file:c.file,josi:"",startOffset:c.endOffset-1,endOffset:c.endOffset,rawJosi:""};e.splice(i+1,0,b),c.endOffset--,i++}if(c.type==="word"){let b=he.get(c.value);b&&(c.type=b),c.value==="\u305D\u3046"&&(c.value="\u305D\u308C")}if(c.type!=="def_test"&&c.type!=="def_func"){i++;continue}let a=!0,f={type:"eol"};i>=1&&(f=e[i-1]),f.type==="eol"&&(a=!1);let l=c;i++;let h=[],p=[],_=[],m="",g=null,k=null;if(e[i]&&e[i].type==="{"){i++;let b=e[i]&&e[i].type==="word"?e[i].value:"";b==="\u516C\u958B"?k=!0:b==="\u975E\u516C\u958B"?k=!1:b==="\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8"?k=!0:t.warn(`\u4E0D\u660E\u306A\u95A2\u6570\u5C5E\u6027\u300E${b}\u300F\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002`),i++,e[i]&&e[i].type==="}"&&i++}if(e[i]&&e[i].type==="("&&([h,p,_]=u()),!a&&e[i]&&e[i].type==="word"&&(g=e[i++],m=g.value),h.length===0&&e[i]&&e[i].type==="("&&([h,p,_]=u()),m!==""&&g){if(m=n.filenameToModName(c.file)+"__"+m,r.has(m)){let w=m.replace(/^main__/,"");t.warn(`\u95A2\u6570\u300E${w}\u300F\u306F\u65E2\u306B\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u3059\u3002`,l)}g.value=m,r.set(m,{type:"func",josi:h,fn:null,asyncFn:!1,isExport:k,varnames:p,funcPointers:_})}let y={type:"func",josi:h,varnames:p,funcPointers:_};l.meta=y}}splitStringEx(e){let t=[],r=e.split(/[{{]/);t.push(r[0]);for(let s of r.slice(1)){let i=s.replace("\uFF5D","}").indexOf("}");if(i===-1)return null;t.push(s.slice(0,i),s.slice(i+1))}return t}_replaceWord(e){let t=[],r=0,s=!1,i=[],o=()=>r<=0?"eol":e[r-1].type,u=e.length>0?n.filenameToModName(e[0].file):"main";for(;r<e.length;){let c=e[r];if((c.type==="word"||c.type==="func")&&c.value==="\u540D\u524D\u7A7A\u9593\u8A2D\u5B9A"){if(s)throw new M("\u540D\u524D\u7A7A\u9593\u8A2D\u5B9A\u306E\u95A2\u6570\u53C2\u7167\u3092\u53D6\u5F97\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002",c.startOffset===void 0?0:c.startOffset,c.endOffset===void 0?0:c.endOffset,c.line,c.file);i.push(u),u=e[r-1].value}if((c.type==="word"||c.type==="func")&&c.value==="\u540D\u524D\u7A7A\u9593\u30DD\u30C3\u30D7"){if(s)throw new M("\u540D\u524D\u7A7A\u9593\u30DD\u30C3\u30D7\u306E\u95A2\u6570\u53C2\u7167\u3092\u53D6\u5F97\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002",c.startOffset===void 0?0:c.startOffset,c.endOffset===void 0?0:c.endOffset,c.line,c.file);let a=i.pop();a&&(u=a)}if(c.type==="word"&&c.value!=="\u305D\u308C"){let a=c.value;if(a.indexOf("__")<0){let l=`${u}__${a}`,h=this.funclist.get(l);if(h&&h.type==="func"){let p=c;p.type=s?"func_pointer":"func",p.meta=h,p.value=l,s&&(s=!1,e.splice(r-1,1));continue}for(let p of this.modList){let _=`${p}__${a}`,m=this.funclist.get(_),g=this.moduleExport.get(p);if(m&&m.type==="func"&&(m.isExport===!0||m.isExport!==!1&&g!==!1)){let k=c;k.type=s?"func_pointer":"func",k.meta=m,k.value=_,s&&(s=!1,e.splice(r-1,1));break}}}let f=this.funclist.get(a);if(f&&f.type==="func"){let l=c;if(l.type=s?"func_pointer":"func",l.meta=f,s){s=!1,e.splice(r-1,1);continue}}}if(s=!1,c.type==="func"&&c.value==="{\u95A2\u6570}"){r++,s=!0;continue}if(c.type==="-"&&e[r+1]){let a=e[r+1].type;if(a==="number"||a==="bigint"){let f=o();(f==="eol"||C[f]||e[r-1].josi!=="")&&(e.splice(r,1),a==="number"?e[r].value*=-1:e[r].value="-"+e[r].value)}}if(c.josi===void 0&&(c.josi=""),c.josi==="\u306F"){c.rawJosi||(c.rawJosi=c.josi);let a=c.endOffset===void 0?void 0:c.endOffset-c.rawJosi.length;e.splice(r+1,0,{type:"eq",indent:c.indent,line:c.line,column:c.column,file:c.file,startOffset:a,endOffset:c.endOffset,josi:"",rawJosi:"",value:void 0}),r+=2,c.josi=c.rawJosi="",c.endOffset=a;continue}if(c.josi==="\u3068\u306F"){c.rawJosi||(c.rawJosi=c.josi);let a=c.endOffset===void 0?void 0:c.endOffset-c.rawJosi.length;e.splice(r+1,0,{type:"\u3068\u306F",indent:c.indent,line:c.line,column:c.column,file:c.file,startOffset:a,endOffset:c.endOffset,josi:"",rawJosi:"",value:void 0}),c.josi=c.rawJosi="",c.endOffset=a,r+=2;continue}if(pe[c.josi]){let a=c.josi==="\u3067\u306A\u3051\u308C\u3070"||c.josi==="\u306A\u3051\u308C\u3070"?"\u3067\u306A\u3051\u308C\u3070":"\u306A\u3089\u3070";c.rawJosi||(c.rawJosi=a);let f=c.endOffset===void 0?void 0:c.endOffset-c.rawJosi.length;e.splice(r+1,0,{type:"\u306A\u3089\u3070",value:a,indent:c.indent,line:c.line,column:c.column,file:c.file,startOffset:f,endOffset:c.endOffset,josi:"",rawJosi:""}),c.josi=c.rawJosi="",c.endOffset=f,r+=2;continue}if(c.type==="_eol"){e.splice(r,1);continue}if(c.type==="line_comment"||c.type==="range_comment"){t.push(c.value),e.splice(r,1);continue}c.type==="eol"&&(c.value=t.join("/"),t=[]),r++}}countIndent(e){let t=0;for(let r=0;r<e.length;r++){let s=e.charAt(r),i=$e(s);if(i===0)return[t,r];t+=i}return[t,e.length]}tokenize(e,t,r){let s=e.length,i=[],o,u,c=1,a=!1,f=0,l=this.countIndent(e);for(f=l[0],e=e.substring(l[1]),c+=l[1];e!=="";){let h=!1;for(let p of Ee){let _=p.pattern.exec(e);if(!_)continue;if(h=!0,p.name==="space"){c+=_[0].length,e=e.substring(_[0].length);continue}if(p.cbParser){let y;if(a&&p.name==="word")y=p.cbParser(e,!1);else try{y=p.cbParser(e)}catch(b){throw new P(b.message,s-e.length,s-e.length+1,t,r)}if(p.name==="string_ex"){let b=this.splitStringEx(y.res);if(b===null)throw new M("\u5C55\u958B\u3042\u308A\u6587\u5B57\u5217\u3067\u5024\u306E\u57CB\u3081\u8FBC\u307F{...}\u304C\u5BFE\u5FDC\u3057\u3066\u3044\u307E\u305B\u3093\u3002",s-e.length,s-y.src.length,t,r);let w=0;for(let j=0;j<b.length;j++){let le=j===b.length-1?y.josi:"";j%2===0?(i.push({type:"string",value:b[j],file:r,josi:le,indent:f,line:t,column:c,preprocessedCodeOffset:s-e.length+w,preprocessedCodeLength:b[j].length+2+le.length}),w+=b[j].length+2):(i.push({type:"&",value:"&",josi:"",indent:f,file:r,line:t,column:c,preprocessedCodeOffset:s-e.length+w,preprocessedCodeLength:0}),i.push({type:"(",value:"(",josi:"",indent:f,file:r,line:t,column:c,preprocessedCodeOffset:s-e.length+w,preprocessedCodeLength:0}),i.push({type:"code",value:b[j],josi:"",indent:f,file:r,line:t,column:c,preprocessedCodeOffset:s-e.length+w,preprocessedCodeLength:b[j].length}),i.push({type:")",value:")",josi:"",indent:f,file:r,line:t,column:c,preprocessedCodeOffset:s-e.length+w+b[j].length,preprocessedCodeLength:0}),i.push({type:"&",value:"&",josi:"",indent:f,file:r,line:t,column:c,preprocessedCodeOffset:s-e.length+w+b[j].length,preprocessedCodeLength:0}),w+=b[j].length)}t+=y.numEOL,c+=e.length-y.src.length,e=y.src,y.numEOL>0&&(c=1);break}o=c,c+=e.length-y.src.length,i.push({type:p.name,value:y.res,josi:y.josi,indent:f,line:t,column:o,file:r,preprocessedCodeOffset:s-e.length,preprocessedCodeLength:e.length-y.src.length}),e=y.src,t+=y.numEOL,y.numEOL>0&&(c=1);break}let m=s-e.length,g=_[0];if(p.cb&&(g=p.cb(g)),o=c,u=t,c+=_[0].length,e=e.substring(_[0].length),(p.name==="eol"&&g===`
|
|
4
|
+
`||p.name==="_eol")&&(g=t++,c=1),p.name==="number"){let y=Oe.exec(e);y&&(e=e.substring(y[0].length),c+=_[0].length)}let k="";if(p.readJosi){let y=z.exec(e);y&&(c+=y[0].length,k=y[0].replace(/^\s+/,""),e=e.substring(y[0].length),e.charAt(0)===","&&(e=e.substring(1)),G[k]&&(k=""),k.substring(0,2)==="\u3082\u306E"&&(k=k.substring(2)))}switch(p.name){case"def_test":{a=!0;break}case"eol":{a=!1;break}default:break}if(p.name==="dec_lineno"){t--;continue}if(i.push({type:p.name,value:g,indent:f,line:u,column:o,file:r,josi:k,preprocessedCodeOffset:m,preprocessedCodeLength:s-e.length-m}),p.name==="eol"&&c===1){let y=this.countIndent(e);f=y[0],c+=y[1],e=e.substring(y[1])}break}if(!h)throw new M("\u672A\u77E5\u306E\u8A9E\u53E5: "+e.substring(0,3)+"...",s-e.length,s-s+3,t,r)}return i}static tokensToTypeStr(e,t){return e.map(s=>s.type).join(t)}static filenameToModName(e){if(!e)return"main";if(e=e.replace(/[\\:]/g,"/"),e.indexOf("/")>=0){let t=e.split("/");e=t[t.length-1]}return e=e.replace(/\.nako3?$/,""),e}};var ne=class extends Z{parse(e,t){this.reset(),this.tokens=e,this.modName=F.filenameToModName(t),this.modList.push(this.modName);let r=this.startParser();for(this.isModifiedNodes=!1,this._checkAsyncFn(r);this.isModifiedNodes;)this.isModifiedNodes=!1,this._checkAsyncFn(r);return r}startParser(){let e=this.ySentenceList(),t=this.get();if(t&&t.type!=="eof")throw this.logger.debug(`\u69CB\u6587\u89E3\u6790\u3067\u30A8\u30E9\u30FC\u3002${this.nodeToStr(t,{depth:1},!0)}\u306E\u4F7F\u3044\u65B9\u304C\u9593\u9055\u3063\u3066\u3044\u307E\u3059\u3002`,t),d.fromNode(`\u69CB\u6587\u89E3\u6790\u3067\u30A8\u30E9\u30FC\u3002${this.nodeToStr(t,{depth:1},!1)}\u306E\u4F7F\u3044\u65B9\u304C\u9593\u9055\u3063\u3066\u3044\u307E\u3059\u3002`,t);return e}yNop(){return{type:"nop",josi:"",...this.peekSourceMap(),end:this.peekSourceMap()}}ySentenceList(){let e=[],t=-1,r=this.peekSourceMap();for(;!this.isEOF();){let s=this.ySentence();if(!s)break;e.push(s),t<0&&(t=s.line)}if(e.length===0){let s=this.peek()||this.tokens[0];throw this.logger.debug("\u69CB\u6587\u89E3\u6790\u306B\u5931\u6557:"+this.nodeToStr(this.peek(),{depth:1},!0),s),d.fromNode("\u69CB\u6587\u89E3\u6790\u306B\u5931\u6557:"+this.nodeToStr(this.peek(),{depth:1},!1),s)}return{type:"block",blocks:e,josi:"",...r,end:this.peekSourceMap(),genMode:this.genMode}}makeStackBalanceReport(){let e=[];this.stack.forEach(i=>{let o=this.nodeToStr(i,{depth:1},!1);i.josi&&(o+=i.josi),e.push(o)});let t=e.join(","),r="",s=65;for(let i of this.recentlyCalledFunc){r+=" - ";let o=0,u=i.josi;if(u)for(let c of u){let a=String.fromCharCode(s+o);r+=a,c.length===1?r+=c[0]:r+=`(${c.join("|")})`,o++}r+=i.name+`
|
|
5
5
|
`}return this.recentlyCalledFunc=[],`\u672A\u89E3\u6C7A\u306E\u5358\u8A9E\u304C\u3042\u308A\u307E\u3059: [${t}]
|
|
6
6
|
\u6B21\u306E\u547D\u4EE4\u306E\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059:
|
|
7
|
-
${r}`}yEOL(){let e=this.get();if(!e)return null;if(this.stack.length>0){let t=this.makeStackBalanceReport();throw d.fromNode(t,e)}return this.recentlyCalledFunc=[],{type:"eol",comment:e.value,line:e.line,column:e.column,file:e.file}}ySentence(){let e=this.peekSourceMap();if(this.check("eol"))return this.yEOL();if(this.check("\u3082\u3057"))return this.yIF();if(this.check("\u5F8C\u5224\u5B9A"))return this.yAtohantei();if(this.check("\u30A8\u30E9\u30FC\u76E3\u8996"))return this.yTryExcept();if(this.accept(["\u629C\u3051\u308B"]))return{type:"break",josi:"",...e,end:this.peekSourceMap()};if(this.accept(["\u7D9A\u3051\u308B"]))return{type:"continue",josi:"",...e,end:this.peekSourceMap()};if(this.check("??"))return this.yPrint();if(this.accept(["DNCL\u30E2\u30FC\u30C9"]))return this.yDNCLMode(1);if(this.accept(["DNCL2\u30E2\u30FC\u30C9"]))return this.yDNCLMode(2);if(this.accept(["not","string","\u30E2\u30FC\u30C9\u8A2D\u5B9A"]))return this.ySetGenMode(this.y[1].value);if(this.accept(["not","\u30E2\u30B8\u30E5\u30FC\u30EB\u516C\u958B\u65E2\u5B9A\u5024","eq","string"]))return this.yExportDefault(this.y[3].value);if(this.accept(["not","\u53B3\u30C1\u30A7\u30C3\u30AF"]))return this.ySetMode("\u53B3\u3057\u304F\u30C1\u30A7\u30C3\u30AF");if(this.check("\u9010\u6B21\u5B9F\u884C"))return this.yTikuji();if(this.accept(["not","\u975E\u540C\u671F\u30E2\u30FC\u30C9"]))return this.yASyncMode();if(this.check2(["func","eq"])){let t=this.get()||
|
|
7
|
+
${r}`}yEOL(){let e=this.get();if(!e)return null;if(this.stack.length>0){let t=this.makeStackBalanceReport();throw d.fromNode(t,e)}return this.recentlyCalledFunc=[],{type:"eol",comment:e.value,line:e.line,column:e.column,file:e.file}}ySentence(){let e=this.peekSourceMap();if(this.check("eol"))return this.yEOL();if(this.check("\u3082\u3057"))return this.yIF();if(this.check("\u5F8C\u5224\u5B9A"))return this.yAtohantei();if(this.check("\u30A8\u30E9\u30FC\u76E3\u8996"))return this.yTryExcept();if(this.accept(["\u629C\u3051\u308B"]))return{type:"break",josi:"",...e,end:this.peekSourceMap()};if(this.accept(["\u7D9A\u3051\u308B"]))return{type:"continue",josi:"",...e,end:this.peekSourceMap()};if(this.check("??"))return this.yPrint();if(this.accept(["DNCL\u30E2\u30FC\u30C9"]))return this.yDNCLMode(1);if(this.accept(["DNCL2\u30E2\u30FC\u30C9"]))return this.yDNCLMode(2);if(this.accept(["not","string","\u30E2\u30FC\u30C9\u8A2D\u5B9A"]))return this.ySetGenMode(this.y[1].value);if(this.accept(["not","\u30E2\u30B8\u30E5\u30FC\u30EB\u516C\u958B\u65E2\u5B9A\u5024","eq","string"]))return this.yExportDefault(this.y[3].value);if(this.accept(["not","\u53B3\u30C1\u30A7\u30C3\u30AF"]))return this.ySetMode("\u53B3\u3057\u304F\u30C1\u30A7\u30C3\u30AF");if(this.check("\u9010\u6B21\u5B9F\u884C"))return this.yTikuji();if(this.accept(["not","\u975E\u540C\u671F\u30E2\u30FC\u30C9"]))return this.yASyncMode();if(this.check2(["func","eq"])){let t=this.get()||x();throw d.fromNode(`\u95A2\u6570\u300E${t.value}\u300F\u306B\u4EE3\u5165\u3067\u304D\u307E\u305B\u3093\u3002`,t)}if(this.accept([this.ySpeedMode]))return this.y[0];if(this.accept([this.yPerformanceMonitor]))return this.y[0];if(this.accept([this.yLet]))return this.y[0];if(this.accept([this.yDefTest]))return this.y[0];if(this.accept([this.yDefFunc]))return this.y[0];if(this.accept([this.yCall])){let t=this.y[0],r=this.peek();if(r&&r.type==="\u306A\u3089\u3070"){let s=this.peekSourceMap(),i=t;return this.get(),this.yIfThen(i,s)}else if(R.indexOf(t.josi||"")>=0){if(this.stack.length>=1){let i=this.makeStackBalanceReport();throw d.fromNode(i,t)}let s=this.ySentence();if(s!==null)return{type:"block",blocks:[t,s],josi:s.josi,...e,end:this.peekSourceMap()}}return t}return null}yASyncMode(){return this.logger.error("\u300E\u975E\u540C\u671F\u30E2\u30FC\u30C9\u300F\u69CB\u6587\u306F\u5EC3\u6B62\u3055\u308C\u307E\u3057\u305F(https://nadesi.com/v3/doc/go.php?1028)\u3002",this.peek()),{type:"eol",...this.peekSourceMap(),end:this.peekSourceMap()}}yDNCLMode(e){let t=this.peekSourceMap();return e===1&&(this.arrayIndexFrom=1,this.flagReverseArrayIndex=!0),this.flagCheckArrayInit=!0,{type:"eol",...t,end:this.peekSourceMap()}}ySetGenMode(e){let t=this.peekSourceMap();return this.genMode=e,{type:"eol",...t,end:this.peekSourceMap()}}yExportDefault(e){let t=this.peekSourceMap();return this.isExportDefault=e==="\u516C\u958B",this.moduleExport.set(this.modName,this.isExportDefault),{type:"eol",...t,end:this.peekSourceMap()}}ySetMode(e){let t=this.peekSourceMap();return{type:"run_mode",value:e,...t,end:this.peekSourceMap()}}yBlock(){let e=this.peekSourceMap(),t=[];for(this.check("\u3053\u3053\u304B\u3089")&&this.get();!this.isEOF()&&!(this.checkTypes(["\u9055\u3048\u3070","\u3053\u3053\u307E\u3067","\u30A8\u30E9\u30FC"])||!this.accept([this.ySentence]));)t.push(this.y[0]);return{type:"block",blocks:t,josi:"",...e,end:this.peekSourceMap()}}yDefFuncReadArgs(){if(!this.check("("))return null;let e=[];for(this.get();!this.isEOF();){if(this.check(")")){this.get();break}let t=this.get();t&&e.push(t),this.check("comma")&&this.get()}return e}yDefTest(){return this.yDefFuncCommon("def_test")}yDefFunc(){return this.yDefFuncCommon("def_func")}yDefFuncCommon(e){if(!this.check(e))return null;let t=this.peekSourceMap(),r=this.get();if(!r)return null;let s=r,i=this.isExportDefault;if(this.check("{")){this.get();let l=this.get();if(this.check("}"))this.get();else throw d.fromNode("\u95A2\u6570\u306E\u5C5E\u6027\u306E\u6307\u5B9A\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u300E{\u300F\u3068\u300E}\u300F\u3067\u56F2\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002",s);l!=null&&(l.value==="\u516C\u958B"&&(i=!0),l.value==="\u975E\u516C\u958B"&&(i=!1),l.value==="\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8"&&(i=!0))}let o=[];this.check("(")&&(o=this.yDefFuncReadArgs()||[]);let u=this.get();if(!u||u.type!=="func")throw this.logger.debug(this.nodeToStr(u,{depth:0,typeName:"\u95A2\u6570"},!0)+"\u306E\u5BA3\u8A00\u3067\u30A8\u30E9\u30FC\u3002",u),d.fromNode(this.nodeToStr(u,{depth:0,typeName:"\u95A2\u6570"},!1)+"\u306E\u5BA3\u8A00\u3067\u30A8\u30E9\u30FC\u3002",s);if(this.check("(")){if(o.length>0)throw this.logger.debug(this.nodeToStr(u,{depth:0,typeName:"\u95A2\u6570"},!0)+"\u306E\u5BA3\u8A00\u3067\u3001\u5F15\u6570\u5B9A\u7FA9\u306F\u540D\u524D\u306E\u524D\u304B\u5F8C\u306B\u4E00\u5EA6\u3060\u3051\u53EF\u80FD\u3067\u3059\u3002",u),d.fromNode(this.nodeToStr(u,{depth:0,typeName:"\u95A2\u6570"},!1)+"\u306E\u5BA3\u8A00\u3067\u3001\u5F15\u6570\u5B9A\u7FA9\u306F\u540D\u524D\u306E\u524D\u304B\u5F8C\u306B\u4E00\u5EA6\u3060\u3051\u53EF\u80FD\u3067\u3059\u3002",u);o=this.yDefFuncReadArgs()||[]}this.check("\u3068\u306F")&&this.get();let c=this.yNop(),a=!1,f=!1;this.check("\u3053\u3053\u304B\u3089")&&(a=!0),this.check("eol")&&(a=!0);try{this.funcLevel++,this.usedAsyncFn=!1;let l=this.localvars;if(this.localvars=new Map([["\u305D\u308C",{type:"var",value:""}]]),a){this.saveStack();for(let h of o){if(!h||!h.value)continue;let p=h.value;this.localvars.set(p,{type:"var",value:""})}if(c=this.yBlock(),this.check("\u3053\u3053\u307E\u3067"))this.get();else throw d.fromNode("\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u95A2\u6570\u5B9A\u7FA9\u306E\u672B\u5C3E\u306B\u5FC5\u8981\u3067\u3059\u3002",s);this.loadStack()}else this.saveStack(),c=this.ySentence()||this.yNop(),this.loadStack();this.funcLevel--,f=this.usedAsyncFn,this.localvars=l}catch(l){throw this.logger.debug(this.nodeToStr(u,{depth:0,typeName:"\u95A2\u6570"},!0)+`\u306E\u5B9A\u7FA9\u3067\u4EE5\u4E0B\u306E\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3057\u305F\u3002
|
|
8
8
|
`+l.message,s),d.fromNode(this.nodeToStr(u,{depth:0,typeName:"\u95A2\u6570"},!1)+`\u306E\u5B9A\u7FA9\u3067\u4EE5\u4E0B\u306E\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3057\u305F\u3002
|
|
9
9
|
`+l.message,s)}return{type:e,name:u.value,args:o,blocks:[c],asyncFn:f,isExport:i,josi:"",meta:s.meta,...t,end:this.peekSourceMap()}}yIFCond(){let e=this.peekSourceMap(),t=this.yGetArg();if(!t)throw d.fromNode("\u300C\u3082\u3057\u300D\u6587\u306E\u6761\u4EF6\u5F0F\u306B\u9593\u9055\u3044\u304C\u3042\u308A\u307E\u3059\u3002"+this.nodeToStr(this.peek(),{depth:1},!1),e);if(t.josi==="\u306A\u3089\u3070")return t;if(t.josi==="\u3067\u306A\u3051\u308C\u3070")return t={type:"not",operator:"not",blocks:[t],josi:"",...e,end:this.peekSourceMap()},t;if(t.josi!==""&&this.check("func"))this.stack.push(t),t=this.yCall();else if(t.josi==="\u304C"){let s=this.index,i=this.yGetArg();if(!i)throw d.fromNode("\u3082\u3057\u6587\u306E\u6761\u4EF6\u300CA\u304CB\u306A\u3089\u3070\u300D\u3067B\u304C\u306A\u3044\u304B\u6761\u4EF6\u304C\u8907\u96D1\u904E\u304E\u307E\u3059\u3002"+this.nodeToStr(this.peek(),{depth:1},!1),e);if(this.check("\u306A\u3089\u3070")){let o=this.get()||{value:"\u306A\u3089\u3070"};i.josi=o.value}if(i&&(i.josi==="\u306A\u3089\u3070"||i.josi==="\u3067\u306A\u3051\u308C\u3070"))return{type:"op",operator:i.josi==="\u3067\u306A\u3051\u308C\u3070"?"noteq":"eq",blocks:[t,i],josi:"",...e,end:this.peekSourceMap()};this.index=s}if(this.check("\u306A\u3089\u3070")||(this.stack.push(t),t=this.yCall()),!this.check("\u306A\u3089\u3070")){let s=t||this.yNop();throw this.logger.debug("\u3082\u3057\u6587\u3067\u300E\u306A\u3089\u3070\u300F\u304C\u306A\u3044\u304B\u3001\u6761\u4EF6\u304C\u8907\u96D1\u904E\u304E\u307E\u3059\u3002"+this.nodeToStr(this.peek(),{depth:1},!1)+"\u306E\u76F4\u524D\u306B\u300E\u306A\u3089\u3070\u300F\u3092\u66F8\u3044\u3066\u304F\u3060\u3055\u3044\u3002",s),d.fromNode("\u3082\u3057\u6587\u3067\u300E\u306A\u3089\u3070\u300F\u304C\u306A\u3044\u304B\u3001\u6761\u4EF6\u304C\u8907\u96D1\u904E\u304E\u307E\u3059\u3002"+this.nodeToStr(this.peek(),{depth:1},!1)+"\u306E\u76F4\u524D\u306B\u300E\u306A\u3089\u3070\u300F\u3092\u66F8\u3044\u3066\u304F\u3060\u3055\u3044\u3002",s)}let r=this.get();if(r&&r.value==="\u3067\u306A\u3051\u308C\u3070"&&(t={type:"not",operator:"not",blocks:[t],josi:"",...e,end:this.peekSourceMap()}),!t)throw d.fromNode("\u300C\u3082\u3057\u300D\u6587\u306E\u6761\u4EF6\u5F0F\u306B\u9593\u9055\u3044\u304C\u3042\u308A\u307E\u3059\u3002"+this.nodeToStr(this.peek(),{depth:1},!1),e);return t}yIF(){let e=this.peekSourceMap();if(!this.check("\u3082\u3057"))return null;let t=this.get();if(t==null)return null;for(;this.check("comma");)this.get();let r=null;try{r=this.yIFCond()}catch(s){throw d.fromNode(`\u300E\u3082\u3057\u300F\u6587\u306E\u6761\u4EF6\u3067\u6B21\u306E\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3059\u3002
|
|
10
10
|
`+s.message,t)}return this.yIfThen(r,e)}yIfThen(e,t){let r=this.yNop(),s=this.yNop(),i=!1;if(this.check("eol"))r=this.yBlock();else{let o=this.ySentence();o&&(r=o),i=!0}for(;this.check("eol");)this.get();if(this.check("\u9055\u3048\u3070")){for(this.get();this.check("comma");)this.get();if(this.check("eol"))s=this.yBlock();else{let o=this.ySentence();o&&(s=o),i=!0}}if(i===!1)if(this.check("\u3053\u3053\u307E\u3067"))this.get();else throw d.fromNode("\u300E\u3082\u3057\u300F\u6587\u3067\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002",t);return{type:"if",blocks:[e,r,s],josi:"",...t,end:this.peekSourceMap()}}ySpeedMode(){let e=this.peekSourceMap();if(!this.check2(["string","\u5B9F\u884C\u901F\u5EA6\u512A\u5148"]))return null;let t=this.get();this.get();let r="";if(t&&t.value)r=t.value;else return null;let s={\u884C\u756A\u53F7\u7121\u3057:!1,\u6697\u9ED9\u306E\u578B\u5909\u63DB\u7121\u3057:!1,\u5F37\u5236\u30D4\u30E5\u30A2:!1,\u305D\u308C\u7121\u52B9:!1};for(let u of r.split("/")){if(u==="\u5168\u3066"){for(let c of Object.keys(s))s[c]=!0;break}Object.keys(s).includes(u)?s[u]=!0:this.logger.warn(`\u5B9F\u884C\u901F\u5EA6\u512A\u5148\u6587\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u300E${u}\u300F\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3002`,t)}let i=!1;this.check("\u3053\u3053\u304B\u3089")?(this.get(),i=!0):this.check("eol")&&(i=!0);let o=this.yNop();return i?(o=this.yBlock(),this.check("\u3053\u3053\u307E\u3067")&&this.get()):o=this.ySentence()||o,{type:"speed_mode",options:s,blocks:[o],josi:"",...e}}yPerformanceMonitor(){let e=this.peekSourceMap();if(!this.check2(["string","\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u30E2\u30CB\u30BF\u9069\u7528"]))return null;let t=this.get();if(!t)return null;this.get();let r={\u30E6\u30FC\u30B6\u95A2\u6570:!1,\u30B7\u30B9\u30C6\u30E0\u95A2\u6570\u672C\u4F53:!1,\u30B7\u30B9\u30C6\u30E0\u95A2\u6570:!1};for(let o of t.value.split("/")){if(o==="\u5168\u3066"){for(let u of Object.keys(r))r[u]=!0;break}Object.keys(r).includes(o)?r[o]=!0:this.logger.warn(`\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u30E2\u30CB\u30BF\u9069\u7528\u6587\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u300E${o}\u300F\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3002`,t)}let s=!1;this.check("\u3053\u3053\u304B\u3089")?(this.get(),s=!0):this.check("eol")&&(s=!0);let i=this.yNop();return s?(i=this.yBlock(),this.check("\u3053\u3053\u307E\u3067")&&this.get()):i=this.ySentence()||i,{type:"performance_monitor",options:r,blocks:[i],josi:"",...e}}yTikuji(){if(!this.check("\u9010\u6B21\u5B9F\u884C"))return null;let e=this.getCur();return this.logger.error("\u300E\u9010\u6B21\u5B9F\u884C\u300F\u69CB\u6587\u306F\u5EC3\u6B62\u3055\u308C\u307E\u3057\u305F(https://nadesi.com/v3/doc/go.php?944)\u3002",e),{type:"eol",...this.peekSourceMap(),end:this.peekSourceMap()}}yGetArgOperator(e){let t=[e];for(;!this.isEOF();){let r=this.peek();if(r&&C[r.type]){r=this.getCur(),t.push(r);let s=this.yValue();if(s===null)throw d.fromNode(`\u8A08\u7B97\u5F0F\u3067\u6F14\u7B97\u5B50\u300E${r.value}\u300F\u5F8C\u306B\u5024\u304C\u3042\u308A\u307E\u305B\u3093`,e);t.push(s);continue}break}return t.length===0?null:t.length===1?t[0]:this.infixToAST(t)}yRange(e){if(!this.check("\u2026"))return null;let t=this.peekSourceMap();this.get();let r=this.yValue();if(!e||!r)throw d.fromNode("\u7BC4\u56F2\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u6307\u5B9A\u30A8\u30E9\u30FC\u3002\u300EA\u2026B\u300F\u306E\u66F8\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",t);let s=this.funclist.get("\u7BC4\u56F2");if(!s)throw new Error("\u95A2\u6570\u300E\u7BC4\u56F2\u300F\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002plugin_system\u3092\u30B7\u30B9\u30C6\u30E0\u306B\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002");return{type:"func",name:"\u7BC4\u56F2",blocks:[e,r],josi:r.josi,meta:s,asyncFn:!1,...t,end:this.peekSourceMap()}}yPrint(){let e=this.peekSourceMap(),t=this.get();if(!t||t.value!=="??")throw d.fromNode("\u300E??\u300F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",e);let r=this.yGetArg();if(!r)throw d.fromNode("\u300E??(\u8A08\u7B97\u5F0F)\u300F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",e);let s=this.funclist.get("\u8868\u793A");if(!s)throw new Error("\u95A2\u6570\u300E\u8868\u793A\u300F\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002plugin_system\u3092\u30B7\u30B9\u30C6\u30E0\u306B\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002");return{type:"func",name:"\u8868\u793A",blocks:[r],josi:"",meta:s,asyncFn:!1,...e,end:this.peekSourceMap()}}yGetArg(){let e=this.yValue();return e===null?null:this.check("\u2026")?this.yRange(e):this.yGetArgOperator(e)}infixToPolish(e){let t=i=>C[i.type]?C[i.type]:10,r=[],s=[];for(;e.length>0;){let i=e.shift();if(!i)break;for(;r.length>0;){let o=r[r.length-1];if(t(i)>t(o))break;let u=r.pop();if(!u){this.logger.error("\u8A08\u7B97\u5F0F\u306B\u9593\u9055\u3044\u304C\u3042\u308A\u307E\u3059\u3002",i);break}s.push(u)}r.push(i)}for(;r.length>0;){let i=r.pop();i&&s.push(i)}return s}infixToAST(e){if(e.length===0)return null;let t=e[e.length-1].josi,r=e[e.length-1],s=this.infixToPolish(e),i=[];for(let u of s){if(!C[u.type]){i.push(u);continue}let c=i.pop(),a=i.pop();if(a===void 0||c===void 0)throw this.logger.debug(`--- \u8A08\u7B97\u5F0F(\u9006\u30DD\u30FC\u30E9\u30F3\u30C9) ---
|
|
11
|
-
`+JSON.stringify(s)),d.fromNode("\u8A08\u7B97\u5F0F\u3067\u30A8\u30E9\u30FC",r);let f={type:"op",operator:u.type,blocks:[a,c],josi:t,startOffset:a.startOffset,endOffset:a.endOffset,line:a.line,column:a.column,file:a.file};i.push(f)}let o=i.pop();return o||null}yGetArgParen(e){let t=!1,r=this.stack.length;for(;!this.isEOF();){if(this.check(")")){t=!0;break}let i=this.yGetArg();if(i){this.pushStack(i),this.check("comma")&&this.get();continue}break}if(!t)throw d.fromNode(`C\u98A8\u95A2\u6570\u300E${e[0].value}\u300F\u3067\u30AB\u30C3\u30B3\u304C\u9589\u3058\u3066\u3044\u307E\u305B\u3093`,e[0]);let s=[];for(;r<this.stack.length;){let i=this.popStack();i&&s.unshift(i)}return s}yRepeatTime(){let e=this.peekSourceMap();if(!this.check("\u56DE"))return null;this.get(),this.check("comma")&&this.get(),this.check("\u7E70\u8FD4")&&this.get();let t=this.popStack([])||{type:"word",value:"\u305D\u308C",josi:"",...e,end:this.peekSourceMap()},r=!1,s=this.yNop();if(this.check("comma")&&this.get(),this.check("\u3053\u3053\u304B\u3089")?(this.get(),r=!0):this.check("eol")&&(r=!0),r)if(s=this.yBlock(),this.check("\u3053\u3053\u307E\u3067"))this.get();else throw d.fromNode("\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u300E\u56DE\u300F...\u300E\u3053\u3053\u307E\u3067\u300F\u3092\u5BFE\u5FDC\u3055\u305B\u3066\u304F\u3060\u3055\u3044\u3002",e);else{let i=this.ySentence();i&&(s=i)}return{type:"\u56DE",blocks:[t,s],josi:"",...e,end:this.peekSourceMap()}}yWhile(){let e=this.peekSourceMap();if(!this.check("\u9593"))return null;for(this.get();this.check("comma");)this.get();this.check("\u7E70\u8FD4")&&this.get();let t=this.popStack();if(t===null)throw d.fromNode("\u300E\u9593\u300F\u3067\u6761\u4EF6\u304C\u3042\u308A\u307E\u305B\u3093\u3002",e);if(this.check("comma")&&this.get(),!this.checkTypes(["\u3053\u3053\u304B\u3089","eol"]))throw d.fromNode("\u300E\u9593\u300F\u306E\u76F4\u5F8C\u306F\u6539\u884C\u304C\u5FC5\u8981\u3067\u3059",e);let r=this.yBlock();if(this.check("\u3053\u3053\u307E\u3067"))this.get();else throw d.fromNode("\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u300E\u9593\u300F...\u300E\u3053\u3053\u307E\u3067\u300F\u3092\u5BFE\u5FDC\u3055\u305B\u3066\u304F\u3060\u3055\u3044\u3002",e);return{type:"while",blocks:[t,r],josi:"",...e,end:this.peekSourceMap()}}yAtohantei(){let e=this.peekSourceMap();this.check("\u5F8C\u5224\u5B9A")&&this.get(),this.check("\u7E70\u8FD4")&&this.get(),this.check("\u3053\u3053\u304B\u3089")&&this.get();let t=this.yBlock();this.check("\u3053\u3053\u307E\u3067")&&this.get(),this.check("comma")&&this.get();let r=this.yGetArg(),s=!1,i=this.peek();return i&&i.value==="\u306A\u308B"&&(i.josi==="\u307E\u3067"||i.josi==="\u307E\u3067\u306E")&&(this.get(),s=!0),this.check("\u9593")&&this.get(),s&&(r={type:"not",operator:"not",blocks:[r],josi:"",...e,end:this.peekSourceMap()}),r||(r={type:"number",value:1,josi:"",...e,end:this.peekSourceMap()}),{type:"atohantei",blocks:[r,t],josi:"",...e,end:this.peekSourceMap()}}yFor(){let e="\u300E\u7E70\u308A\u8FD4\u3059\u300F\u6587\u3067A\u304B\u3089B\u307E\u3067\u306E\u6307\u5B9A\u304C\u3042\u308A\u307E\u305B\u3093\u3002",t=!0,r=null,s=this.peekSourceMap();if(!(this.check("\u7E70\u8FD4")||this.check("\u5897\u7E70\u8FD4")||this.check("\u6E1B\u7E70\u8FD4")))return null;let i=this.getCur(),o=this.stack.pop();if(o)if(o.type==="word"&&(o.value==="\u5897"||o.value==="\u6E1B")){o.value==="\u5897"&&(t=!1);let _=o.value+i.type;if(_=="\u5897\u7E70\u8FD4")i.type="\u5897\u7E70\u8FD4";else if(_=="\u6E1B\u7E70\u8FD4")i.type="\u6E1B\u7E70\u8FD4";else throw Error("[System Error] \u5897\u7E70\u308A\u8FD4\u3057 | \u6E1B\u7E70\u308A\u8FD4\u3057\u306E\u30A8\u30E9\u30FC\u3002")}else this.stack.push(o);let u=this.yNop();(i.type==="\u5897\u7E70\u8FD4"||i.type==="\u6E1B\u7E70\u8FD4")&&(u=this.popStack(["\u305A\u3064"])||this.yNop(),i.type==="\u5897\u7E70\u8FD4"&&(t=!1),r=i.type==="\u5897\u7E70\u8FD4"?"up":"down");let c=this.popStack(["\u307E\u3067","\u3092"]),a=this.popStack(["\u304B\u3089"])||this.yNop(),f=this.popStack(["\u3092","\u3067"]),l="";if(f!==null){if(f.type!=="word")throw d.fromNode("\u300E(\u5909\u6570\u540D)\u3092A\u304B\u3089B\u307E\u3067\u7E70\u308A\u8FD4\u3059\u300F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",f);l=f.value}if((a===null||c===null)&&!(a==null&&c&&c.type==="func"&&c.name==="\u7BC4\u56F2"))throw d.fromNode(e,i);this.check("comma")&&this.get();let h=!1;this.check("\u3053\u3053\u304B\u3089")?(h=!0,this.get()):this.check("eol")&&(h=!0,this.get());let p=this.yNop();if(h)if(p=this.yBlock(),this.check("\u3053\u3053\u307E\u3067"))this.get();else throw d.fromNode("\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u300E\u7E70\u308A\u8FD4\u3059\u300F...\u300E\u3053\u3053\u307E\u3067\u300F\u3092\u5BFE\u5FDC\u3055\u305B\u3066\u304F\u3060\u3055\u3044\u3002",s);else{let _=this.ySentence();_&&(p=_)}return p||(p=this.yNop()),{type:"for",blocks:[a,c,u,p],flagDown:t,loopDirection:r,word:l,josi:"",...s,end:this.peekSourceMap()}}yReturn(){let e=this.peekSourceMap();if(!this.check("\u623B\u308B"))return null;this.get();let t=this.popStack(["\u3067","\u3092"])||this.yNop();if(this.stack.length>0)throw d.fromNode("\u300E\u623B\u300F\u6587\u306E\u76F4\u524D\u306B\u672A\u89E3\u6C7A\u306E\u5F15\u6570\u304C\u3042\u308A\u307E\u3059\u3002\u300E(\u5F0F)\u3092\u623B\u3059\u300F\u306E\u3088\u3046\u306B\u5F0F\u3092\u30AB\u30C3\u30B3\u3067\u62EC\u3063\u3066\u304F\u3060\u3055\u3044\u3002",e);return{type:"return",blocks:[t],josi:"",...e,end:this.peekSourceMap()}}yForEach(){let e=this.peekSourceMap();if(!this.check("\u53CD\u5FA9"))return null;for(this.get();this.check("comma");)this.get();let t=this.popStack(["\u3092"])||this.yNop(),r=this.popStack(["\u3067"]),s="";if(r!==null){if(r.type!=="word")throw d.fromNode("\u300E(\u5909\u6570\u540D)\u3067(\u914D\u5217)\u3092\u53CD\u5FA9\u300F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",e);s=r.value}let i=this.yNop(),o=!1;if(this.check("\u3053\u3053\u304B\u3089")?(o=!0,this.get()):this.check("eol")&&(o=!0),o)if(i=this.yBlock(),this.check("\u3053\u3053\u307E\u3067"))this.get();else throw d.fromNode("\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u300E\u53CD\u5FA9\u300F...\u300E\u3053\u3053\u307E\u3067\u300F\u3092\u5BFE\u5FDC\u3055\u305B\u3066\u304F\u3060\u3055\u3044\u3002",e);else{let u=this.ySentence();u&&(i=u)}return{type:"\u53CD\u5FA9",word:s,blocks:[t,i],josi:"",...e,end:this.peekSourceMap()}}ySwitch(){let e=this.peekSourceMap();if(!this.check("\u6761\u4EF6\u5206\u5C90"))return null;let t=this.get();if(!t)return null;let r=this.get();if(!r)return null;let s=this.popStack(["\u3067"]);if(!s)throw d.fromNode("\u300E(\u5024)\u3067\u6761\u4EF6\u5206\u5C90\u300F\u306E\u3088\u3046\u306B\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002",t);if(r.type!=="eol")throw d.fromNode("\u300E\u6761\u4EF6\u5206\u5C90\u300F\u306E\u76F4\u5F8C\u306F\u6539\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",t);let i=[];for(i[0]=s,i[1]=this.yNop();!this.isEOF();){if(this.check("eol")){this.get();continue}if(this.check("\u3053\u3053\u307E\u3067")){this.get();break}let u=this.peek();if(u&&u.type==="\u9055\u3048\u3070"){this.get(),this.check("comma")&&this.get();let h=this.yBlock();for(this.check("\u3053\u3053\u307E\u3067")&&this.get();this.check("eol");)this.get();this.check("\u3053\u3053\u307E\u3067")&&this.get(),i[1]=h;break}let c=this.yValue();if(!c)throw d.fromNode("\u300E\u6761\u4EF6\u5206\u5C90\u300F\u306F\u300E(\u6761\u4EF6)\u306A\u3089\u3070\u301C\u3053\u3053\u307E\u3067\u300F\u3068\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002",t);let a=this.get();if(!a||a.type!=="\u306A\u3089\u3070")throw d.fromNode("\u300E\u6761\u4EF6\u5206\u5C90\u300F\u3067\u6761\u4EF6\u306F\uFF0A\uFF0A\u306A\u3089\u3070\u3068\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002",t);this.check("comma")&&this.get();let f=this.yBlock(),l=this.peek();l&&l.type==="\u3053\u3053\u307E\u3067"&&this.get(),i.push(c),i.push(f)}return{type:"switch",blocks:i,case_count:i.length/2-1,josi:"",...e,end:this.peekSourceMap()}}yMumeiFunc(){let e=this.peekSourceMap();if(!this.check("def_func"))return null;let t=this.get();if(!t)return null;let r=t,s=[];this.check("comma")&&this.get(),this.check("(")&&(s=this.yDefFuncReadArgs()||[]),this.check("comma")&&this.get(),this.funcLevel++,this.saveStack();let i=this.yBlock();if(!this.check("\u3053\u3053\u307E\u3067"))throw d.fromNode("\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u300E\u306B\u306F\u300F\u69CB\u6587\u304B\u7121\u540D\u95A2\u6570\u306E\u672B\u5C3E\u306B\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u5FC5\u8981\u3067\u3059\u3002",e);return this.get(),this.loadStack(),this.funcLevel--,{type:"func_obj",name:"",args:s,blocks:[i],meta:r.meta,josi:"",...e,end:this.peekSourceMap()}}yDainyu(){let e=this.peekSourceMap(),t=this.get();if(t===null)return null;let r=this.popStack(["\u3092"])||{type:"word",value:"\u305D\u308C",josi:"\u3092",...e},s=this.popStack(["\u3078","\u306B"]);if(!s||s.type!=="word"&&s.type!=="func"&&s.type!=="\u914D\u5217\u53C2\u7167")throw d.fromNode("\u4EE3\u5165\u6587\u3067\u4EE3\u5165\u5148\u306E\u5909\u6570\u304C\u898B\u5F53\u305F\u308A\u307E\u305B\u3093\u3002\u300E(\u5909\u6570\u540D)\u306B(\u5024)\u3092\u4EE3\u5165\u300F\u306E\u3088\u3046\u306B\u4F7F\u3044\u307E\u3059\u3002",t);if(s.type==="\u914D\u5217\u53C2\u7167"){let o=s.index||[],u=[r,...o];return{type:"let_array",name:s.name.value,indexes:s.index,blocks:u,josi:"",checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}return{type:"let",name:this.getVarName(s).value,blocks:[r],josi:"",...e,end:this.peekSourceMap()}}ySadameru(){let e=this.peekSourceMap(),t=this.get();if(t===null)return null;let r=this.popStack(["\u3092"])||{type:"word",value:"\u305D\u308C",josi:"\u3092",...e,end:this.peekSourceMap()};if(!r||r.type!=="word"&&r.type!=="func"&&r.type!=="\u914D\u5217\u53C2\u7167")throw d.fromNode("\u300E\u5B9A\u3081\u308B\u300F\u6587\u3067\u5B9A\u6570\u304C\u898B\u5F53\u305F\u308A\u307E\u305B\u3093\u3002\u300E(\u5B9A\u6570\u540D)\u3092(\u5024)\u306B\u5B9A\u3081\u308B\u300F\u306E\u3088\u3046\u306B\u4F7F\u3044\u307E\u3059\u3002",t);let s=this.popStack(["\u3078","\u306B","\u3068"])||this.yNop(),i=this.isExportDefault;if(this.check2(["{","word","}"])){this.get();let u=this.get();if(u===null)throw d.fromNode("\u5B9A\u3081\u308B\u300E"+r.value+"\u300F\u306E\u5B9A\u7FA9\u30A8\u30E9\u30FC",r);let c=u.value;c==="\u516C\u958B"?i=!0:c==="\u975E\u516C\u958B"?i=!1:c==="\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8"?i=!0:this.logger.warn(`\u4E0D\u660E\u306A\u5909\u6570\u5C5E\u6027\u300E${c}\u300F\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002`),this.get()}return{type:"def_local_var",name:this.createVar(r,!0,i).value,vartype:"\u5B9A\u6570",isExport:i,blocks:[s],josi:"",...e,end:this.peekSourceMap()}}yIncDec(){let e=this.peekSourceMap(),t=this.get();if(t===null)return null;if(this.check("\u7E70\u8FD4"))return this.pushStack({type:"word",value:t.value,josi:t.josi,...e,end:this.peekSourceMap()}),this.yFor();let r=this.popStack(["\u3060\u3051",""]);r||(r={type:"number",value:1,josi:"\u3060\u3051",...e,end:this.peekSourceMap()});let s=this.popStack(["\u3092"]);if(!s||s.type!=="word"&&s.type!=="\u914D\u5217\u53C2\u7167")throw d.fromNode(`\u300E${t.type}\u300F\u6587\u3067\u5B9A\u6570\u304C\u898B\u5F53\u305F\u308A\u307E\u305B\u3093\u3002\u300E(\u5909\u6570\u540D)\u3092(\u5024)\u3060\u3051${t.type}\u300F\u306E\u3088\u3046\u306B\u4F7F\u3044\u307E\u3059\u3002`,t);if(t.value==="\u6E1B"){let i={type:"number",value:-1,line:t.line};r={type:"op",operator:"*",blocks:[r,i],josi:"",...e}}return{type:"inc",name:s,blocks:[r],josi:t.josi,...e,end:this.peekSourceMap()}}yCall(){if(this.isEOF())return null;for(;!this.isEOF();){if(this.check("\u3053\u3053\u304B\u3089")&&this.get(),this.check("\u4EE3\u5165"))return this.yDainyu();if(this.check("\u5B9A\u3081\u308B"))return this.ySadameru();if(this.check("\u56DE"))return this.yRepeatTime();if(this.check("\u9593"))return this.yWhile();if(this.check("\u7E70\u8FD4")||this.check("\u5897\u7E70\u8FD4")||this.check("\u6E1B\u7E70\u8FD4"))return this.yFor();if(this.check("\u53CD\u5FA9"))return this.yForEach();if(this.check("\u6761\u4EF6\u5206\u5C90"))return this.ySwitch();if(this.check("\u623B\u308B"))return this.yReturn();if(this.check("\u5897")||this.check("\u6E1B"))return this.yIncDec();if(this.check2([["func","word"],"("])){let t=this.peek();if(t&&t.josi===""){let r=this.yValue();if(r){let s=r.josi||"";if(r.type==="func"&&(r.josi===""||R.indexOf(s)>=0))return r.josi="",r;this.pushStack(r)}this.check("comma")&&this.get();continue}}if(this.check("func")){let t=this.yCallFunc();if(t===null)continue;if(this.check("\u9593")){this.pushStack(t);continue}if(!this.checkTypes(K))return t;let r=this.yGetArgOperator(t);this.pushStack(r);continue}let e=this.yGetArg();if(e){this.pushStack(e);continue}break}if(this.stack.length>0){if(this.isReadingCalc)return this.popStack();this.logger.debug(`--- stack dump ---
|
|
11
|
+
`+JSON.stringify(s)),d.fromNode("\u8A08\u7B97\u5F0F\u3067\u30A8\u30E9\u30FC",r);let f={type:"op",operator:u.type,blocks:[a,c],josi:t,startOffset:a.startOffset,endOffset:a.endOffset,line:a.line,column:a.column,file:a.file};i.push(f)}let o=i.pop();return o||null}yGetArgParen(e){let t=!1,r=this.stack.length;for(;!this.isEOF();){if(this.check(")")){t=!0;break}let i=this.yGetArg();if(i){this.pushStack(i),this.check("comma")&&this.get();continue}break}if(!t)throw d.fromNode(`C\u98A8\u95A2\u6570\u300E${e[0].value}\u300F\u3067\u30AB\u30C3\u30B3\u304C\u9589\u3058\u3066\u3044\u307E\u305B\u3093`,e[0]);let s=[];for(;r<this.stack.length;){let i=this.popStack();i&&s.unshift(i)}return s}yRepeatTime(){let e=this.peekSourceMap();if(!this.check("\u56DE"))return null;this.get(),this.check("comma")&&this.get(),this.check("\u7E70\u8FD4")&&this.get();let t=this.popStack([])||{type:"word",value:"\u305D\u308C",josi:"",...e,end:this.peekSourceMap()},r=!1,s=this.yNop();if(this.check("comma")&&this.get(),this.check("\u3053\u3053\u304B\u3089")?(this.get(),r=!0):this.check("eol")&&(r=!0),r)if(s=this.yBlock(),this.check("\u3053\u3053\u307E\u3067"))this.get();else throw d.fromNode("\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u300E\u56DE\u300F...\u300E\u3053\u3053\u307E\u3067\u300F\u3092\u5BFE\u5FDC\u3055\u305B\u3066\u304F\u3060\u3055\u3044\u3002",e);else{let i=this.ySentence();i&&(s=i)}return{type:"\u56DE",blocks:[t,s],josi:"",...e,end:this.peekSourceMap()}}yWhile(){let e=this.peekSourceMap();if(!this.check("\u9593"))return null;for(this.get();this.check("comma");)this.get();this.check("\u7E70\u8FD4")&&this.get();let t=this.popStack();if(t===null)throw d.fromNode("\u300E\u9593\u300F\u3067\u6761\u4EF6\u304C\u3042\u308A\u307E\u305B\u3093\u3002",e);if(this.check("comma")&&this.get(),!this.checkTypes(["\u3053\u3053\u304B\u3089","eol"]))throw d.fromNode("\u300E\u9593\u300F\u306E\u76F4\u5F8C\u306F\u6539\u884C\u304C\u5FC5\u8981\u3067\u3059",e);let r=this.yBlock();if(this.check("\u3053\u3053\u307E\u3067"))this.get();else throw d.fromNode("\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u300E\u9593\u300F...\u300E\u3053\u3053\u307E\u3067\u300F\u3092\u5BFE\u5FDC\u3055\u305B\u3066\u304F\u3060\u3055\u3044\u3002",e);return{type:"while",blocks:[t,r],josi:"",...e,end:this.peekSourceMap()}}yAtohantei(){let e=this.peekSourceMap();this.check("\u5F8C\u5224\u5B9A")&&this.get(),this.check("\u7E70\u8FD4")&&this.get(),this.check("\u3053\u3053\u304B\u3089")&&this.get();let t=this.yBlock();this.check("\u3053\u3053\u307E\u3067")&&this.get(),this.check("comma")&&this.get();let r=this.yGetArg(),s=!1,i=this.peek();return i&&i.value==="\u306A\u308B"&&(i.josi==="\u307E\u3067"||i.josi==="\u307E\u3067\u306E")&&(this.get(),s=!0),this.check("\u9593")&&this.get(),s&&(r={type:"not",operator:"not",blocks:[r],josi:"",...e,end:this.peekSourceMap()}),r||(r={type:"number",value:1,josi:"",...e,end:this.peekSourceMap()}),{type:"atohantei",blocks:[r,t],josi:"",...e,end:this.peekSourceMap()}}yFor(){let e="\u300E\u7E70\u308A\u8FD4\u3059\u300F\u6587\u3067A\u304B\u3089B\u307E\u3067\u306E\u6307\u5B9A\u304C\u3042\u308A\u307E\u305B\u3093\u3002",t=!0,r=!0,s=null,i=this.peekSourceMap();if(!(this.check("\u7E70\u8FD4")||this.check("\u5897\u7E70\u8FD4")||this.check("\u6E1B\u7E70\u8FD4")))return null;let o=this.getCur(),u=this.stack.pop();if(u)if(u.type==="word"&&(u.value==="\u5897"||u.value==="\u6E1B")){u.value==="\u5897"?t=!1:r=!1;let m=u.value+o.type;if(m=="\u5897\u7E70\u8FD4")o.type="\u5897\u7E70\u8FD4";else if(m=="\u6E1B\u7E70\u8FD4")o.type="\u6E1B\u7E70\u8FD4";else throw Error("[System Error] \u5897\u7E70\u308A\u8FD4\u3057 | \u6E1B\u7E70\u308A\u8FD4\u3057\u306E\u30A8\u30E9\u30FC\u3002")}else this.stack.push(u);let c=this.yNop();(o.type==="\u5897\u7E70\u8FD4"||o.type==="\u6E1B\u7E70\u8FD4")&&(c=this.popStack(["\u305A\u3064"])||this.yNop(),o.type==="\u5897\u7E70\u8FD4"?t=!1:r=!1,s=o.type==="\u5897\u7E70\u8FD4"?"up":"down");let a=this.popStack(["\u307E\u3067","\u3092"]),f=this.popStack(["\u304B\u3089"])||this.yNop(),l=this.popStack(["\u3092","\u3067"]),h="";if(l!==null){if(l.type!=="word")throw d.fromNode("\u300E(\u5909\u6570\u540D)\u3092A\u304B\u3089B\u307E\u3067\u7E70\u308A\u8FD4\u3059\u300F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",l);h=l.value}if((f===null||a===null)&&!(f==null&&a&&a.type==="func"&&a.name==="\u7BC4\u56F2"))throw d.fromNode(e,o);this.check("comma")&&this.get();let p=!1;this.check("\u3053\u3053\u304B\u3089")?(p=!0,this.get()):this.check("eol")&&(p=!0,this.get());let _=this.yNop();if(p)if(_=this.yBlock(),this.check("\u3053\u3053\u307E\u3067"))this.get();else throw d.fromNode("\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u300E\u7E70\u308A\u8FD4\u3059\u300F...\u300E\u3053\u3053\u307E\u3067\u300F\u3092\u5BFE\u5FDC\u3055\u305B\u3066\u304F\u3060\u3055\u3044\u3002",i);else{let m=this.ySentence();m&&(_=m)}return _||(_=this.yNop()),{type:"for",blocks:[f,a,c,_],flagDown:t,flagUp:r,loopDirection:s,word:h,josi:"",...i,end:this.peekSourceMap()}}yReturn(){let e=this.peekSourceMap();if(!this.check("\u623B\u308B"))return null;this.get();let t=this.popStack(["\u3067","\u3092"])||this.yNop();if(this.stack.length>0)throw d.fromNode("\u300E\u623B\u300F\u6587\u306E\u76F4\u524D\u306B\u672A\u89E3\u6C7A\u306E\u5F15\u6570\u304C\u3042\u308A\u307E\u3059\u3002\u300E(\u5F0F)\u3092\u623B\u3059\u300F\u306E\u3088\u3046\u306B\u5F0F\u3092\u30AB\u30C3\u30B3\u3067\u62EC\u3063\u3066\u304F\u3060\u3055\u3044\u3002",e);return{type:"return",blocks:[t],josi:"",...e,end:this.peekSourceMap()}}yForEach(){let e=this.peekSourceMap();if(!this.check("\u53CD\u5FA9"))return null;for(this.get();this.check("comma");)this.get();let t=this.popStack(["\u3092"])||this.yNop(),r=this.popStack(["\u3067"]),s="";if(r!==null){if(r.type!=="word")throw d.fromNode("\u300E(\u5909\u6570\u540D)\u3067(\u914D\u5217)\u3092\u53CD\u5FA9\u300F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",e);s=r.value}let i=this.yNop(),o=!1;if(this.check("\u3053\u3053\u304B\u3089")?(o=!0,this.get()):this.check("eol")&&(o=!0),o)if(i=this.yBlock(),this.check("\u3053\u3053\u307E\u3067"))this.get();else throw d.fromNode("\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u300E\u53CD\u5FA9\u300F...\u300E\u3053\u3053\u307E\u3067\u300F\u3092\u5BFE\u5FDC\u3055\u305B\u3066\u304F\u3060\u3055\u3044\u3002",e);else{let u=this.ySentence();u&&(i=u)}return{type:"\u53CD\u5FA9",word:s,blocks:[t,i],josi:"",...e,end:this.peekSourceMap()}}ySwitch(){let e=this.peekSourceMap();if(!this.check("\u6761\u4EF6\u5206\u5C90"))return null;let t=this.get();if(!t)return null;let r=this.get();if(!r)return null;let s=this.popStack(["\u3067"]);if(!s)throw d.fromNode("\u300E(\u5024)\u3067\u6761\u4EF6\u5206\u5C90\u300F\u306E\u3088\u3046\u306B\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002",t);if(r.type!=="eol")throw d.fromNode("\u300E\u6761\u4EF6\u5206\u5C90\u300F\u306E\u76F4\u5F8C\u306F\u6539\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",t);let i=[];for(i[0]=s,i[1]=this.yNop();!this.isEOF();){if(this.check("eol")){this.get();continue}if(this.check("\u3053\u3053\u307E\u3067")){this.get();break}let u=this.peek();if(u&&u.type==="\u9055\u3048\u3070"){this.get(),this.check("comma")&&this.get();let h=this.yBlock();for(this.check("\u3053\u3053\u307E\u3067")&&this.get();this.check("eol");)this.get();this.check("\u3053\u3053\u307E\u3067")&&this.get(),i[1]=h;break}let c=this.yValue();if(!c)throw d.fromNode("\u300E\u6761\u4EF6\u5206\u5C90\u300F\u306F\u300E(\u6761\u4EF6)\u306A\u3089\u3070\u301C\u3053\u3053\u307E\u3067\u300F\u3068\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002",t);let a=this.get();if(!a||a.type!=="\u306A\u3089\u3070")throw d.fromNode("\u300E\u6761\u4EF6\u5206\u5C90\u300F\u3067\u6761\u4EF6\u306F\uFF0A\uFF0A\u306A\u3089\u3070\u3068\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002",t);this.check("comma")&&this.get();let f=this.yBlock(),l=this.peek();l&&l.type==="\u3053\u3053\u307E\u3067"&&this.get(),i.push(c),i.push(f)}return{type:"switch",blocks:i,case_count:i.length/2-1,josi:"",...e,end:this.peekSourceMap()}}yMumeiFunc(){let e=this.peekSourceMap();if(!this.check("def_func"))return null;let t=this.get();if(!t)return null;let r=t,s=[];this.check("comma")&&this.get(),this.check("(")&&(s=this.yDefFuncReadArgs()||[]),this.check("comma")&&this.get(),this.funcLevel++,this.saveStack();let i=this.yBlock();if(!this.check("\u3053\u3053\u307E\u3067"))throw d.fromNode("\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u300E\u306B\u306F\u300F\u69CB\u6587\u304B\u7121\u540D\u95A2\u6570\u306E\u672B\u5C3E\u306B\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u5FC5\u8981\u3067\u3059\u3002",e);return this.get(),this.loadStack(),this.funcLevel--,{type:"func_obj",name:"",args:s,blocks:[i],meta:r.meta,josi:"",...e,end:this.peekSourceMap()}}yDainyu(){let e=this.peekSourceMap(),t=this.get();if(t===null)return null;let r=this.popStack(["\u3092"])||{type:"word",value:"\u305D\u308C",josi:"\u3092",...e},s=this.popStack(["\u3078","\u306B"]);if(!s||s.type!=="word"&&s.type!=="func"&&s.type!=="\u914D\u5217\u53C2\u7167")throw d.fromNode("\u4EE3\u5165\u6587\u3067\u4EE3\u5165\u5148\u306E\u5909\u6570\u304C\u898B\u5F53\u305F\u308A\u307E\u305B\u3093\u3002\u300E(\u5909\u6570\u540D)\u306B(\u5024)\u3092\u4EE3\u5165\u300F\u306E\u3088\u3046\u306B\u4F7F\u3044\u307E\u3059\u3002",t);if(s.type==="\u914D\u5217\u53C2\u7167"){let o=s.index||[],u=[r,...o];return{type:"let_array",name:s.name.value,indexes:s.index,blocks:u,josi:"",checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}return{type:"let",name:this.getVarName(s).value,blocks:[r],josi:"",...e,end:this.peekSourceMap()}}ySadameru(){let e=this.peekSourceMap(),t=this.get();if(t===null)return null;let r=this.popStack(["\u3092"])||{type:"word",value:"\u305D\u308C",josi:"\u3092",...e,end:this.peekSourceMap()};if(!r||r.type!=="word"&&r.type!=="func"&&r.type!=="\u914D\u5217\u53C2\u7167")throw d.fromNode("\u300E\u5B9A\u3081\u308B\u300F\u6587\u3067\u5B9A\u6570\u304C\u898B\u5F53\u305F\u308A\u307E\u305B\u3093\u3002\u300E(\u5B9A\u6570\u540D)\u3092(\u5024)\u306B\u5B9A\u3081\u308B\u300F\u306E\u3088\u3046\u306B\u4F7F\u3044\u307E\u3059\u3002",t);let s=this.popStack(["\u3078","\u306B","\u3068"])||this.yNop(),i=this.isExportDefault;if(this.check2(["{","word","}"])){this.get();let u=this.get();if(u===null)throw d.fromNode("\u5B9A\u3081\u308B\u300E"+r.value+"\u300F\u306E\u5B9A\u7FA9\u30A8\u30E9\u30FC",r);let c=u.value;c==="\u516C\u958B"?i=!0:c==="\u975E\u516C\u958B"?i=!1:c==="\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8"?i=!0:this.logger.warn(`\u4E0D\u660E\u306A\u5909\u6570\u5C5E\u6027\u300E${c}\u300F\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002`),this.get()}return{type:"def_local_var",name:this.createVar(r,!0,i).value,vartype:"\u5B9A\u6570",isExport:i,blocks:[s],josi:"",...e,end:this.peekSourceMap()}}yIncDec(){let e=this.peekSourceMap(),t=this.get();if(t===null)return null;if(this.check("\u7E70\u8FD4"))return this.pushStack({type:"word",value:t.value,josi:t.josi,...e,end:this.peekSourceMap()}),this.yFor();let r=this.popStack(["\u3060\u3051",""]);r||(r={type:"number",value:1,josi:"\u3060\u3051",...e,end:this.peekSourceMap()});let s=this.popStack(["\u3092"]);if(!s||s.type!=="word"&&s.type!=="\u914D\u5217\u53C2\u7167")throw d.fromNode(`\u300E${t.type}\u300F\u6587\u3067\u5B9A\u6570\u304C\u898B\u5F53\u305F\u308A\u307E\u305B\u3093\u3002\u300E(\u5909\u6570\u540D)\u3092(\u5024)\u3060\u3051${t.type}\u300F\u306E\u3088\u3046\u306B\u4F7F\u3044\u307E\u3059\u3002`,t);if(t.value==="\u6E1B"){let i={type:"number",value:-1,line:t.line};r={type:"op",operator:"*",blocks:[r,i],josi:"",...e}}return{type:"inc",name:s,blocks:[r],josi:t.josi,...e,end:this.peekSourceMap()}}yCall(){if(this.isEOF())return null;for(;!this.isEOF();){if(this.check("\u3053\u3053\u304B\u3089")&&this.get(),this.check("\u4EE3\u5165"))return this.yDainyu();if(this.check("\u5B9A\u3081\u308B"))return this.ySadameru();if(this.check("\u56DE"))return this.yRepeatTime();if(this.check("\u9593"))return this.yWhile();if(this.check("\u7E70\u8FD4")||this.check("\u5897\u7E70\u8FD4")||this.check("\u6E1B\u7E70\u8FD4"))return this.yFor();if(this.check("\u53CD\u5FA9"))return this.yForEach();if(this.check("\u6761\u4EF6\u5206\u5C90"))return this.ySwitch();if(this.check("\u623B\u308B"))return this.yReturn();if(this.check("\u5897")||this.check("\u6E1B"))return this.yIncDec();if(this.check2([["func","word"],"("])){let t=this.peek();if(t&&t.josi===""){let r=this.yValue();if(r){let s=r.josi||"";if(r.type==="func"&&(r.josi===""||R.indexOf(s)>=0))return r.josi="",r;this.pushStack(r)}this.check("comma")&&this.get();continue}}if(this.check("func")){let t=this.yCallFunc();if(t===null)continue;if(this.check("\u9593")){this.pushStack(t);continue}if(!this.checkTypes(K))return t;let r=this.yGetArgOperator(t);this.pushStack(r);continue}let e=this.yGetArg();if(e){this.pushStack(e);continue}break}if(this.stack.length>0){if(this.isReadingCalc)return this.popStack();this.logger.debug(`--- stack dump ---
|
|
12
12
|
`+JSON.stringify(this.stack,null,2)+`
|
|
13
13
|
peek: `+JSON.stringify(this.peek(),null,2));let e=`\u4E0D\u5B8C\u5168\u306A\u6587\u3067\u3059\u3002${this.stack.map(i=>this.nodeToStr(i,{depth:0},!0)).join("\u3001")}\u304C\u89E3\u6C7A\u3057\u3066\u3044\u307E\u305B\u3093\u3002`,t=`\u4E0D\u5B8C\u5168\u306A\u6587\u3067\u3059\u3002${this.stack.map(i=>this.nodeToStr(i,{depth:0},!1)).join("\u3001")}\u304C\u89E3\u6C7A\u3057\u3066\u3044\u307E\u305B\u3093\u3002`;for(let i of this.stack){let o=this.nodeToStr(i,{depth:0},!1),u=this.nodeToStr(i,{depth:1},!1);o!==u&&(e+=`${this.nodeToStr(i,{depth:0},!0)}\u306F${this.nodeToStr(i,{depth:1},!0)}\u3068\u3057\u3066\u4F7F\u308F\u308C\u3066\u3044\u307E\u3059\u3002`,t+=`${o}\u306F${u}\u3068\u3057\u3066\u4F7F\u308F\u308C\u3066\u3044\u307E\u3059\u3002`)}let r=this.stack[0],s=this.stack[this.stack.length-1];throw this.logger.debug(e,r),d.fromNode(t,r,s)}return this.popStack([])}yCallFunc(){let e=this.peekSourceMap(),t=this.get();if(!t)return null;let r=t,s=r.meta,i=r.value,o=null;if(r.josi==="\u306B\u306F"){try{o=this.yMumeiFunc()}catch(l){throw d.fromNode(`\u300E${r.value}\u306B\u306F...\u300F\u3067\u7121\u540D\u95A2\u6570\u306E\u5B9A\u7FA9\u3067\u4EE5\u4E0B\u306E\u9593\u9055\u3044\u304C\u3042\u308A\u307E\u3059\u3002
|
|
14
14
|
${l.message}`,r)}if(o===null)throw d.fromNode("\u300EF\u306B\u306F\u300F\u69CB\u6587\u304C\u3042\u308A\u307E\u3057\u305F\u304C\u3001\u95A2\u6570\u5B9A\u7FA9\u304C\u898B\u5F53\u305F\u308A\u307E\u305B\u3093\u3002",r)}if(!s||typeof s.josi>"u")throw d.fromNode("\u95A2\u6570\u306E\u5B9A\u7FA9\u3067\u30A8\u30E9\u30FC\u3002",r);this.recentlyCalledFunc.push({name:i,...s}),s&&s.asyncFn&&(this.usedAsyncFn=!0);let u=[],c=0,a=0;for(let l=s.josi.length-1;l>=0;l--)for(;;){let h=this.popStack(s.josi[l]);if(h!==null)a++;else if(l<s.josi.length-1||!s.isVariableJosi)c++,h=o;else break;if(h!==null&&s.funcPointers!==void 0&&s.funcPointers[l]!==null)if(h.type==="func")h.type="func_pointer";else{let p=s.varnames?s.varnames[l]:`${l+1}\u756A\u76EE\u306E\u5F15\u6570`;throw d.fromNode(`\u95A2\u6570\u300E${r.value}\u300F\u306E\u5F15\u6570\u300E${p}\u300F\u306B\u306F\u95A2\u6570\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304C\u5FC5\u8981\u3067\u3059\u3002`,r)}if(h===null&&(h={type:"word",value:"\u305D\u308C",josi:"",...e,end:e}),u.unshift(h),l<s.josi.length-1||!s.isVariableJosi)break}if(c>=2&&(a>0||r.josi===""||R.indexOf(r.josi)>=0))throw d.fromNode(`\u95A2\u6570\u300E${r.value}\u300F\u306E\u5F15\u6570\u304C\u4E0D\u8DB3\u3057\u3066\u3044\u307E\u3059\u3002`,r);this.usedFuncs.add(r.value);let f={type:"func",name:r.value,blocks:u,meta:s,josi:r.josi,asyncFn:!!s.asyncFn,...e,end:this.peekSourceMap()};if(f.name==="\u30D7\u30E9\u30B0\u30A4\u30F3\u540D\u8A2D\u5B9A"){if(u.length>0&&u[0]){let l=""+u[0].value;l==="\u30E1\u30A4\u30F3"&&(l=""+u[0].file),this.namespaceStack.push(this.modName),this.isExportStack.push(this.isExportDefault),this.modName=F.filenameToModName(l),this.modList.push(this.modName)}}else if(f.name==="\u540D\u524D\u7A7A\u9593\u30DD\u30C3\u30D7"){let l=this.namespaceStack.pop();l&&(this.modName=l);let h=this.isExportStack.pop();h!=null&&(this.isExportDefault=h)}return r.josi===""?f:R.indexOf(r.josi)>=0?(f.josi="\u3057\u3066",f):(f.meta=s,this.pushStack(f),null)}yLet(){let e=this.peekSourceMap();if(this.check2(["word","eq"])){let t=this.peek(),r=!1;try{if(this.accept(["word","eq",this.yCalc])||this.accept(["word","eq",this.ySentence])){if(this.y[2].type==="eol")throw new Error("\u5024\u304C\u7A7A\u3067\u3059\u3002");this.check("comma")&&this.get();let s=this.getVarName(this.y[0]),i=this.y[2];return{type:"let",name:s.value,blocks:[i],josi:"",...e,end:this.peekSourceMap()}}else throw r=!0,this.logger.debug(`${this.nodeToStr(t,{depth:1},!0)}\u3078\u306E\u4EE3\u5165\u6587\u3067\u8A08\u7B97\u5F0F\u306B\u66F8\u304D\u9593\u9055\u3044\u304C\u3042\u308A\u307E\u3059\u3002`,t),d.fromNode(`${this.nodeToStr(t,{depth:1},!1)}\u3078\u306E\u4EE3\u5165\u6587\u3067\u8A08\u7B97\u5F0F\u306B\u66F8\u304D\u9593\u9055\u3044\u304C\u3042\u308A\u307E\u3059\u3002`,e)}catch(s){throw r?s:(this.logger.debug(`${this.nodeToStr(t,{depth:1},!0)}\u3078\u306E\u4EE3\u5165\u6587\u3067\u8A08\u7B97\u5F0F\u306B\u4EE5\u4E0B\u306E\u66F8\u304D\u9593\u9055\u3044\u304C\u3042\u308A\u307E\u3059\u3002
|
|
15
15
|
${s.message}`,t),d.fromNode(`${this.nodeToStr(t,{depth:1},!1)}\u3078\u306E\u4EE3\u5165\u6587\u3067\u8A08\u7B97\u5F0F\u306B\u4EE5\u4E0B\u306E\u66F8\u304D\u9593\u9055\u3044\u304C\u3042\u308A\u307E\u3059\u3002
|
|
16
|
-
${s.message}`,e))}}if(this.check2(["word","@"])){let t=this.yLetArrayAt(e);if(this.check("comma")&&this.get(),t)return t.checkInit=this.flagCheckArrayInit,t}if(this.check2(["word","["])){let t=this.yLetArrayBracket(e);if(this.check("comma")&&this.get(),t)return t.checkInit=this.flagCheckArrayInit,t}if(this.accept(["word","\u3068\u306F"])){let t=this.y[0];if(!this.checkTypes(["\u5909\u6570","\u5B9A\u6570"]))throw d.fromNode("\u30ED\u30FC\u30AB\u30EB\u5909\u6570\u300E"+t.value+"\u300F\u306E\u5B9A\u7FA9\u30A8\u30E9\u30FC",t);let r=this.getCur(),s=this.isExportDefault;if(this.check2(["{","word","}"])){this.get();let u=this.get();if(u===null)throw d.fromNode("\u30ED\u30FC\u30AB\u30EB\u5909\u6570\u300E"+t.value+"\u300F\u306E\u5B9A\u7FA9\u30A8\u30E9\u30FC",t);let c=u.value;c==="\u516C\u958B"?s=!0:c==="\u975E\u516C\u958B"?s=!1:c==="\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8"?s=!0:this.logger.warn(`\u4E0D\u660E\u306A\u5909\u6570\u5C5E\u6027\u300E${c}\u300F\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002`),this.get()}let i=this.createVar(t,r.type==="\u5B9A\u6570",s),o=this.yNop();return this.check("eq")&&(this.get(),o=this.yCalc()||o),this.check("comma")&&this.get(),{type:"def_local_var",name:i.value,vartype:r.type,isExport:s,blocks:[o],...e,end:this.peekSourceMap()}}if(this.accept(["\u5909\u6570","word"])){let t=this.y[1];if(this.index-=2,this.accept(["\u5909\u6570","word","eq",this.yCalc])){let r=this.createVar(this.y[1],!1,this.isExportDefault),s=this.y[3]||this.yNop();return{type:"def_local_var",name:r.value,vartype:"\u5909\u6570",blocks:[s],...e,end:this.peekSourceMap()}}if(this.accept(["\u5909\u6570","word","{","word","}","eq",this.yCalc])){let r=this.isExportDefault,s=this.y[3].value;s==="\u516C\u958B"?r=!0:s==="\u975E\u516C\u958B"?r=!1:s==="\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8"?r=!0:this.logger.warn(`\u4E0D\u660E\u306A\u5909\u6570\u5C5E\u6027\u300E${s}\u300F\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002`);let i=this.createVar(this.y[1],!1,r),o=this.y[6]||this.yNop();return{type:"def_local_var",name:i.value,vartype:"\u5909\u6570",isExport:r,blocks:[o],...e,end:this.peekSourceMap()}}return this.index+=2,{type:"def_local_var",name:this.createVar(t,!1,this.isExportDefault).value,vartype:"\u5909\u6570",blocks:[this.yNop()],...e,end:this.peekSourceMap()}}if(this.accept(["\u5B9A\u6570","word","eq",this.yCalc])){let t=this.createVar(this.y[1],!0,this.isExportDefault),r=this.y[3]||this.yNop();return{type:"def_local_var",name:t.value,vartype:"\u5B9A\u6570",blocks:[r],...e,end:this.peekSourceMap()}}if(this.accept(["\u5B9A\u6570","word","{","word","}","eq",this.yCalc])){let t=this.isExportDefault,r=this.y[3].value;r==="\u516C\u958B"?t=!0:r==="\u975E\u516C\u958B"?t=!1:r==="\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8"?t=!0:this.logger.warn(`\u4E0D\u660E\u306A\u5B9A\u6570\u5C5E\u6027\u300E${r}\u300F\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002`);let s=this.createVar(this.y[1],!0,t),i=this.y[6]||this.yNop();return{type:"def_local_var",name:s.value,vartype:"\u5B9A\u6570",isExport:t,blocks:[i],...e,end:this.peekSourceMap()}}if(this.accept(["\u5B9A\u6570",this.yJSONArray,"eq",this.yCalc])){let t=this.y[1];if(t&&t.blocks instanceof Array){for(let i in t.blocks)if(t.blocks[i].type!=="word")throw d.fromNode(`\u8907\u6570\u5B9A\u6570\u306E\u4EE3\u5165\u6587${i+1}\u756A\u76EE\u3067\u30A8\u30E9\u30FC\u3002\u300E\u5B9A\u6570[A,B,C]=[1,2,3]\u300F\u306E\u66F8\u5F0F\u3067\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,this.y[0])}else throw d.fromNode("\u8907\u6570\u5B9A\u6570\u306E\u4EE3\u5165\u6587\u3067\u30A8\u30E9\u30FC\u3002\u300E\u5B9A\u6570[A,B,C]=[1,2,3]\u300F\u306E\u66F8\u5F0F\u3067\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002",this.y[0]);let r=this._tokensToNodes(this.createVarList(t.blocks,!0,this.isExportDefault)),s=this.y[3]||this.yNop();return{type:"def_local_varlist",names:r,vartype:"\u5B9A\u6570",blocks:[s],...e,end:this.peekSourceMap()}}if(this.accept(["\u5909\u6570",this.yJSONArray,"eq",this.yCalc])){let t=this.y[1];if(t&&t.blocks instanceof Array){for(let i in t.blocks)if(t.blocks[i].type!=="word")throw d.fromNode(`\u8907\u6570\u5909\u6570\u306E\u4EE3\u5165\u6587${i+1}\u756A\u76EE\u3067\u30A8\u30E9\u30FC\u3002\u300E\u5909\u6570[A,B,C]=[1,2,3]\u300F\u306E\u66F8\u5F0F\u3067\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,this.y[0])}else throw d.fromNode("\u8907\u6570\u5909\u6570\u306E\u4EE3\u5165\u6587\u3067\u30A8\u30E9\u30FC\u3002\u300E\u5909\u6570[A,B,C]=[1,2,3]\u300F\u306E\u66F8\u5F0F\u3067\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002",this.y[0]);let r=this._tokensToNodes(this.createVarList(t.blocks,!1,this.isExportDefault)),s=this.y[3]||this.yNop();return{type:"def_local_varlist",names:r,vartype:"\u5909\u6570",blocks:[s],...e,end:this.peekSourceMap()}}if(this.check2(["word","comma","word"])){if(this.accept(["word","comma","word","eq",this.yCalc])){let t=[this.y[0],this.y[2]];t=this.createVarList(t,!1,this.isExportDefault);let r=this.y[4]||this.yNop();return{type:"def_local_varlist",names:t,vartype:"\u5909\u6570",blocks:[r],...e,end:this.peekSourceMap()}}if(this.accept(["word","comma","word","comma","word","eq",this.yCalc])){let t=[this.y[0],this.y[2],this.y[4]];t=this.createVarList(t,!1,this.isExportDefault);let r=this.y[6]||this.yNop();return{type:"def_local_varlist",names:t,vartype:"\u5909\u6570",blocks:[r],...e,end:this.peekSourceMap()}}if(this.accept(["word","comma","word","comma","word","comma","word","eq",this.yCalc])){let t=[this.y[0],this.y[2],this.y[4],this.y[6]];t=this.createVarList(t,!1,this.isExportDefault);let r=this.y[8]||this.yNop();return{type:"def_local_varlist",names:t,vartype:"\u5909\u6570",blocks:[r],...e,end:this.peekSourceMap()}}if(this.accept(["word","comma","word","comma","word","comma","word","comma","word","eq",this.yCalc])){let t=[this.y[0],this.y[2],this.y[4],this.y[6],this.y[8]];t=this.createVarList(t,!1,this.isExportDefault);let r=this.y[10]||this.yNop();return{type:"def_local_varlist",names:t,vartype:"\u5909\u6570",blocks:[r],...e,end:this.peekSourceMap()}}}return null}checkArrayIndex(e){if(this.arrayIndexFrom===0)return e;let t={...e,type:"number",value:this.arrayIndexFrom};return{...e,type:"op",operator:"-",blocks:[e,t]}}checkArrayReverse(e){return e?!this.flagReverseArrayIndex||e.length<=1?e:e.reverse():[]}yLetArrayAt(e){if(this.accept(["word","@",this.yValue,"eq",this.yCalc])){let t=this.y[4];return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,this.checkArrayIndex(this.y[2])],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}if(this.accept(["word","@",this.yValue,"@",this.yValue,"eq",this.yCalc])){let t=this.y[6],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[4])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}if(this.accept(["word","@",this.yValue,"@",this.yValue,"@",this.yValue,"eq",this.yCalc])){let t=this.y[8],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[4]),this.checkArrayIndex(this.y[6])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}if(this.accept(["word","@",this.yValue,"comma",this.yValue,"eq",this.yCalc])){let t=this.y[6],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[4])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}if(this.accept(["word","@",this.yValue,"comma",this.yValue,"comma",this.yValue,"eq",this.yCalc])){let t=this.y[8],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[4]),this.checkArrayIndex(this.y[6])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}return null}yLetArrayBracket(e){if(this.accept(["word","[",this.yCalc,"]","eq",this.yCalc])){let t=this.y[5],r=[this.checkArrayIndex(this.y[2])];return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}if(this.accept(["word","[",this.yCalc,"]","[",this.yCalc,"]","eq",this.yCalc])){let t=this.y[8],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[5])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],tag:"2",checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}if(this.accept(["word","[",this.yCalc,"comma",this.yCalc,"]","eq",this.yCalc])){let t=this.y[7],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[4])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],checkInit:this.flagCheckArrayInit,tag:"2",...e,end:this.peekSourceMap()}}if(this.accept(["word","[",this.yCalc,"]","[",this.yCalc,"]","[",this.yCalc,"]","eq",this.yCalc])){let t=this.y[11],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[5]),this.checkArrayIndex(this.y[8])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}if(this.accept(["word","[",this.yCalc,"comma",this.yCalc,"comma",this.yCalc,"]","eq",this.yCalc])){let t=this.y[9],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[4]),this.checkArrayIndex(this.y[6])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,index:this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[4]),this.checkArrayIndex(this.y[6])]),blocks:[t,...r],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}return null}yCalc(){let e=this.peekSourceMap();if(this.check("eol"))return null;let t=this.yGetArg();if(!t)return null;if(t.josi==="")return t;let r=this.isReadingCalc;this.isReadingCalc=!0,this.pushStack(t);let s=this.yCall();if(this.isReadingCalc=r,!s)return this.popStack();let i=s;if(R.indexOf(s.josi||"")>=0){let u=this.yCalc();u&&(i={type:"renbun",operator:"renbun",blocks:[s,u],josi:u.josi,...e,end:this.peekSourceMap()})}let o=this.peek();return o&&C[o.type]?this.yGetArgOperator(i):i}yValueKakko(){if(!this.check("("))return null;let e=this.get();if(!e)throw new Error("[System Error] check \u3057\u305F\u306E\u306B get \u3067\u304D\u306A\u3044");this.saveStack();let t=this.yCalc()||this.ySentence();if(t===null){let s=this.get();throw this.logger.debug("(...)\u306E\u89E3\u6790\u30A8\u30E9\u30FC\u3002"+this.nodeToStr(s,{depth:1},!0)+"\u306E\u8FD1\u304F",e),d.fromNode("(...)\u306E\u89E3\u6790\u30A8\u30E9\u30FC\u3002"+this.nodeToStr(s,{depth:1},!1)+"\u306E\u8FD1\u304F",e)}if(!this.check(")"))throw this.logger.debug("(...)\u306E\u89E3\u6790\u30A8\u30E9\u30FC\u3002"+this.nodeToStr(t,{depth:1},!0)+"\u306E\u8FD1\u304F",e),d.fromNode("(...)\u306E\u89E3\u6790\u30A8\u30E9\u30FC\u3002"+this.nodeToStr(t,{depth:1},!1)+"\u306E\u8FD1\u304F",e);let r=this.get();return this.loadStack(),r&&(t.josi=r.josi),t}yConst(e,t){return{type:e.type,value:e.value,josi:e.josi,...t}}yValue(){let e=this.peekSourceMap();if(this.check("comma")&&this.get(),this.checkTypes(["number","bigint","string"]))return this.yConst(this.getCur(),e);if(this.check("("))return this.yValueKakko();if(this.check2(["-","number"])||this.check2(["-","word"])||this.check2(["-","func"])){let u=this.get(),c=this.yValue(),a=c&&c.josi?c.josi:"",l={type:"number",value:-1,line:u&&u.line?u.line:0},h=c||this.yNop();return{type:"op",operator:"*",blocks:[l,h],josi:a,...e,end:this.peekSourceMap()}}if(this.check("not")){this.get();let u=this.yValue(),c=u&&u.josi?u.josi:"";return{type:"not",operator:"not",blocks:[u],josi:c,...e,end:this.peekSourceMap()}}let t=this.yJSONArray();if(t)return t;let r=this.yJSONObject();if(r)return r;let s=K.concat(["eol",")","]","\u306A\u3089\u3070","\u56DE","\u9593","\u53CD\u5FA9","\u6761\u4EF6\u5206\u5C90"]);if(this.check2(["func",s])){let u=this.get();if(!u)throw new Error("[System Error] \u6B63\u3057\u304F\u5024\u304C\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002");let c=u,a=this.getVarNameRef(c);this.usedFuncs.add(a.value);let f=c.meta,l=[];if(!f)throw d.fromNode(`\u4E00\u8A9E\u95A2\u6570\u300E${a.value}\u300F\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3002`,c);if(f.josi&&f.josi.length===1)l.push({type:"word",value:"\u305D\u308C"});else if(f.josi&&f.josi.length>=2)throw d.fromNode(`\u95A2\u6570\u300E${a.value}\u300F\u3067\u5F15\u6570\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002${f.josi.length}\u500B\u306E\u5F15\u6570\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,c);return{type:"func",name:a.value,blocks:l,josi:a.josi,meta:f,asyncFn:!!f.asyncFn,...e,end:this.peekSourceMap()}}if(this.check2([["func","word"],"("])&&this.peekDef().josi===""){let u=this.peek();if(this.accept([["func","word"],"(",this.yGetArgParen,")"])){let c=this.getVarNameRef(this.y[0]),a=c.meta,f=this.y[2],l=c.value,h=!1;if(this.usedFuncs.add(l),a&&a.josi){if(a.josi.length!==f.length){if(!a.isVariableJosi)throw d.fromNode(`\u95A2\u6570\u300E${c.value}\u300F\u3067\u5F15\u6570${f.length}\u500B\u304C\u6307\u5B9A\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a.josi.length}\u500B\u306E\u5F15\u6570\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,c)}h=!!a.asyncFn}return{type:"func",name:l,blocks:f,josi:this.y[3].josi,meta:a,asyncFn:h,...e,end:this.peekSourceMap()}}throw d.fromNode("C\u98A8\u95A2\u6570\u547C\u3073\u51FA\u3057\u306E\u30A8\u30E9\u30FC",u||j())}if(this.check("def_func"))return this.yMumeiFunc();let i=this.yValueWord();if(i)return i;let o=this.yValueFuncPointer();return o||null}yValueWordGetIndex(e){if(e.index||(e.index=[]),this.check("@")){if(this.accept(["@",this.yValue,"comma",this.yValue,"comma",this.yValue]))return e.index.push(this.checkArrayIndex(this.y[1])),e.index.push(this.checkArrayIndex(this.y[3])),e.index.push(this.checkArrayIndex(this.y[5])),e.index=this.checkArrayReverse(e.index),e.josi=this.y[5].josi,!0;if(this.accept(["@",this.yValue,"comma",this.yValue]))return e.index.push(this.checkArrayIndex(this.y[1])),e.index.push(this.checkArrayIndex(this.y[3])),e.index=this.checkArrayReverse(e.index),e.josi=this.y[3].josi,!0;if(this.accept(["@",this.yValue]))return e.index.push(this.checkArrayIndex(this.y[1])),e.josi=this.y[1].josi,!0;throw d.fromNode("\u5909\u6570\u306E\u5F8C\u308D\u306E\u300E@\u8981\u7D20\u300F\u306E\u6307\u5B9A\u304C\u4E0D\u6B63\u3067\u3059\u3002",e)}if(this.check("[")&&this.accept(["[",this.yCalc,"]"]))return e.index.push(this.checkArrayIndex(this.y[1])),e.josi=this.y[2].josi,this.y[2].josi==="";if(this.check("[")&&this.accept(["[",this.yCalc,"comma",this.yCalc,"]"])){let t=[this.checkArrayIndex(this.y[1]),this.checkArrayIndex(this.y[3])];return e.index=this.checkArrayReverse(t),e.josi=this.y[4].josi,this.y[4].josi===""}if(this.check("[")&&this.accept(["[",this.yCalc,"comma",this.yCalc,"comma",this.yCalc,"]"])){let t=[this.checkArrayIndex(this.y[1]),this.checkArrayIndex(this.y[3]),this.checkArrayIndex(this.y[5])];return e.index=this.checkArrayReverse(t),e.josi=this.y[6].josi,this.y[6].josi===""}return!1}yValueFuncPointer(){let e=this.peekSourceMap();if(this.check("func_pointer")){let t=this.getCur();return{type:"func_pointer",name:t.value,josi:t.josi,...e,end:this.peekSourceMap()}}return null}yValueWord(){let e=this.peekSourceMap();if(this.check("word")){let t=this.getCur(),r=this.getVarNameRef(t);if(r.josi===""&&this.checkTypes(["[","@"])){let s={type:"\u914D\u5217\u53C2\u7167",name:r,index:[],josi:"",...e,end:this.peekSourceMap()};for(;!this.isEOF()&&this.yValueWordGetIndex(s););if(s.index&&s.index.length===0)throw d.fromNode(`\u914D\u5217\u300E${r.value}\u300F\u30A2\u30AF\u30BB\u30B9\u3067\u6307\u5B9A\u30DF\u30B9`,r);return s}return r}return null}createVar(e,t,r){let s=e.value,i=t?"const":"var";if(this.funcLevel===0){s.indexOf("__")<0&&(s=this.modName+"__"+s);let o={type:i,value:"",isExport:r};this.funclist.set(s,o);let u=e;return u.value=s,e}else return this.localvars.set(s,{type:i,value:""}),e}getVarName(e){let t=this.findVar(e.value);return t?(t&&t.scope==="global"&&(e.value=t.name),e):(this.createVar(e,!1,this.isExportDefault),e)}getVarNameRef(e){let t=this.findVar(e.value);return t?t&&t.scope==="global"&&(e.value=t.name):this.funcLevel===0&&e.value.indexOf("__")<0&&(e.value=this.modName+"__"+e.value),e}createVarList(e,t,r){for(let s=0;s<e.length;s++)e[s]=this.createVar(e[s],t,r);return e}yJSONObjectValue(){let e=[],t=this.peek();if(!t)return[];for(;!this.isEOF();){for(;this.check("eol");)this.get();if(this.check("}"))break;if(this.accept(["word",":",this.yCalc]))this.y[0].type="string",e.push(this.y[0]),e.push(this.y[2]);else if(this.accept(["string",":",this.yCalc]))e.push(this.y[0]),e.push(this.y[2]);else if(this.accept(["word"])){let r=this.y[0],s=JSON.parse(JSON.stringify(r));r.type="string",e.push(r),e.push(s)}else if(this.checkTypes(["string","number"])){let r=this.getCur();e.push(r),e.push(r)}else throw d.fromNode("\u8F9E\u66F8\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u5BA3\u8A00\u3067\u672B\u5C3E\u306E\u300E}\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002",t);this.check("comma")&&this.get()}return e}yJSONObject(){let e=this.peekSourceMap();if(this.accept(["{","}"]))return{type:"json_obj",blocks:[],josi:this.y[1].josi,...e,end:this.peekSourceMap()};if(this.accept(["{",this.yJSONObjectValue,"}"]))return{type:"json_obj",blocks:this.y[1],josi:this.y[2].josi,...e,end:this.peekSourceMap()};if(this.accept(["{",this.yJSONObjectValue]))throw d.fromNode("\u8F9E\u66F8\u578B\u5909\u6570\u306E\u521D\u671F\u5316\u304C\u300E}\u300F\u3067\u9589\u3058\u3089\u308C\u3066\u3044\u307E\u305B\u3093\u3002",this.y[1]);return null}yJSONArrayValue(){this.check("eol")&&this.get();let e=this.yCalc();if(e===null)return[];this.check("comma")&&this.get();let t=[e];for(;!this.isEOF()&&(this.check("eol")&&this.get(),!this.check("]"));){let r=this.yCalc();if(r===null)break;this.check("comma")&&this.get(),t.push(r)}return t}yJSONArray(){let e=this.peekSourceMap();if(this.accept(["[","]"]))return{type:"json_array",blocks:[],josi:this.y[1].josi,...e,end:this.peekSourceMap()};if(this.accept(["[",this.yJSONArrayValue,"]"]))return{type:"json_array",blocks:this.y[1],josi:this.y[2].josi,...e,end:this.peekSourceMap()};if(this.accept(["[",this.yJSONArrayValue]))throw d.fromNode("\u914D\u5217\u5909\u6570\u306E\u521D\u671F\u5316\u304C\u300E]\u300F\u3067\u9589\u3058\u3089\u308C\u3066\u3044\u307E\u305B\u3093\u3002",this.y[1]);return null}yTryExcept(){let e=this.peekSourceMap();if(!this.check("\u30A8\u30E9\u30FC\u76E3\u8996"))return null;let t=this.getCur(),r=this.yBlock();if(!this.check2(["\u30A8\u30E9\u30FC","\u306A\u3089\u3070"]))throw d.fromNode("\u30A8\u30E9\u30FC\u69CB\u6587\u3067\u300E\u30A8\u30E9\u30FC\u306A\u3089\u3070\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u300E\u30A8\u30E9\u30FC\u76E3\u8996..\u30A8\u30E9\u30FC\u306A\u3089\u3070..\u3053\u3053\u307E\u3067\u300F\u3092\u5BFE\u3067\u8A18\u8FF0\u3057\u307E\u3059\u3002",t);this.get(),this.get();let s=this.yBlock();if(this.check("\u3053\u3053\u307E\u3067"))this.get();else throw d.fromNode("\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u300E\u30A8\u30E9\u30FC\u76E3\u8996\u300F...\u300E\u30A8\u30E9\u30FC\u306A\u3089\u3070\u300F...\u300E\u3053\u3053\u307E\u3067\u300F\u3092\u5BFE\u5FDC\u3055\u305B\u3066\u304F\u3060\u3055\u3044\u3002",e);return{type:"try_except",blocks:[r,s],josi:"",...e,end:this.peekSourceMap()}}_checkAsyncFn(e){if(!e)return!1;if(e.type=="def_func"||e.type=="def_test"||e.type=="func_obj"){let t=e;if(t.asyncFn)return!0;let r=!1;for(let s of t.blocks)if(this._checkAsyncFn(s))return r=!0,t.asyncFn=r,t.meta.asyncFn=r,this.isModifiedNodes=!0,!0}if(e.type=="func"){let t=e;if(t.asyncFn)return!0;if(t.blocks){for(let s of t.blocks)if(this._checkAsyncFn(s))return t.asyncFn=!0,this.isModifiedNodes=!0,!0}let r=this.funclist.get(t.name);return r&&r.asyncFn?(t.asyncFn=!0,this.isModifiedNodes=!0,!0):!1}if(e.type=="renbun")return!0;if(e.blocks){for(let t of e.blocks)if(this._checkAsyncFn(t))return!0}return!1}_tokensToNodes(e){let t=[];for(let r of e)t.push(this._tokenToNode(r));return t}_tokenToNode(e){let t=this.peekSourceMap(e);if(e.type==="string"||e.type=="number"||e.type=="bigint")return this.yConst(e,t);if(e.type==="word")return{type:"word",value:e.value,josi:e.josi,...t};if(e.type==="eol"||e.type==="_eol")return{type:"eol",...t};throw new Error("[System Error] \u672A\u77E5\u306E\u30C8\u30FC\u30AF\u30F3\u304CAst\u306B\u5909\u63DB\u3055\u308C\u307E\u3057\u305F\u3002")}};var de=class{constructor(e,t,r){this.from=e,this.to=t,this.index=r}},N=class{constructor(e,t){this.text=e,this.sourcePosition=t}},ye=class{constructor(e){this.history=[],this.code=e}getText(){return this.code}replaceAll(e,t){for(;;){let r=this.getText().indexOf(e);if(r===-1)break;e.length!==t.length&&this.history.unshift(new de(e.length,t.length,r)),this.code=this.code.replace(e,t)}}getSourcePosition(e){for(let t of this.history)e>=t.index+t.to?e+=t.from-t.to:t.index<=e&&e<t.index+t.to&&(t.to>=2&&e===t.index+t.to-1?e=t.index+t.from-1:e=t.index);return e}},re=class n{static getInstance(){return n._instance||(n._instance=new n),n._instance}constructor(){this.convertTable=new Map([[8208,"-"],[8209,"-"],[8211,"-"],[8212,"-"],[8213,"-"],[8722,"-"],[732,"~"],[759,"~"],[8275,"~"],[8764,"~"],[12316,"~"],[65374,"~"],[8192," "],[8194," "],[8195," "],[8196," "],[8197," "],[8198," "],[8199," "],[8201," "],[8202," "],[8203," "],[8239," "],[8287," "],[12288," "],[12644," "],[8251,"#"],[12290,";"],[12304,"["],[12305,"]"],[12289,","],[65292,","],[10006,"*"],[10133,"+"],[10134,"-"],[10135,"\xF7"]])}convert1ch(e){if(!e)return"";let t=e.codePointAt(0)||0,r=this.convertTable.get(t)||"";if(r)return r;if(t<127)return e;if(t>=65281&&t<=65374){let s=t-65248;return String.fromCodePoint(s)}return e}convert(e){if(!e)return[];let t=new ye(e);t.replaceAll(`\r
|
|
16
|
+
${s.message}`,e))}}if(this.check2(["word","@"])){let t=this.yLetArrayAt(e);if(this.check("comma")&&this.get(),t)return t.checkInit=this.flagCheckArrayInit,t}if(this.check2(["word","["])){let t=this.yLetArrayBracket(e);if(this.check("comma")&&this.get(),t)return t.checkInit=this.flagCheckArrayInit,t}if(this.accept(["word","\u3068\u306F"])){let t=this.y[0];if(!this.checkTypes(["\u5909\u6570","\u5B9A\u6570"]))throw d.fromNode("\u30ED\u30FC\u30AB\u30EB\u5909\u6570\u300E"+t.value+"\u300F\u306E\u5B9A\u7FA9\u30A8\u30E9\u30FC",t);let r=this.getCur(),s=this.isExportDefault;if(this.check2(["{","word","}"])){this.get();let u=this.get();if(u===null)throw d.fromNode("\u30ED\u30FC\u30AB\u30EB\u5909\u6570\u300E"+t.value+"\u300F\u306E\u5B9A\u7FA9\u30A8\u30E9\u30FC",t);let c=u.value;c==="\u516C\u958B"?s=!0:c==="\u975E\u516C\u958B"?s=!1:c==="\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8"?s=!0:this.logger.warn(`\u4E0D\u660E\u306A\u5909\u6570\u5C5E\u6027\u300E${c}\u300F\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002`),this.get()}let i=this.createVar(t,r.type==="\u5B9A\u6570",s),o=this.yNop();return this.check("eq")&&(this.get(),o=this.yCalc()||o),this.check("comma")&&this.get(),{type:"def_local_var",name:i.value,vartype:r.type,isExport:s,blocks:[o],...e,end:this.peekSourceMap()}}if(this.accept(["\u5909\u6570","word"])){let t=this.y[1];if(this.index-=2,this.accept(["\u5909\u6570","word","eq",this.yCalc])){let r=this.createVar(this.y[1],!1,this.isExportDefault),s=this.y[3]||this.yNop();return{type:"def_local_var",name:r.value,vartype:"\u5909\u6570",blocks:[s],...e,end:this.peekSourceMap()}}if(this.accept(["\u5909\u6570","word","{","word","}","eq",this.yCalc])){let r=this.isExportDefault,s=this.y[3].value;s==="\u516C\u958B"?r=!0:s==="\u975E\u516C\u958B"?r=!1:s==="\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8"?r=!0:this.logger.warn(`\u4E0D\u660E\u306A\u5909\u6570\u5C5E\u6027\u300E${s}\u300F\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002`);let i=this.createVar(this.y[1],!1,r),o=this.y[6]||this.yNop();return{type:"def_local_var",name:i.value,vartype:"\u5909\u6570",isExport:r,blocks:[o],...e,end:this.peekSourceMap()}}return this.index+=2,{type:"def_local_var",name:this.createVar(t,!1,this.isExportDefault).value,vartype:"\u5909\u6570",blocks:[this.yNop()],...e,end:this.peekSourceMap()}}if(this.accept(["\u5B9A\u6570","word","eq",this.yCalc])){let t=this.createVar(this.y[1],!0,this.isExportDefault),r=this.y[3]||this.yNop();return{type:"def_local_var",name:t.value,vartype:"\u5B9A\u6570",blocks:[r],...e,end:this.peekSourceMap()}}if(this.accept(["\u5B9A\u6570","word","{","word","}","eq",this.yCalc])){let t=this.isExportDefault,r=this.y[3].value;r==="\u516C\u958B"?t=!0:r==="\u975E\u516C\u958B"?t=!1:r==="\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8"?t=!0:this.logger.warn(`\u4E0D\u660E\u306A\u5B9A\u6570\u5C5E\u6027\u300E${r}\u300F\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002`);let s=this.createVar(this.y[1],!0,t),i=this.y[6]||this.yNop();return{type:"def_local_var",name:s.value,vartype:"\u5B9A\u6570",isExport:t,blocks:[i],...e,end:this.peekSourceMap()}}if(this.accept(["\u5B9A\u6570",this.yJSONArray,"eq",this.yCalc])){let t=this.y[1];if(t&&t.blocks instanceof Array){for(let i in t.blocks)if(t.blocks[i].type!=="word")throw d.fromNode(`\u8907\u6570\u5B9A\u6570\u306E\u4EE3\u5165\u6587${i+1}\u756A\u76EE\u3067\u30A8\u30E9\u30FC\u3002\u300E\u5B9A\u6570[A,B,C]=[1,2,3]\u300F\u306E\u66F8\u5F0F\u3067\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,this.y[0])}else throw d.fromNode("\u8907\u6570\u5B9A\u6570\u306E\u4EE3\u5165\u6587\u3067\u30A8\u30E9\u30FC\u3002\u300E\u5B9A\u6570[A,B,C]=[1,2,3]\u300F\u306E\u66F8\u5F0F\u3067\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002",this.y[0]);let r=this._tokensToNodes(this.createVarList(t.blocks,!0,this.isExportDefault)),s=this.y[3]||this.yNop();return{type:"def_local_varlist",names:r,vartype:"\u5B9A\u6570",blocks:[s],...e,end:this.peekSourceMap()}}if(this.accept(["\u5909\u6570",this.yJSONArray,"eq",this.yCalc])){let t=this.y[1];if(t&&t.blocks instanceof Array){for(let i in t.blocks)if(t.blocks[i].type!=="word")throw d.fromNode(`\u8907\u6570\u5909\u6570\u306E\u4EE3\u5165\u6587${i+1}\u756A\u76EE\u3067\u30A8\u30E9\u30FC\u3002\u300E\u5909\u6570[A,B,C]=[1,2,3]\u300F\u306E\u66F8\u5F0F\u3067\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,this.y[0])}else throw d.fromNode("\u8907\u6570\u5909\u6570\u306E\u4EE3\u5165\u6587\u3067\u30A8\u30E9\u30FC\u3002\u300E\u5909\u6570[A,B,C]=[1,2,3]\u300F\u306E\u66F8\u5F0F\u3067\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002",this.y[0]);let r=this._tokensToNodes(this.createVarList(t.blocks,!1,this.isExportDefault)),s=this.y[3]||this.yNop();return{type:"def_local_varlist",names:r,vartype:"\u5909\u6570",blocks:[s],...e,end:this.peekSourceMap()}}if(this.check2(["word","comma","word"])){if(this.accept(["word","comma","word","eq",this.yCalc])){let t=[this.y[0],this.y[2]];t=this.createVarList(t,!1,this.isExportDefault);let r=this.y[4]||this.yNop();return{type:"def_local_varlist",names:t,vartype:"\u5909\u6570",blocks:[r],...e,end:this.peekSourceMap()}}if(this.accept(["word","comma","word","comma","word","eq",this.yCalc])){let t=[this.y[0],this.y[2],this.y[4]];t=this.createVarList(t,!1,this.isExportDefault);let r=this.y[6]||this.yNop();return{type:"def_local_varlist",names:t,vartype:"\u5909\u6570",blocks:[r],...e,end:this.peekSourceMap()}}if(this.accept(["word","comma","word","comma","word","comma","word","eq",this.yCalc])){let t=[this.y[0],this.y[2],this.y[4],this.y[6]];t=this.createVarList(t,!1,this.isExportDefault);let r=this.y[8]||this.yNop();return{type:"def_local_varlist",names:t,vartype:"\u5909\u6570",blocks:[r],...e,end:this.peekSourceMap()}}if(this.accept(["word","comma","word","comma","word","comma","word","comma","word","eq",this.yCalc])){let t=[this.y[0],this.y[2],this.y[4],this.y[6],this.y[8]];t=this.createVarList(t,!1,this.isExportDefault);let r=this.y[10]||this.yNop();return{type:"def_local_varlist",names:t,vartype:"\u5909\u6570",blocks:[r],...e,end:this.peekSourceMap()}}}return null}checkArrayIndex(e){if(this.arrayIndexFrom===0)return e;let t={...e,type:"number",value:this.arrayIndexFrom};return{...e,type:"op",operator:"-",blocks:[e,t]}}checkArrayReverse(e){return e?!this.flagReverseArrayIndex||e.length<=1?e:e.reverse():[]}yLetArrayAt(e){if(this.accept(["word","@",this.yValue,"eq",this.yCalc])){let t=this.y[4];return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,this.checkArrayIndex(this.y[2])],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}if(this.accept(["word","@",this.yValue,"@",this.yValue,"eq",this.yCalc])){let t=this.y[6],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[4])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}if(this.accept(["word","@",this.yValue,"@",this.yValue,"@",this.yValue,"eq",this.yCalc])){let t=this.y[8],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[4]),this.checkArrayIndex(this.y[6])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}if(this.accept(["word","@",this.yValue,"comma",this.yValue,"eq",this.yCalc])){let t=this.y[6],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[4])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}if(this.accept(["word","@",this.yValue,"comma",this.yValue,"comma",this.yValue,"eq",this.yCalc])){let t=this.y[8],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[4]),this.checkArrayIndex(this.y[6])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}return null}yLetArrayBracket(e){if(this.accept(["word","[",this.yCalc,"]","eq",this.yCalc])){let t=this.y[5],r=[this.checkArrayIndex(this.y[2])];return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}if(this.accept(["word","[",this.yCalc,"]","[",this.yCalc,"]","eq",this.yCalc])){let t=this.y[8],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[5])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],tag:"2",checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}if(this.accept(["word","[",this.yCalc,"comma",this.yCalc,"]","eq",this.yCalc])){let t=this.y[7],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[4])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],checkInit:this.flagCheckArrayInit,tag:"2",...e,end:this.peekSourceMap()}}if(this.accept(["word","[",this.yCalc,"]","[",this.yCalc,"]","[",this.yCalc,"]","eq",this.yCalc])){let t=this.y[11],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[5]),this.checkArrayIndex(this.y[8])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,blocks:[t,...r],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}if(this.accept(["word","[",this.yCalc,"comma",this.yCalc,"comma",this.yCalc,"]","eq",this.yCalc])){let t=this.y[9],r=this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[4]),this.checkArrayIndex(this.y[6])]);return{type:"let_array",name:this.getVarName(this.y[0]).value,index:this.checkArrayReverse([this.checkArrayIndex(this.y[2]),this.checkArrayIndex(this.y[4]),this.checkArrayIndex(this.y[6])]),blocks:[t,...r],checkInit:this.flagCheckArrayInit,...e,end:this.peekSourceMap()}}return null}yCalc(){let e=this.peekSourceMap();if(this.check("eol"))return null;let t=this.yGetArg();if(!t)return null;if(t.josi==="")return t;let r=this.isReadingCalc;this.isReadingCalc=!0,this.pushStack(t);let s=this.yCall();if(this.isReadingCalc=r,!s)return this.popStack();let i=s;if(R.indexOf(s.josi||"")>=0){let u=this.yCalc();u&&(i={type:"renbun",operator:"renbun",blocks:[s,u],josi:u.josi,...e,end:this.peekSourceMap()})}let o=this.peek();return o&&C[o.type]?this.yGetArgOperator(i):i}yValueKakko(){if(!this.check("("))return null;let e=this.get();if(!e)throw new Error("[System Error] check \u3057\u305F\u306E\u306B get \u3067\u304D\u306A\u3044");this.saveStack();let t=this.yCalc()||this.ySentence();if(t===null){let s=this.get();throw this.logger.debug("(...)\u306E\u89E3\u6790\u30A8\u30E9\u30FC\u3002"+this.nodeToStr(s,{depth:1},!0)+"\u306E\u8FD1\u304F",e),d.fromNode("(...)\u306E\u89E3\u6790\u30A8\u30E9\u30FC\u3002"+this.nodeToStr(s,{depth:1},!1)+"\u306E\u8FD1\u304F",e)}if(!this.check(")"))throw this.logger.debug("(...)\u306E\u89E3\u6790\u30A8\u30E9\u30FC\u3002"+this.nodeToStr(t,{depth:1},!0)+"\u306E\u8FD1\u304F",e),d.fromNode("(...)\u306E\u89E3\u6790\u30A8\u30E9\u30FC\u3002"+this.nodeToStr(t,{depth:1},!1)+"\u306E\u8FD1\u304F",e);let r=this.get();return this.loadStack(),r&&(t.josi=r.josi),t}yConst(e,t){return{type:e.type,value:e.value,josi:e.josi,...t}}yValue(){let e=this.peekSourceMap();if(this.check("comma")&&this.get(),this.checkTypes(["number","bigint","string"]))return this.yConst(this.getCur(),e);if(this.check("("))return this.yValueKakko();if(this.check2(["-","number"])||this.check2(["-","word"])||this.check2(["-","func"])){let u=this.get(),c=this.yValue(),a=c&&c.josi?c.josi:"",l={type:"number",value:-1,line:u&&u.line?u.line:0},h=c||this.yNop();return{type:"op",operator:"*",blocks:[l,h],josi:a,...e,end:this.peekSourceMap()}}if(this.check("not")){this.get();let u=this.yValue(),c=u&&u.josi?u.josi:"";return{type:"not",operator:"not",blocks:[u],josi:c,...e,end:this.peekSourceMap()}}let t=this.yJSONArray();if(t)return t;let r=this.yJSONObject();if(r)return r;let s=K.concat(["eol",")","]","\u306A\u3089\u3070","\u56DE","\u9593","\u53CD\u5FA9","\u6761\u4EF6\u5206\u5C90"]);if(this.check2(["func",s])){let u=this.get();if(!u)throw new Error("[System Error] \u6B63\u3057\u304F\u5024\u304C\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002");let c=u,a=this.getVarNameRef(c);this.usedFuncs.add(a.value);let f=c.meta,l=[];if(!f)throw d.fromNode(`\u4E00\u8A9E\u95A2\u6570\u300E${a.value}\u300F\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3002`,c);if(f.josi&&f.josi.length===1)l.push({type:"word",value:"\u305D\u308C"});else if(f.josi&&f.josi.length>=2)throw d.fromNode(`\u95A2\u6570\u300E${a.value}\u300F\u3067\u5F15\u6570\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002${f.josi.length}\u500B\u306E\u5F15\u6570\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,c);return{type:"func",name:a.value,blocks:l,josi:a.josi,meta:f,asyncFn:!!f.asyncFn,...e,end:this.peekSourceMap()}}if(this.check2([["func","word"],"("])&&this.peekDef().josi===""){let u=this.peek();if(this.accept([["func","word"],"(",this.yGetArgParen,")"])){let c=this.getVarNameRef(this.y[0]),a=c.meta,f=this.y[2],l=c.value,h=!1;if(this.usedFuncs.add(l),a&&a.josi){if(a.josi.length!==f.length){if(!a.isVariableJosi)throw d.fromNode(`\u95A2\u6570\u300E${c.value}\u300F\u3067\u5F15\u6570${f.length}\u500B\u304C\u6307\u5B9A\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a.josi.length}\u500B\u306E\u5F15\u6570\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,c)}h=!!a.asyncFn}return{type:"func",name:l,blocks:f,josi:this.y[3].josi,meta:a,asyncFn:h,...e,end:this.peekSourceMap()}}throw d.fromNode("C\u98A8\u95A2\u6570\u547C\u3073\u51FA\u3057\u306E\u30A8\u30E9\u30FC",u||x())}if(this.check("def_func"))return this.yMumeiFunc();let i=this.yValueWord();if(i)return i;let o=this.yValueFuncPointer();return o||null}yValueWordGetIndex(e){if(e.index||(e.index=[]),this.check("@")){if(this.accept(["@",this.yValue,"comma",this.yValue,"comma",this.yValue]))return e.index.push(this.checkArrayIndex(this.y[1])),e.index.push(this.checkArrayIndex(this.y[3])),e.index.push(this.checkArrayIndex(this.y[5])),e.index=this.checkArrayReverse(e.index),e.josi=this.y[5].josi,!0;if(this.accept(["@",this.yValue,"comma",this.yValue]))return e.index.push(this.checkArrayIndex(this.y[1])),e.index.push(this.checkArrayIndex(this.y[3])),e.index=this.checkArrayReverse(e.index),e.josi=this.y[3].josi,!0;if(this.accept(["@",this.yValue]))return e.index.push(this.checkArrayIndex(this.y[1])),e.josi=this.y[1].josi,!0;throw d.fromNode("\u5909\u6570\u306E\u5F8C\u308D\u306E\u300E@\u8981\u7D20\u300F\u306E\u6307\u5B9A\u304C\u4E0D\u6B63\u3067\u3059\u3002",e)}if(this.check("[")&&this.accept(["[",this.yCalc,"]"]))return e.index.push(this.checkArrayIndex(this.y[1])),e.josi=this.y[2].josi,this.y[2].josi==="";if(this.check("[")&&this.accept(["[",this.yCalc,"comma",this.yCalc,"]"])){let t=[this.checkArrayIndex(this.y[1]),this.checkArrayIndex(this.y[3])];return e.index=this.checkArrayReverse(t),e.josi=this.y[4].josi,this.y[4].josi===""}if(this.check("[")&&this.accept(["[",this.yCalc,"comma",this.yCalc,"comma",this.yCalc,"]"])){let t=[this.checkArrayIndex(this.y[1]),this.checkArrayIndex(this.y[3]),this.checkArrayIndex(this.y[5])];return e.index=this.checkArrayReverse(t),e.josi=this.y[6].josi,this.y[6].josi===""}return!1}yValueFuncPointer(){let e=this.peekSourceMap();if(this.check("func_pointer")){let t=this.getCur();return{type:"func_pointer",name:t.value,josi:t.josi,...e,end:this.peekSourceMap()}}return null}yValueWord(){let e=this.peekSourceMap();if(this.check("word")){let t=this.getCur(),r=this.getVarNameRef(t);if(r.josi===""&&this.checkTypes(["[","@"])){let s={type:"\u914D\u5217\u53C2\u7167",name:r,index:[],josi:"",...e,end:this.peekSourceMap()};for(;!this.isEOF()&&this.yValueWordGetIndex(s););if(s.index&&s.index.length===0)throw d.fromNode(`\u914D\u5217\u300E${r.value}\u300F\u30A2\u30AF\u30BB\u30B9\u3067\u6307\u5B9A\u30DF\u30B9`,r);return s}return r}return null}createVar(e,t,r){let s=e.value,i=t?"const":"var";if(this.funcLevel===0){s.indexOf("__")<0&&(s=this.modName+"__"+s);let o={type:i,value:"",isExport:r};this.funclist.set(s,o);let u=e;return u.value=s,e}else return this.localvars.set(s,{type:i,value:""}),e}getVarName(e){let t=this.findVar(e.value);return t?(t&&t.scope==="global"&&(e.value=t.name),e):(this.createVar(e,!1,this.isExportDefault),e)}getVarNameRef(e){let t=this.findVar(e.value);return t?t&&t.scope==="global"&&(e.value=t.name):this.funcLevel===0&&e.value.indexOf("__")<0&&(e.value=this.modName+"__"+e.value),e}createVarList(e,t,r){for(let s=0;s<e.length;s++)e[s]=this.createVar(e[s],t,r);return e}yJSONObjectValue(){let e=[],t=this.peek();if(!t)return[];for(;!this.isEOF();){for(;this.check("eol");)this.get();if(this.check("}"))break;if(this.accept(["word",":",this.yCalc]))this.y[0].type="string",e.push(this.y[0]),e.push(this.y[2]);else if(this.accept(["string",":",this.yCalc]))e.push(this.y[0]),e.push(this.y[2]);else if(this.accept(["word"])){let r=this.y[0],s=JSON.parse(JSON.stringify(r));r.type="string",e.push(r),e.push(s)}else if(this.checkTypes(["string","number"])){let r=this.getCur();e.push(r),e.push(r)}else throw d.fromNode("\u8F9E\u66F8\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u5BA3\u8A00\u3067\u672B\u5C3E\u306E\u300E}\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002",t);this.check("comma")&&this.get()}return e}yJSONObject(){let e=this.peekSourceMap();if(this.accept(["{","}"]))return{type:"json_obj",blocks:[],josi:this.y[1].josi,...e,end:this.peekSourceMap()};if(this.accept(["{",this.yJSONObjectValue,"}"]))return{type:"json_obj",blocks:this.y[1],josi:this.y[2].josi,...e,end:this.peekSourceMap()};if(this.accept(["{",this.yJSONObjectValue]))throw d.fromNode("\u8F9E\u66F8\u578B\u5909\u6570\u306E\u521D\u671F\u5316\u304C\u300E}\u300F\u3067\u9589\u3058\u3089\u308C\u3066\u3044\u307E\u305B\u3093\u3002",this.y[1]);return null}yJSONArrayValue(){this.check("eol")&&this.get();let e=this.yCalc();if(e===null)return[];this.check("comma")&&this.get();let t=[e];for(;!this.isEOF()&&(this.check("eol")&&this.get(),!this.check("]"));){let r=this.yCalc();if(r===null)break;this.check("comma")&&this.get(),t.push(r)}return t}yJSONArray(){let e=this.peekSourceMap();if(this.accept(["[","]"]))return{type:"json_array",blocks:[],josi:this.y[1].josi,...e,end:this.peekSourceMap()};if(this.accept(["[",this.yJSONArrayValue,"]"]))return{type:"json_array",blocks:this.y[1],josi:this.y[2].josi,...e,end:this.peekSourceMap()};if(this.accept(["[",this.yJSONArrayValue]))throw d.fromNode("\u914D\u5217\u5909\u6570\u306E\u521D\u671F\u5316\u304C\u300E]\u300F\u3067\u9589\u3058\u3089\u308C\u3066\u3044\u307E\u305B\u3093\u3002",this.y[1]);return null}yTryExcept(){let e=this.peekSourceMap();if(!this.check("\u30A8\u30E9\u30FC\u76E3\u8996"))return null;let t=this.getCur(),r=this.yBlock();if(!this.check2(["\u30A8\u30E9\u30FC","\u306A\u3089\u3070"]))throw d.fromNode("\u30A8\u30E9\u30FC\u69CB\u6587\u3067\u300E\u30A8\u30E9\u30FC\u306A\u3089\u3070\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u300E\u30A8\u30E9\u30FC\u76E3\u8996..\u30A8\u30E9\u30FC\u306A\u3089\u3070..\u3053\u3053\u307E\u3067\u300F\u3092\u5BFE\u3067\u8A18\u8FF0\u3057\u307E\u3059\u3002",t);this.get(),this.get();let s=this.yBlock();if(this.check("\u3053\u3053\u307E\u3067"))this.get();else throw d.fromNode("\u300E\u3053\u3053\u307E\u3067\u300F\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u300E\u30A8\u30E9\u30FC\u76E3\u8996\u300F...\u300E\u30A8\u30E9\u30FC\u306A\u3089\u3070\u300F...\u300E\u3053\u3053\u307E\u3067\u300F\u3092\u5BFE\u5FDC\u3055\u305B\u3066\u304F\u3060\u3055\u3044\u3002",e);return{type:"try_except",blocks:[r,s],josi:"",...e,end:this.peekSourceMap()}}_checkAsyncFn(e){if(!e)return!1;if(e.type=="def_func"||e.type=="def_test"||e.type=="func_obj"){let t=e;if(t.asyncFn)return!0;let r=!1;for(let s of t.blocks)if(this._checkAsyncFn(s))return r=!0,t.asyncFn=r,t.meta.asyncFn=r,this.isModifiedNodes=!0,!0}if(e.type=="func"){let t=e;if(t.asyncFn)return!0;if(t.blocks){for(let s of t.blocks)if(this._checkAsyncFn(s))return t.asyncFn=!0,this.isModifiedNodes=!0,!0}let r=this.funclist.get(t.name);return r&&r.asyncFn?(t.asyncFn=!0,this.isModifiedNodes=!0,!0):!1}if(e.type=="renbun")return!0;if(e.blocks){for(let t of e.blocks)if(this._checkAsyncFn(t))return!0}return!1}_tokensToNodes(e){let t=[];for(let r of e)t.push(this._tokenToNode(r));return t}_tokenToNode(e){let t=this.peekSourceMap(e);if(e.type==="string"||e.type=="number"||e.type=="bigint")return this.yConst(e,t);if(e.type==="word")return{type:"word",value:e.value,josi:e.josi,...t};if(e.type==="eol"||e.type==="_eol")return{type:"eol",...t};throw new Error("[System Error] \u672A\u77E5\u306E\u30C8\u30FC\u30AF\u30F3\u304CAst\u306B\u5909\u63DB\u3055\u308C\u307E\u3057\u305F\u3002")}};var de=class{constructor(e,t,r){this.from=e,this.to=t,this.index=r}},N=class{constructor(e,t){this.text=e,this.sourcePosition=t}},ye=class{constructor(e){this.history=[],this.code=e}getText(){return this.code}replaceAll(e,t){for(;;){let r=this.getText().indexOf(e);if(r===-1)break;e.length!==t.length&&this.history.unshift(new de(e.length,t.length,r)),this.code=this.code.replace(e,t)}}getSourcePosition(e){for(let t of this.history)e>=t.index+t.to?e+=t.from-t.to:t.index<=e&&e<t.index+t.to&&(t.to>=2&&e===t.index+t.to-1?e=t.index+t.from-1:e=t.index);return e}},re=class n{static getInstance(){return n._instance||(n._instance=new n),n._instance}constructor(){this.convertTable=new Map([[8208,"-"],[8209,"-"],[8211,"-"],[8212,"-"],[8213,"-"],[8722,"-"],[732,"~"],[759,"~"],[8275,"~"],[8764,"~"],[12316,"~"],[65374,"~"],[8192," "],[8194," "],[8195," "],[8196," "],[8197," "],[8198," "],[8199," "],[8201," "],[8202," "],[8203," "],[8239," "],[8287," "],[12288," "],[12644," "],[8251,"#"],[12290,";"],[12304,"["],[12305,"]"],[12289,","],[65292,","],[10006,"*"],[10133,"+"],[10134,"-"],[10135,"\xF7"]])}convert1ch(e){if(!e)return"";let t=e.codePointAt(0)||0,r=this.convertTable.get(t)||"";if(r)return r;if(t<127)return e;if(t>=65281&&t<=65374){let s=t-65248;return String.fromCodePoint(s)}return e}convert(e){if(!e)return[];let t=new ye(e);t.replaceAll(`\r
|
|
17
17
|
`,`
|
|
18
18
|
`),t.replaceAll("\r",`
|
|
19
19
|
`);let r=!1,s=!1,i="",o=[],u=0,c="",a=0;for(;a<t.getText().length;){let f=t.getText().charAt(a),l=t.getText().substr(a,2);if(r){if(f===i){r=!1,o.push(new N(c+i,t.getSourcePosition(u))),a++,u=a;continue}c+=f,a++;continue}if(s){if(l===i){s=!1,i==="\uFF0A\uFF0F"&&(i="*/"),o.push(new N(c+i,t.getSourcePosition(u))),a+=2,u=a;continue}c+=f,a++;continue}if(f==="\u300C"){o.push(new N(f,t.getSourcePosition(u))),a++,u=a,r=!0,i="\u300D",c="";continue}if(f==="\u300E"){o.push(new N(f,t.getSourcePosition(u))),a++,u=a,r=!0,i="\u300F",c="";continue}if(f==="\u201C"){o.push(new N(f,t.getSourcePosition(u))),a++,u=a,r=!0,i="\u201D",c="";continue}if(l==="\u{1F334}"||l==="\u{1F33F}"){o.push(new N(l,t.getSourcePosition(u))),a+=2,u=a,s=!0,i=l,c="";continue}let h=this.convert1ch(f);if(h==='"'||h==="'"){o.push(new N(h,t.getSourcePosition(u))),a++,u=a,r=!0,i=f,c="";continue}if(h==="#"){o.push(new N(h,t.getSourcePosition(u))),a++,u=a,r=!0,i=`
|
|
@@ -73,49 +73,50 @@ if(__self.__performance_monitor[key].max_usec<el_time){__self.__performance_moni
|
|
|
73
73
|
`,a+=u+`// POP STACK
|
|
74
74
|
`,a+=u+`self.__vars = __localvars;
|
|
75
75
|
`,a+=`}
|
|
76
|
-
`;let l=Array.from(this.varsSet.names.values()),h="",p=e.meta;if(!p)throw new Error("[System Error] \u95A2\u6570\u306E\u5B9A\u7FA9\u3067\u30E1\u30BF\u60C5\u5831\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093");p.varnames||(p.varnames=[]);for(let y=0;y<p.varnames.length;y++){let
|
|
77
|
-
`;else{let w=`\u533F\u540D\u95A2\u6570\u306E\u5F15\u6570\u300E${
|
|
78
|
-
`}this.varsSet.names.add(
|
|
76
|
+
`;let l=Array.from(this.varsSet.names.values()),h="",p=e.meta;if(!p)throw new Error("[System Error] \u95A2\u6570\u306E\u5B9A\u7FA9\u3067\u30E1\u30BF\u60C5\u5831\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093");p.varnames||(p.varnames=[]);for(let y=0;y<p.varnames.length;y++){let b=p.varnames[y];if(b!=="\u5F15\u6570"){if(!this.warnUndefinedCalledUserFuncArgs)h+=u+this.varname_set(b,`arguments[${y}]`)+`;
|
|
77
|
+
`;else{let w=`\u533F\u540D\u95A2\u6570\u306E\u5F15\u6570\u300E${b}\u300F\u306Bundefined\u304C\u6E21\u3055\u308C\u307E\u3057\u305F`;t&&(w=`\u30E6\u30FC\u30B6\u95A2\u6570\u300E${t}\u300F\u306E\u5F15\u6570\u300E${b}\u300F\u306Bundefined\u304C\u6E21\u3055\u308C\u307E\u3057\u305F`);let tt=`${`((a) => { if (a === undefined) { ${`__self.logger.warn('${w}', {line: ${e.line}, file: ${JSON.stringify(e.file)}});`} }; return a; })`}(arguments[${y}])`;h+=u+this.varname_set(b,tt)+`;
|
|
78
|
+
`}this.varsSet.names.add(b)}}if(t&&(this.usedFuncSet.add(t),this.varslistSet[1].names.add(t),this.nakoFuncList.get(t)===void 0)){if(!e.meta)throw new Error("[System Error] \u95A2\u6570\u306E\u5B9A\u7FA9\u3067\u30E1\u30BF\u60C5\u5831\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093");this.nakoFuncList.set(t,{josi:e.meta.josi,fn:()=>{},type:"func",asyncFn:!1,isExport:null}),this.__self.getLogger().warn(`generate\u3067\u672A\u5B9A\u7FA9\u306E\u72B6\u614B\u306E\u95A2\u6570\u300E${t}\u300F\u304C\u52D5\u7684\u306B\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u3059\u3002`)}let _=this.usedAsyncFn;this.usedAsyncFn=!1,this.debugOption.useDebug&&(this.usedAsyncFn=!0);let m=this._convGen(e.blocks[0],!1);if(h+=m.split(`
|
|
79
79
|
`).map(y=>" "+y).join(`
|
|
80
80
|
`)+`
|
|
81
81
|
`,this.speedMode.invalidSore===0&&(h+=` return (${this.varname_get("\u305D\u308C")});
|
|
82
82
|
`),h+=i,t&&this.usedAsyncFn){let y=this.nakoFuncList.get(t);y&&(y.asyncFn=!0)}if(r){for(let y of Array.from(this.varsSet.names.values()))l.includes(y)||n.isValidIdentifier(y)&&(o+=` var ${y};
|
|
83
83
|
`);this.speedMode.invalidSore===0&&(n.isValidIdentifier("\u305D\u308C")?o+=` var \u305D\u308C = '';
|
|
84
|
-
`:o+=` ${this.varname_get("\u305D\u308C")} = '';`)}let
|
|
85
|
-
`;if(h=
|
|
84
|
+
`:o+=` ${this.varname_get("\u305D\u308C")} = '';`)}let g=this.usedAsyncFn?yt:pt,k=" "+this.convLineno(e,!0,1)+`
|
|
85
|
+
`;if(h=g+s+c+o+k+h+a,h+=dt,t){let y=this.nakoFuncList.get(t);y&&(y.fn=h,y.asyncFn=this.usedAsyncFn,p.asyncFn=this.usedAsyncFn)}return this.usedAsyncFn=_,this.varslistSet.pop(),this.varsSet=this.varslistSet[this.varslistSet.length-1],t&&this.__self.__varslist[1].set(t,h),this.defFuncName="",h}convDefTest(e){let t=e.name,r=`__tests.push({ name: '${t}', f: () => {
|
|
86
86
|
`,s=this._convGen(e.blocks[0],!1);if(r+=` ${s}
|
|
87
87
|
}});`,!e.meta)throw new Error("[System Error] \u30C6\u30B9\u30C8\u306E\u30E1\u30BF\u60C5\u5831\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093");return this.nakoTestFuncs.set(t,{josi:e.meta.josi,fn:r,type:"test_func"}),""}convDefFunc(e){if(!e.name)return"";let t=n.getFuncName(e.name);return this.convDefFuncCommon(e,t),""}convFuncObj(e){return"/*convFuncObj*/"+this.convDefFuncCommon(e,"")}convJsonObj(e){let t=[],r=e.blocks;for(let s=0;s<r.length/2;s++){let i=s*2,o=r[i+0],u=r[i+1],c=this._convGen(o,!0),a=this._convGen(u,!0);t.push(`${c}: ${a}`)}return"{"+t.join(", ")+"}"}convJsonArray(e){return"["+e.blocks.map(s=>this._convGen(s,!0)).join(",")+"]"}convRefArray(e){let t=this._convGen(e.name,!0),r=e.index,s=t;if(!r)return s;for(let i=0;i<r.length;i++){let o=this._convGen(r[i],!0);s+="["+o+"]"}return s}convLetArray(e){let t=this.loopId++,r=e.blocks[0],s=e.blocks.slice(1),i=this.genVar(e.name,e),o="",u=i,c="";if(e.checkInit){let l="[0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0]";if(e.name){let h=e.name,p=`$nako_tmp_a${t}`,_=this.varname_set(h,l);o+=`
|
|
88
88
|
/*\u914D\u5217\u521D\u671F\u5316*/if (!(${i} instanceof Array)) { ${_} };
|
|
89
89
|
`,o+=`${p} = ${i};
|
|
90
|
-
`;for(let
|
|
91
|
-
/*\u914D\u5217\u521D\u671F\u5316${
|
|
90
|
+
`;for(let m=0;m<s.length-1;m++){let g=this._convGen(s[m],!0);c+=`[${g}]`,o+=`
|
|
91
|
+
/*\u914D\u5217\u521D\u671F\u5316${m}*/if (!(${p}${c} instanceof Array)) { ${p}${c} = ${l}; };`}o+=`
|
|
92
92
|
`}}for(let l=0;l<s.length;l++){let h=this._convGen(s[l],!0);u+="["+h+"]"}let a=null;if(this.speedMode.invalidSore===0&&(a=this.varname_get("\u305D\u308C")),r.type!=="nop"&&(a=this._convGen(r,!0)),a==null)throw d.fromNode("\u4EE3\u5165\u3059\u308B\u5148\u306E\u5909\u6570\u540D\u304C\u3042\u308A\u307E\u305B\u3093\u3002",e);return u+=" = "+a+`;
|
|
93
|
-
`,this.convLineno(e,!1)+o+u}convGenLoop(e){let t=this.flagLoop;this.flagLoop=!0;try{return this._convGen(e,!1)}finally{this.flagLoop=t}}convFor(e){let t=e.blocks[0],r=e.blocks[1],s=e.blocks[2],i=e.blocks[3],o=this.loopId++,u=`$nako_i${o}`,c="";if(e.word!==""){let
|
|
93
|
+
`,this.convLineno(e,!1)+o+u}convGenLoop(e){let t=this.flagLoop;this.flagLoop=!0;try{return this._convGen(e,!1)}finally{this.flagLoop=t}}convFor(e){let t=e.blocks[0],r=e.blocks[1],s=e.blocks[2],i=e.blocks[3],o=this.loopId++,u=`$nako_i${o}`,c="";if(e.word!==""){let j=e.word;this.varsSet.names.add(j),c=this.varname_set(j,u)}let a=`$nako_from${o}`,f=`$nako_to${o}`,l=`$nako_temp${o}`,h="";this.speedMode.invalidSore===0&&(h=this.varname_set("\u305D\u308C",u));let p="0",_="0",m="0";r&&r.type==="func"&&r.name==="\u7BC4\u56F2"?(m=this._convGen(r,!0),p=`${l}['\u5148\u982D'] || 0`,_=`${l}['\u672B\u5C3E'] || 0`):(p=this._convGen(t,!0),_=this._convGen(r,!0));let g=e.flagDown,k=e.flagUp,y="1";s.type!=="nop"&&(y=this._convGen(s,!0));let b=this.convGenLoop(i);return this.convLineno(e,!1)+`
|
|
94
94
|
/*[convFor id=${o}]*/
|
|
95
|
-
const ${l} = ${
|
|
95
|
+
const ${l} = ${m};
|
|
96
96
|
const ${a} = ${p};
|
|
97
97
|
const ${f} = ${_};
|
|
98
98
|
if (${a} <= ${f}) { // up
|
|
99
|
-
for (let ${u} = ${a}; ${u} <= ${f}; ${u}+= ${
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
if (${k}) { for (let ${u} = ${a}; ${u} <= ${f}; ${u}+= ${y}) {
|
|
100
|
+
${h};${c}
|
|
101
|
+
// for block begin
|
|
102
|
+
${b}
|
|
103
|
+
// for block end
|
|
104
|
+
};
|
|
104
105
|
};
|
|
105
106
|
} else { // down
|
|
106
|
-
if (${
|
|
107
|
+
if (${g}) { for (let ${u} = ${a}; ${u} >= ${f}; ${u}-= ${y}) {
|
|
107
108
|
${h};${c}
|
|
108
109
|
// for block begin
|
|
109
|
-
${
|
|
110
|
+
${b}
|
|
110
111
|
// for block end
|
|
111
112
|
}
|
|
112
113
|
};
|
|
113
114
|
};
|
|
114
115
|
//[/convFor id=${o}]
|
|
115
|
-
`}convForeach(e){let t=e.blocks[0],r=e.blocks[1],s=this.loopId++,i=`$nako_i${s}`,o=`$nako_foreach_value${s}`,u=`$nako_foreach_data${s}`,c=`$nako_taisyou_temp${s}`,a=`$nako_taisyou_key_temp${s}`,f=`$nako_foreach_sore_temp${s}`,l=this.varname_set_sys("\u5BFE\u8C61",o);if(e.word!==""){let w=e.word;this.varsSet.names.add(w),l=this.varname_set(w,o)}let p=this.varname_set_sys("\u5BFE\u8C61\u30AD\u30FC",i),_="",
|
|
116
|
+
`}convForeach(e){let t=e.blocks[0],r=e.blocks[1],s=this.loopId++,i=`$nako_i${s}`,o=`$nako_foreach_value${s}`,u=`$nako_foreach_data${s}`,c=`$nako_taisyou_temp${s}`,a=`$nako_taisyou_key_temp${s}`,f=`$nako_foreach_sore_temp${s}`,l=this.varname_set_sys("\u5BFE\u8C61",o);if(e.word!==""){let w=e.word;this.varsSet.names.add(w),l=this.varname_set(w,o)}let p=this.varname_set_sys("\u5BFE\u8C61\u30AD\u30FC",i),_="",m="",g="";this.speedMode.invalidSore===0&&(_=this.varname_set("\u305D\u308C",o),m=this.varname_set("\u305D\u308C",f),g=`let ${f} = `+this.varname_get("\u305D\u308C")+";");let k="";if(t.type==="nop")if(this.speedMode.invalidSore===0)k=this.varname_get("\u305D\u308C");else throw d.fromNode("\u300E\u53CD\u5FA9\u300F\u306E\u5BFE\u8C61\u304C\u3042\u308A\u307E\u305B\u3093\u3002",e);else k=this._convGen(t,!0);let y=T(V(this.convGenLoop(r),1));return this.convLineno(e,!1)+`
|
|
116
117
|
// [convForeach id=${s}]
|
|
117
|
-
const ${c} = __self.__getSysVar('\u5BFE\u8C61'); ${
|
|
118
|
-
let ${u} = ${
|
|
118
|
+
const ${c} = __self.__getSysVar('\u5BFE\u8C61'); ${g}; const ${a} = __self.__getSysVar('\u5BFE\u8C61\u30AD\u30FC');
|
|
119
|
+
let ${u} = ${k};
|
|
119
120
|
// foreach Map?
|
|
120
121
|
if (${u} instanceof Map) { // Object\u306B\u5F37\u5236\u5909\u63DB
|
|
121
122
|
let tmp = {}; for (let tmpKey of ${u}.keys()) { tmp[tmpKey] = ${u}.get(tmpKey); };
|
|
@@ -133,7 +134,7 @@ for (let ${i} in ${u}) {
|
|
|
133
134
|
${y}
|
|
134
135
|
// [/convForeach::block]
|
|
135
136
|
}
|
|
136
|
-
__self.__setSysVar('\u5BFE\u8C61', ${c});${
|
|
137
|
+
__self.__setSysVar('\u5BFE\u8C61', ${c});${m};__self.__setSysVar('\u5BFE\u8C61\u30AD\u30FC', ${a});// [/convForeach id=${s}]
|
|
137
138
|
`}convRepeatTimes(e){let t=this.loopId++,r=`$nako_i${t}`,s=`$nako_times_data${t}`,i=`$nako_kaisu_temp${t}`,o=this._convGen(e.blocks[0],!0),u=T(V(this.convGenLoop(e.blocks[1]),1)),c="",a="";return this.speedMode.invalidSore===0&&(c=this.varname_set("\u305D\u308C",r),a=this.varname_set("\u305D\u308C",i)),c+=`;__self.__setSysVar('\u56DE\u6570', ${r});`,a+=`;__self.__setSysVar('\u56DE\u6570', ${i});`,this.convLineno(e,!1)+`
|
|
138
139
|
// [convRepeatTimes id=${t}] // \u300En\u56DE\u300F\u69CB\u6587
|
|
139
140
|
let ${i} = __self.__getSysVar('\u56DE\u6570')
|
|
@@ -182,17 +183,17 @@ __self.__varslist[0].get('\u540D\u524D\u7A7A\u9593\u8A2D\u5B9A')(${u[0]}, __self
|
|
|
182
183
|
__self.__varslist[0].get('\u30D7\u30E9\u30B0\u30A4\u30F3\u540D\u8A2D\u5B9A')(${u[0]}, __self);
|
|
183
184
|
`;u.push("__self");let a="function",f="",l="";if(e.setter&&(f+=`;__self.isSetter = true;
|
|
184
185
|
`,l+=`;__self.isSetter = false;
|
|
185
|
-
`),s.i===0&&this.varslistSet.length>3&&i.pure!==!0&&this.speedMode.forcePure===0){let
|
|
186
|
-
`,
|
|
187
|
-
`;for(let y of
|
|
188
|
-
`}if(
|
|
189
|
-
`;for(let y of
|
|
190
|
-
`)}}c.sore&&(f+="/*[sore]*/");let h=(
|
|
191
|
-
`))w!==""&&(
|
|
192
|
-
`);return
|
|
186
|
+
`),s.i===0&&this.varslistSet.length>3&&i.pure!==!0&&this.speedMode.forcePure===0){let k=[];for(let y of Array.from(this.varsSet.names.values()))n.isValidIdentifier(y)&&k.push({str:JSON.stringify(y),js:this.varname_get(y)});if(f+=`__self.__locals = __vars;
|
|
187
|
+
`,k.length>0){f+=`/* \u5168\u3066\u306E\u5C55\u958B\u3055\u308C\u305F\u30ED\u30FC\u30AB\u30EB\u5909\u6570\u3092 __self.__locals \u306B\u4FDD\u5B58 */
|
|
188
|
+
`;for(let y of k)f+=`__self.__locals.set(${y.str}, ${y.js});
|
|
189
|
+
`}if(k.length>0){l+=`/* \u5168\u3066\u306E\u5C55\u958B\u3055\u308C\u305F\u30ED\u30FC\u30AB\u30EB\u5909\u6570\u3092 __self.__locals \u304B\u3089\u53D7\u3051\u53D6\u308B */
|
|
190
|
+
`;for(let y of k)y.js!=="\u305D\u308C"&&(l+=`__self.__varslist[2].set(${y.str}, __self.__locals[${y.str}]);
|
|
191
|
+
`)}}c.sore&&(f+="/*[sore]*/");let h=(k,y)=>{let b="";for(let w of k.split(`
|
|
192
|
+
`))w!==""&&(b+=" ".repeat(y)+w+`
|
|
193
|
+
`);return b},p={TYPEOF:!0,\u5909\u6570\u578B\u78BA\u8A8D:!0},_;if(!this.warnUndefinedCallingUserFunc&&s.i!==0||!this.warnUndefinedCallingSystemFunc&&s.i===0)_=u.join(",");else{let k=[];u.forEach(y=>{if(y==="__self"||p[r]===!0)k.push(`${y}`);else{let b=s.i===0?"\u547D\u4EE4\u300E$0\u300F\u306E\u5F15\u6570\u306Bundefined\u3092\u6E21\u3057\u3066\u3044\u307E\u3059\u3002":"\u30E6\u30FC\u30B6\u547D\u4EE4\u300E$0\u300F\u306E\u5F15\u6570\u306Bundefined\u3092\u6E21\u3057\u3066\u3044\u307E\u3059\u3002",w=this.addConstPool(b,[r],e.file,e.line),j=y===""?'""':y;k.push(`(__self.chk(${j}, ${w}))`)}}),_=k.join(", ")}let m=`${s.js}(${_})`;if(i.asyncFn&&(a=`async ${a}`,m=`await ${m}`,this.numAsyncFn++,this.usedAsyncFn=!0),s.i===0&&this.performanceMonitor.systemFunctionBody!==0){let k=r;k||(typeof this.performanceMonitor.mumeiId>"u"&&(this.performanceMonitor.mumeiId=0),this.performanceMonitor.mumeiId++,k=`anous_${this.performanceMonitor.mumeiId}`),m=`(${a} (key, type) {
|
|
193
194
|
const sbf_start = performance.now() * 1000;
|
|
194
195
|
try {
|
|
195
|
-
return `+
|
|
196
|
+
return `+m+`;
|
|
196
197
|
} finally {
|
|
197
198
|
const sbl_time = performance.now() * 1000 - sbf_start;
|
|
198
199
|
if (!__self.__performance_monitor) {
|
|
@@ -206,20 +207,20 @@ __self.__performance_monitor[key].totel_usec+=sbl_time;
|
|
|
206
207
|
if(__self.__performance_monitor[key].min_usec>sbl_time){__self.__performance_monitor[key].min_usec=sbl_time;}
|
|
207
208
|
if(__self.__performance_monitor[key].max_usec<sbl_time){__self.__performance_monitor[key].max_usec=sbl_time;}
|
|
208
209
|
}}})('${r}_body', 'sysbody')
|
|
209
|
-
`}let
|
|
210
|
-
`:
|
|
211
|
-
${h(
|
|
210
|
+
`}let g="";if(i.return_none)l===""?g=`/*\u623B\u5024\u306E\u306A\u3044\u95A2\u6570\u547C\u51FA1*/${f}${m};
|
|
211
|
+
`:g=`/*\u623B\u5024\u306E\u306A\u3044\u95A2\u6570\u547C\u51FA2*/${f}try {
|
|
212
|
+
${h(m,1)};
|
|
212
213
|
} finally {
|
|
213
214
|
${h(l,1)}}
|
|
214
|
-
`;else{let
|
|
215
|
+
`;else{let k="",y="";if(this.speedMode.invalidSore===0&&(k="__self.__setSore(",y=")"),f===""&&l==="")g=`${k}${m}${y}`;else if(l===""){let b=`${k}${m}${y}`;g=`/* funcCallThis1 */${`(${`${a}(){ return ${b} }`}).call(this)`}`}else g=`/* funcCallThis2 */(${a}(){
|
|
215
216
|
${h(`${f}try {
|
|
216
|
-
${h(`return ${
|
|
217
|
+
${h(`return ${k}${m}${y};`,1)}
|
|
217
218
|
} finally {
|
|
218
|
-
${h(l,1)}}`,1)}}).call(this)`;(e.josi==="\u3057\u3066"||e.josi===""&&!t)&&(
|
|
219
|
-
`)}return s.i===0&&this.performanceMonitor.systemFunction!==0&&(
|
|
219
|
+
${h(l,1)}}`,1)}}).call(this)`;(e.josi==="\u3057\u3066"||e.josi===""&&!t)&&(g+=`;
|
|
220
|
+
`)}return s.i===0&&this.performanceMonitor.systemFunction!==0&&(g=`(function (key, type) {
|
|
220
221
|
const sf_start = performance.now() * 1000;
|
|
221
222
|
try {
|
|
222
|
-
return `+
|
|
223
|
+
return `+g+`;
|
|
223
224
|
} finally {
|
|
224
225
|
const sl_time = performance.now() * 1000 - sf_start;
|
|
225
226
|
if (!__self.__performance_monitor) {
|
|
@@ -233,7 +234,7 @@ __self.__performance_monitor[key].totel_usec+=sl_time;
|
|
|
233
234
|
if(__self.__performance_monitor[key].min_usec>sl_time){__self.__performance_monitor[key].min_usec=sl_time;}
|
|
234
235
|
if(__self.__performance_monitor[key].max_usec<sl_time){__self.__performance_monitor[key].max_usec=sl_time;}
|
|
235
236
|
}}})('${r}_sys', 'system')
|
|
236
|
-
`),
|
|
237
|
+
`),g}convRenbun(e){let t=this._convGen(e.blocks[1],!0),r=this._convGen(e.blocks[0],!1);return this.numAsyncFn++,this.usedAsyncFn=!0,`/*[\u9023\u6587]*/await (async function(){ ${r}; return ${t} }).call(this)/*[/\u9023\u6587]*/`}convOp(e){let t={"&":'+""+',eq:"==",noteq:"!=","===":"===","!==":"!==",gt:">",lt:"<",gteq:">=",lteq:"<=",and:"&&",or:"||",shift_l:"<<",shift_r:">>",shift_r0:">>>","\xF7":"/"},r=e.operator||"",s=this._convGen(e.blocks[1],!0),i=this._convGen(e.blocks[0],!0);return r==="+"&&this.speedMode.implicitTypeCasting===0&&(e.blocks[0]&&e.blocks[0].type!=="number"&&e.blocks[0].type!=="bigint"&&(i=`self.__parseFloatOrBigint(${i})`),e.blocks[1]&&e.blocks[1].type!=="number"&&e.blocks[1].type!=="bigint"&&(s=`self.__parseFloatOrBigint(${s})`)),r==="^"||r==="**"?`((${i}) ** (${s}))`:r==="\xF7\xF7"?`(Math.floor(${i} / ${s}))`:(t[r]&&(r=t[r]),`(${i} ${r} ${s})`)}convInc(e){let r=`$nako_v${this.loopId++}`,s="1";this.speedMode.invalidSore===0&&(s=this.varname_get("\u305D\u308C"));let i=e.blocks[0];i.type!=="nop"&&(s=this._convGen(i,!0));let o="",u="",c="",a="",f=e.name;if(f.type==="\u914D\u5217\u53C2\u7167")u=this.convRefArray(f),c=`${u} = ${r}`,a=`${u} = 0`;else{let l=f.value,h=this.findVar(l,r);if(h===null&&(this.varsSet.names.add(l),h=this.findVar(l,r),!h))throw new Error("\u300E\u5897\u300F\u307E\u305F\u306F\u300E\u6E1B\u300F\u3067\u5909\u6570\u304C\u898B\u5F53\u305F\u308A\u307E\u305B\u3093\u3002");u=h.js,c=h.js_set,h=this.findVar(l,"0"),h!==null&&(a=h.js_set)}return o+=`
|
|
237
238
|
/*[convInc]*/
|
|
238
239
|
`,o+=this.convLineno(e,!1)+`
|
|
239
240
|
`,o+=`let ${r} = ${u}
|
|
@@ -404,11 +405,11 @@ ${s}
|
|
|
404
405
|
`);let t="";for(let i=0;i<e;i++)t+=" ";let r=[],s=n.split(`
|
|
405
406
|
`);for(let i=0;i<s.length;i++){let o=s[i];o=o.replace(/^(\s*);/,"$1"),T(o)!==""&&r.push(t+o)}return n=r.join(`
|
|
406
407
|
`),n}function T(n){return n=String(n),n.replace(/^\s+|\s+$/g,"")}function ie(n){let e=[];for(let t=0;t<n.length;t++){let r=n[t],s=r.type,i=r.value,o=`[${s}:${i}]`;s===i&&(o=s),s==="comma"&&(o=","),s==="string"&&(o=`"${i}"`),s==="number"&&(o=`(${i})`),s==="word"&&(o=`[word:${i}]`),e[r.line]||(e[r.line]=gt(r.indent)),e[r.line]+=o+r.josi+"|"}return e.join(`
|
|
407
|
-
`)}function gt(n){let e="";for(let t=0;t<n;t++)e+=" ";return e}var se=
|
|
408
|
+
`)}function gt(n){let e="";for(let t=0;t<n;t++)e+=" ";return e}var se=x();function v(n,e,t=void 0){return t&&(se=t),x(n,e,se.indent,se.line,se.file)}var bt=!1;function Me(n){return n.type==="\u9055\u3048\u3070"||n.type==="word"&&n.value==="\u30A8\u30E9\u30FC"&&n.josi==="\u306A\u3089\u3070"}function Te(n){let e=W(n,"eol"),t=[],r=-1,s=0,i=0,o=c=>{c.forEach(a=>{a.type==="{"&&s++,a.type==="}"&&s--,a.type==="["&&i++,a.type==="]"&&i--})};for(let c=0;c<e.length;c++){let a=e[c];if(Ve(a))continue;let f=Ie(a);if(s>0||i>0){o(a);continue}if(r>=0){let h=f.indent;for(;r>=h;){let p=f;if(Me(p)&&r===h||(e[c-1].push(v("\u3053\u3053\u307E\u3067","\u3053\u3053\u307E\u3067",p)),e[c-1].push(v("eol",`
|
|
408
409
|
`,p))),t.pop(),t.length>0)r=t[t.length-1];else{r=-1;break}}}if(o(a),s>0||i>0)continue;let l=kt(a);l.type===":"&&(e[c]=e[c].filter(h=>h!==l),r=l.indent,t.push(r))}if(e.length>0&&t.length>0){let c=n[0];for(let a=e.length-1;a>=0;a--){let f=e[a];if(f.length>0){c=f[f.length-1];break}}for(let a=0;a<t.length;a++)e[e.length-1].push(v("\u3053\u3053\u307E\u3067","\u3053\u3053\u307E\u3067",c)),e[e.length-1].push(v("eol",`
|
|
409
|
-
`,c))}let u=U(e);return bt&&console.log("###",ie(u)),u}function U(n){let e=[];for(let t of n)for(let r of t)e.push(r);return e}function kt(n){let e=n.length;if(e===0)return
|
|
410
|
+
`,c))}let u=U(e);return bt&&console.log("###",ie(u)),u}function U(n){let e=[];for(let t of n)for(let r of t)e.push(r);return e}function kt(n){let e=n.length;if(e===0)return x("?");let t=n[e-1];return t.type==="eol"&&e>=2&&(t=n[e-2]),t}function W(n,e){let t=[],r=[],s=0;for(let i of n)r.push(i),i.type==="{"?s++:i.type==="}"?s--:s===0&&i.type===e&&(t.push(r),r=[]);return r.length>0&&t.push(r),t}function Ve(n){if(n.length===0)return!0;for(let e=0;e<n.length;e++){let t=n[e].type;if(!(t==="eol"||t==="line_comment"||t==="range_comment"))return!1}return!0}function Ie(n){for(let e=0;e<n.length;e++){let t=n[e].type;if(!(t==="eol"||t==="line_comment"||t==="range_comment"))return n[e]}return n[0]}var vt=["!\u30A4\u30F3\u30C7\u30F3\u30C8\u69CB\u6587","!\u3053\u3053\u307E\u3067\u3060\u308B\u3044","\u{1F4A1}\u30A4\u30F3\u30C7\u30F3\u30C8\u69CB\u6587","\u{1F4A1}\u3053\u3053\u307E\u3067\u3060\u308B\u3044"];function Le(n){if(!wt(n))return n;for(let c of n)if(c.type==="\u3053\u3053\u307E\u3067")throw new Q("\u30A4\u30F3\u30C7\u30F3\u30C8\u69CB\u6587\u304C\u6709\u52B9\u5316\u3055\u308C\u3066\u3044\u308B\u3068\u304D\u306B\u300E\u3053\u3053\u307E\u3067\u300F\u3092\u4F7F\u3046\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002",c.line,c.file);let e=0,t=0,r=c=>{c.forEach(a=>{a.type==="{"&&e++,a.type==="}"&&e--,a.type==="["&&t++,a.type==="]"&&t--})},s=[],i=W(n,"eol"),o=0;for(let c=0;c<i.length;c++){let a=i[c];if(Ve(a))continue;if(t>0||e>0){r(a);continue}let f=Ie(a),l=f.indent;if(l!==o){if(o>=0)for(;o>l;){let h=s[s.length-1][1];if(!(Me(f)&&h===l)){let p=i[c-1][0];i[c-1].push(v("\u3053\u3053\u307E\u3067","\u3053\u3053\u307E\u3067",p)),i[c-1].push(v("eol",`
|
|
410
411
|
`,p))}if(s.pop(),s.length>0)o=s[s.length-1][0];else{o=0;break}}if(!(t>0||e>0)&&(r(a),l>o)){s.push([l,o]),o=l;continue}}}for(let c=0;c<s.length;c++){let a=n[0];for(let f=i.length-1;f>=0;f--){let l=i[f];if(l.length>0){a=l[l.length-1];break}}i[i.length-1].push(v("\u3053\u3053\u307E\u3067","\u3053\u3053\u307E\u3067",a)),i[i.length-1].push(v("eol",`
|
|
411
|
-
`,a))}return U(i)}function wt(n){for(let e=0;e<n.length&&!(e>100);e++){let t=n[e];if(t.type==="line_comment"&&vt.indexOf(t.value)>=0)return!0}return!1}var St=["!DNCL\u30E2\u30FC\u30C9","\u{1F4A1}DNCL\u30E2\u30FC\u30C9"],jt={"\u2190:\u2190":["eq","="],"\xF7:\xF7":["\xF7\xF7","\xF7\xF7"],"{:{":["[","["],"}:}":["]","]"],"word:\u3092\u5B9F\u884C":["\u3053\u3053\u307E\u3067","\u3053\u3053\u307E\u3067"],"word:\u4E71\u6570":["word","\u4E71\u6570\u7BC4\u56F2"],"word:\u8868\u793A":["word","\u9023\u7D9A\u8868\u793A"]};function Je(n){if(!xt(n))return n;let e=W(n,"eol");for(let t=0;t<e.length;t++){let r=e[t];if(r.length<=1)continue;for(let a=0;a<r.length;a++){if(r[a].type==="|"){r[a].type="range_comment";continue}break}let s=r[0];s.type==="word"&&s.value==="\u7E70\u8FD4"&&r.splice(0,r.length,j("word","\u5F8C\u5224\u5B9A",s.indent,s.line,s.file),j("word","\u7E70\u8FD4",s.indent,s.line,s.file));let i=A(r,["word:\u306A\u308B","word:\u7E70\u8FD4"]);i>0&&De(r,i);let o=A(r,["word:\u306A\u308B","word:\u5B9F\u884C"]);o>0&&De(r,o);let u=A(r,["word:\u306A\u3044"]);for(u>=1&&r[u].josi==="\u306A\u3089\u3070"&&(r[u-1].josi="\u3067\u306A\u3051\u308C\u3070",r.splice(u,1));;){let a=A(r,["word:\u4E8C\u9032","word:\u8868\u793A"]);if(a<0)break;r[a].value="\u4E8C\u9032\u8868\u793A",r[a].josi="",r.splice(a+1,1)}for(;;){let a=A(r,["word:\u6539\u884C","word:\u8868\u793A"]);if(a<0)break;let f=r[a];f.value="\u9023\u7D9A\u7121\u6539\u884C\u8868\u793A",f.josi="",r.splice(a+1,1)}for(;;){let a=A(r,["word:\u3092\u5B9F\u884C","comma:,","word:\u305D\u3046"]);if(a<0)break;let f=r[a+2];if(f.josi==="\u3067\u306A\u3051\u308C\u3070"){f.type="\u9055\u3048\u3070",f.value="\u9055\u3048\u3070",f.josi="",r.splice(a,3,f);continue}else if(f.josi==="\u3067"){let l=r[a+3];if(l.value.substring(0,4)==="\u306A\u304F\u3082\u3057"){if(f.type="\u9055\u3048\u3070",f.value="\u9055\u3048\u3070",f.josi="",r.splice(a,3,f),l.value.length>4){let h=l.value.substring(4),p=j("word",h,l.indent,l.line,l.file);h.match(/^\d/)&&(p.type="number"),r.splice(a+2,0,p),l.value=l.value.substring(0,4)}l.type="\u3082\u3057",l.value="\u3082\u3057",l.josi="";continue}}break}for(;;){let a=A(r,["word:\u5897","word:\u3089"]);if(a<0)break;let f=r[a];f.type="word",f.value="\u5897\u7E70\u8FD4",f.josi="",r.splice(a,2,f)}for(;;){let a=A(r,["word:\u6E1B","word:\u3089"]);if(a<0)break;let f=r[a];f.type="word",f.value="\u6E1B\u7E70\u8FD4",f.josi="",r.splice(a,2,f)}for(;;){let a=A(r,["word:\u3092\u7E70\u308A\u8FD4"]);if(a<0)break;let f=r[a];f.type="\u3053\u3053\u307E\u3067",f.value="\u3053\u3053\u307E\u3067",f.josi=""}for(;;){let a=A(r,["word:\u3059\u3079\u3066","word:\u8981\u7D20"]);if(a>=1)Pe(r,a);else break}for(;;){let a=A(r,["word:\u3059\u3079\u3066","word:\u5024"]);if(a>=1)Pe(r,a);else break}let c=0;for(;c<r.length;){let a=r[c];if(a.type==="word"&&a.value.length>=2){let f=a.value.charAt(a.value.length-1);(f==="\u6E1B"||f==="\u5897")&&(a.value=a.value.substring(0,a.value.length-1),a.josi="\u3060\u3051",r.splice(c+1,0,j("word",f,a.indent,a.line,a.file))),c++;continue}c++}}for(let t=0;t<n.length;t++){let r=n[t],s=jt[r.type+":"+r.value];s!==void 0&&(r.type=s[0],r.value=s[1])}return n=U(e),n}function Pe(n,e){let t=n[e];n[e-1].josi="";let r=j("eq","=",t.indent,t.line,t.file),s=j("[","[",t.indent,t.line,t.file),i=j("]","]",t.indent,t.line,t.file);i.josi="\u306B";let o=n[e+2];o.josi="";let u=j("number",100,t.indent,t.line,t.file);u.josi="\u3092";let c=j("word","\u639B",t.indent,t.line,t.file);n.splice(e,4,r,s,o,i,u,c)}function De(n,e){let t=A(n,["word:\u3092"]);t>=0&&(n[t].type="\u3053\u3053\u307E\u3067",n[t].value="\u3053\u3053\u307E\u3067");let r=A(n,["word:\u304C"]);r>=0&&(n[r].type="\u3053\u3053\u307E\u3067",n[r].value="\u3053\u3053\u307E\u3067"),n[e+1].value="\u9593"}function A(n,e){let t=e.map(r=>r.split(":"));for(let r=0;r<n.length;r++){let s=!0;for(let i=0;i<t.length;i++){let o=t[i],u=r+i;if(u>=n.length)return-1;if(!(n[u].type===o[0]&&n[u].value===o[1])){s=!1;break}}if(s)return r}return-1}function xt(n){for(let e=0;e<n.length&&!(e>100);e++){let t=n[e];if(t.type==="line_comment"&&St.indexOf(t.value)>=0)return t.type="DNCL\u30E2\u30FC\u30C9",!0}return!1}var $t=!1,me=30,Nt=["!DNCL2\u30E2\u30FC\u30C9","\u{1F4A1}DNCL2\u30E2\u30FC\u30C9","!DNCL2","\u{1F4A1}DNCL2"],At={"\u2190:\u2190":["eq","="],"\xF7:\xF7":["\xF7\xF7","\xF7\xF7"],"{:{":["[","["],"}:}":["]","]"],"word:not":["not","!"],"word:\u4E71\u6570":["word","\u4E71\u6570\u7BC4\u56F2"],"word:\u8868\u793A":["word","\u9023\u7D9A\u8868\u793A"],"word:\u3068\u5B9A\u7FA9":["\u3053\u3053\u307E\u3067","\u3053\u3053\u307E\u3067"]};function Re(n){if(!Ft(n))return n;let e=W(n,"eol");for(let t=0;t<e.length;t++){let r=e[t];if(r.length<=1)continue;let s=E(r,["word:\u306A\u3044"]);s>=1&&r[s].josi==="\u306A\u3089\u3070"&&(r[s-1].josi="\u3067\u306A\u3051\u308C\u3070",r.splice(s,1));for(let o=0;o<r.length;o++){let u=r[o];(u.value==="\u305D\u3046"||u.value==="\u305D\u308C")&&(u.josi==="\u3067\u306A\u3051\u308C\u3070"||u.josi==="\u3067\u306A\u304F")&&(u.type="\u9055\u3048\u3070",u.value="\u9055\u3048\u3070",u.josi="")}for(;;){let o=E(r,["word:\u3092\u5B9F\u884C","comma:,","word:\u305D\u3046"]);if(o<0)break;let u=r[o+2];if(u.josi==="\u3067\u306A\u3051\u308C\u3070"){u.type="\u9055\u3048\u3070",u.value="\u9055\u3048\u3070",u.josi="",r.splice(o,3,u);continue}else if(u.josi==="\u3067"){let c=r[o+3];if(c.value.substring(0,4)==="\u306A\u304F\u3082\u3057"){if(u.type="\u9055\u3048\u3070",u.value="\u9055\u3048\u3070",u.josi="",r.splice(o,3,u),c.value.length>4){let a=c.value.substring(4),f=j("word",a,c.indent,c.line,c.file);a.match(/^\d/)&&(f.type="number"),r.splice(o+2,0,f),c.value=c.value.substring(0,4)}c.type="\u3082\u3057",c.value="\u3082\u3057",c.josi="";continue}}break}for(;;){let o=E(r,["word:\u305D\u3046","word:\u306A\u304F"]);if(o<0)break;let u=r[o];if(u.josi==="\u3067"){u.type="\u9055\u3048\u3070",u.value="\u9055\u3048\u3070",u.josi="",r.splice(o+1,1);continue}break}for(;;){let o=E(r,["word:\u305D\u3046","word:\u306A\u304F\u3082\u3057"]);if(o<0)break;let u=r[o],c=r[o+1];u.type="\u9055\u3048\u3070",u.value="\u9055\u3048\u3070",u.josi="",c.type="\u3082\u3057",c.value="\u3082\u3057",c.josi=""}for(;;){let o=E(r,["word:\u5897","word:\u3089"]);if(o<0)break;let u=r[o];u.type="word",u.value="\u5897\u7E70\u8FD4",u.josi="",r.splice(o,2,u)}for(;;){let o=E(r,["word:\u6E1B","word:\u3089"]);if(o<0)break;let u=r[o];u.type="word",u.value="\u6E1B\u7E70\u8FD4",u.josi="",r.splice(o,2,u)}for(;;){let o=E(r,["word:\u5897","word:\u3089\u7E70\u308A\u8FD4"]);if(o<0)break;let u=r[o];u.type="word",u.value="\u5897\u7E70\u8FD4",u.josi="",r.splice(o,2,u)}for(;;){let o=E(r,["word:\u6E1B","word:\u3089\u7E70\u308A\u8FD4"]);if(o<0)break;let u=r[o];u.type="word",u.value="\u6E1B\u7E70\u8FD4",u.josi="",r.splice(o,2,u)}for(let o=0;o<r.length;o++){if(ge([["word:\u914D\u5217","word:\u914D\u5217\u5909\u6570"],"word","word:\u3059\u3079\u3066",["word:\u8981\u7D20","word:\u5024"],"*","word:\u4EE3\u5165"],r,o)){let u=r[o+1];u.josi="";let c=r[o+4];c.josi="",r.splice(o,6,u,v("eq","=",u),v("word","\u639B"),v("(","("),v("[","["),c,v("]","]"),v("comma",","),v("number",me),v(")",")")),o+=6}if(ge(["word","word:\u3059\u3079\u3066",["word:\u8981\u7D20","word:\u5024"],["number","string","word"],"word:\u3059\u308B"],r,o)){let u=r[o];u.josi="";let c=r[o+3];c.josi="",r.splice(o,5,u,v("eq","=",u),v("word","\u639B"),v("(","("),v("[","["),c,v("]","]"),v("comma",","),v("number",me),v(")",")"))}if(ge([["word:\u914D\u5217\u5909\u6570","word:\u914D\u5217"],"word","word:\u521D\u671F\u5316"],r,o)){let u=r[o+1];u.josi="",r.splice(o,3,u,v("eq","=",u),v("word","\u639B"),v("(","("),v("[","["),v("number",0),v("]","]"),v("comma",","),v("number",me),v(")",")"))}}for(;;){let o=E(r,["word:\u4E8C\u9032","word:\u8868\u793A"]);if(o<0)break;r[o].value="\u4E8C\u9032\u8868\u793A",r[o].josi="",r.splice(o+1,1)}for(;;){let o=E(r,["word:\u6539\u884C","word:\u8868\u793A"]);if(o<0)break;let u=r[o];u.value="\u9023\u7D9A\u7121\u6539\u884C\u8868\u793A",u.josi="",r.splice(o+1,1)}let i=0;for(;i<r.length;){let o=r[i];if(o.type==="word"&&o.value.length>=2){let u=o.value.charAt(o.value.length-1);(u==="\u6E1B"||u==="\u5897")&&(o.value=o.value.substring(0,o.value.length-1),o.josi="\u3060\u3051",r.splice(i+1,0,j("word",u,o.indent,o.line,o.file))),i++;continue}i++}}for(let t=0;t<n.length;t++){let r=n[t],s=At[r.type+":"+r.value];s!==void 0&&(r.type=s[0],r.value=s[1])}return n=U(e),$t&&(console.log("// DEBUG---DNCL:tokens---BEGIN"),console.log(ie(n)),console.log("// DEBUG---DNCL:tokens---END")),n}function ge(n,e,t){let r=(s,i)=>{if(s instanceof Array){for(let u=0;u<s.length;u++)if(r(s[u],i))return!0;return!1}if(s==="*")return!0;if(s.indexOf(":")<0)return s===i.type;let o=`${i.type}:${i.value}`;return s===o};for(let s=0;s<n.length;s++){let i=s+t;if(i>=e.length)return!1;let o=n[s],u=e[i];if(!r(o,u))return!1}return!0}function E(n,e){let t=e.map(r=>r.split(":"));for(let r=0;r<n.length;r++){let s=!0;for(let i=0;i<t.length;i++){let o=t[i],u=r+i;if(u>=n.length)return-1;if(!(n[u].type===o[0]&&n[u].value===o[1])){s=!1;break}}if(s)return r}return-1}function Ft(n){for(let e=0;e<n.length&&!(e>100);e++){let t=n[e];if(t.type==="line_comment"&&Nt.indexOf(t.value)>=0)return t.type="DNCL2\u30E2\u30FC\u30C9",!0}return!1}var oe=class{constructor(e,t){this.sourceCodeLength=e,this.preprocessed=t;let r=0;this.cumulativeSum=[];for(let s of t)this.cumulativeSum.push(r),r+=s.text.length;this.lastIndex=0,this.lastPreprocessedCodePosition=0}map(e){let t=this.findIndex(e);return Math.min(this.preprocessed[t].sourcePosition+(e-this.cumulativeSum[t]),t===this.preprocessed.length-1?this.sourceCodeLength:this.preprocessed[t+1].sourcePosition-1)}findIndex(e){e<this.lastPreprocessedCodePosition&&(this.lastIndex=0),this.lastPreprocessedCodePosition=e;for(let t=this.lastIndex;t<this.preprocessed.length-1;t++)if(e<this.cumulativeSum[t+1])return this.lastIndex=t,t;return this.lastIndex=this.preprocessed.length-1,this.preprocessed.length-1}},ue=class{constructor(e,t,r){this.lines=[],this.linesInsertedByIndentationSyntax=t,this.linesDeletedByIndentationSyntax=r;let s=0;for(let i of e.split(`
|
|
412
|
+
`,a))}return U(i)}function wt(n){for(let e=0;e<n.length&&!(e>100);e++){let t=n[e];if(t.type==="line_comment"&&vt.indexOf(t.value)>=0)return!0}return!1}var St=["!DNCL\u30E2\u30FC\u30C9","\u{1F4A1}DNCL\u30E2\u30FC\u30C9"],jt={"\u2190:\u2190":["eq","="],"\xF7:\xF7":["\xF7\xF7","\xF7\xF7"],"{:{":["[","["],"}:}":["]","]"],"word:\u3092\u5B9F\u884C":["\u3053\u3053\u307E\u3067","\u3053\u3053\u307E\u3067"],"word:\u4E71\u6570":["word","\u4E71\u6570\u7BC4\u56F2"],"word:\u8868\u793A":["word","\u9023\u7D9A\u8868\u793A"]};function Je(n){if(!xt(n))return n;let e=W(n,"eol");for(let t=0;t<e.length;t++){let r=e[t];if(r.length<=1)continue;for(let a=0;a<r.length;a++){if(r[a].type==="|"){r[a].type="range_comment";continue}break}let s=r[0];s.type==="word"&&s.value==="\u7E70\u8FD4"&&r.splice(0,r.length,x("word","\u5F8C\u5224\u5B9A",s.indent,s.line,s.file),x("word","\u7E70\u8FD4",s.indent,s.line,s.file));let i=A(r,["word:\u306A\u308B","word:\u7E70\u8FD4"]);i>0&&De(r,i);let o=A(r,["word:\u306A\u308B","word:\u5B9F\u884C"]);o>0&&De(r,o);let u=A(r,["word:\u306A\u3044"]);for(u>=1&&r[u].josi==="\u306A\u3089\u3070"&&(r[u-1].josi="\u3067\u306A\u3051\u308C\u3070",r.splice(u,1));;){let a=A(r,["word:\u4E8C\u9032","word:\u8868\u793A"]);if(a<0)break;r[a].value="\u4E8C\u9032\u8868\u793A",r[a].josi="",r.splice(a+1,1)}for(;;){let a=A(r,["word:\u6539\u884C","word:\u8868\u793A"]);if(a<0)break;let f=r[a];f.value="\u9023\u7D9A\u7121\u6539\u884C\u8868\u793A",f.josi="",r.splice(a+1,1)}for(;;){let a=A(r,["word:\u3092\u5B9F\u884C","comma:,","word:\u305D\u3046"]);if(a<0)break;let f=r[a+2];if(f.josi==="\u3067\u306A\u3051\u308C\u3070"){f.type="\u9055\u3048\u3070",f.value="\u9055\u3048\u3070",f.josi="",r.splice(a,3,f);continue}else if(f.josi==="\u3067"){let l=r[a+3];if(l.value.substring(0,4)==="\u306A\u304F\u3082\u3057"){if(f.type="\u9055\u3048\u3070",f.value="\u9055\u3048\u3070",f.josi="",r.splice(a,3,f),l.value.length>4){let h=l.value.substring(4),p=x("word",h,l.indent,l.line,l.file);h.match(/^\d/)&&(p.type="number"),r.splice(a+2,0,p),l.value=l.value.substring(0,4)}l.type="\u3082\u3057",l.value="\u3082\u3057",l.josi="";continue}}break}for(;;){let a=A(r,["word:\u5897","word:\u3089"]);if(a<0)break;let f=r[a];f.type="word",f.value="\u5897\u7E70\u8FD4",f.josi="",r.splice(a,2,f)}for(;;){let a=A(r,["word:\u6E1B","word:\u3089"]);if(a<0)break;let f=r[a];f.type="word",f.value="\u6E1B\u7E70\u8FD4",f.josi="",r.splice(a,2,f)}for(;;){let a=A(r,["word:\u3092\u7E70\u308A\u8FD4"]);if(a<0)break;let f=r[a];f.type="\u3053\u3053\u307E\u3067",f.value="\u3053\u3053\u307E\u3067",f.josi=""}for(;;){let a=A(r,["word:\u3059\u3079\u3066","word:\u8981\u7D20"]);if(a>=1)Pe(r,a);else break}for(;;){let a=A(r,["word:\u3059\u3079\u3066","word:\u5024"]);if(a>=1)Pe(r,a);else break}let c=0;for(;c<r.length;){let a=r[c];if(a.type==="word"&&a.value.length>=2){let f=a.value.charAt(a.value.length-1);(f==="\u6E1B"||f==="\u5897")&&(a.value=a.value.substring(0,a.value.length-1),a.josi="\u3060\u3051",r.splice(c+1,0,x("word",f,a.indent,a.line,a.file))),c++;continue}c++}}for(let t=0;t<n.length;t++){let r=n[t],s=jt[r.type+":"+r.value];s!==void 0&&(r.type=s[0],r.value=s[1])}return n=U(e),n}function Pe(n,e){let t=n[e];n[e-1].josi="";let r=x("eq","=",t.indent,t.line,t.file),s=x("[","[",t.indent,t.line,t.file),i=x("]","]",t.indent,t.line,t.file);i.josi="\u306B";let o=n[e+2];o.josi="";let u=x("number",100,t.indent,t.line,t.file);u.josi="\u3092";let c=x("word","\u639B",t.indent,t.line,t.file);n.splice(e,4,r,s,o,i,u,c)}function De(n,e){let t=A(n,["word:\u3092"]);t>=0&&(n[t].type="\u3053\u3053\u307E\u3067",n[t].value="\u3053\u3053\u307E\u3067");let r=A(n,["word:\u304C"]);r>=0&&(n[r].type="\u3053\u3053\u307E\u3067",n[r].value="\u3053\u3053\u307E\u3067"),n[e+1].value="\u9593"}function A(n,e){let t=e.map(r=>r.split(":"));for(let r=0;r<n.length;r++){let s=!0;for(let i=0;i<t.length;i++){let o=t[i],u=r+i;if(u>=n.length)return-1;if(!(n[u].type===o[0]&&n[u].value===o[1])){s=!1;break}}if(s)return r}return-1}function xt(n){for(let e=0;e<n.length&&!(e>100);e++){let t=n[e];if(t.type==="line_comment"&&St.indexOf(t.value)>=0)return t.type="DNCL\u30E2\u30FC\u30C9",!0}return!1}var $t=!1,me=30,Nt=["!DNCL2\u30E2\u30FC\u30C9","\u{1F4A1}DNCL2\u30E2\u30FC\u30C9","!DNCL2","\u{1F4A1}DNCL2"],At={"\u2190:\u2190":["eq","="],"\xF7:\xF7":["\xF7\xF7","\xF7\xF7"],"{:{":["[","["],"}:}":["]","]"],"word:not":["not","!"],"word:\u4E71\u6570":["word","\u4E71\u6570\u7BC4\u56F2"],"word:\u8868\u793A":["word","\u9023\u7D9A\u8868\u793A"],"word:\u3068\u5B9A\u7FA9":["\u3053\u3053\u307E\u3067","\u3053\u3053\u307E\u3067"]};function Re(n){if(!Ft(n))return n;let e=W(n,"eol");for(let t=0;t<e.length;t++){let r=e[t];if(r.length<=1)continue;let s=E(r,["word:\u306A\u3044"]);s>=1&&r[s].josi==="\u306A\u3089\u3070"&&(r[s-1].josi="\u3067\u306A\u3051\u308C\u3070",r.splice(s,1));for(let o=0;o<r.length;o++){let u=r[o];(u.value==="\u305D\u3046"||u.value==="\u305D\u308C")&&(u.josi==="\u3067\u306A\u3051\u308C\u3070"||u.josi==="\u3067\u306A\u304F")&&(u.type="\u9055\u3048\u3070",u.value="\u9055\u3048\u3070",u.josi="")}for(;;){let o=E(r,["word:\u3092\u5B9F\u884C","comma:,","word:\u305D\u3046"]);if(o<0)break;let u=r[o+2];if(u.josi==="\u3067\u306A\u3051\u308C\u3070"){u.type="\u9055\u3048\u3070",u.value="\u9055\u3048\u3070",u.josi="",r.splice(o,3,u);continue}else if(u.josi==="\u3067"){let c=r[o+3];if(c.value.substring(0,4)==="\u306A\u304F\u3082\u3057"){if(u.type="\u9055\u3048\u3070",u.value="\u9055\u3048\u3070",u.josi="",r.splice(o,3,u),c.value.length>4){let a=c.value.substring(4),f=x("word",a,c.indent,c.line,c.file);a.match(/^\d/)&&(f.type="number"),r.splice(o+2,0,f),c.value=c.value.substring(0,4)}c.type="\u3082\u3057",c.value="\u3082\u3057",c.josi="";continue}}break}for(;;){let o=E(r,["word:\u305D\u3046","word:\u306A\u304F"]);if(o<0)break;let u=r[o];if(u.josi==="\u3067"){u.type="\u9055\u3048\u3070",u.value="\u9055\u3048\u3070",u.josi="",r.splice(o+1,1);continue}break}for(;;){let o=E(r,["word:\u305D\u3046","word:\u306A\u304F\u3082\u3057"]);if(o<0)break;let u=r[o],c=r[o+1];u.type="\u9055\u3048\u3070",u.value="\u9055\u3048\u3070",u.josi="",c.type="\u3082\u3057",c.value="\u3082\u3057",c.josi=""}for(;;){let o=E(r,["word:\u5897","word:\u3089"]);if(o<0)break;let u=r[o];u.type="word",u.value="\u5897\u7E70\u8FD4",u.josi="",r.splice(o,2,u)}for(;;){let o=E(r,["word:\u6E1B","word:\u3089"]);if(o<0)break;let u=r[o];u.type="word",u.value="\u6E1B\u7E70\u8FD4",u.josi="",r.splice(o,2,u)}for(;;){let o=E(r,["word:\u5897","word:\u3089\u7E70\u308A\u8FD4"]);if(o<0)break;let u=r[o];u.type="word",u.value="\u5897\u7E70\u8FD4",u.josi="",r.splice(o,2,u)}for(;;){let o=E(r,["word:\u6E1B","word:\u3089\u7E70\u308A\u8FD4"]);if(o<0)break;let u=r[o];u.type="word",u.value="\u6E1B\u7E70\u8FD4",u.josi="",r.splice(o,2,u)}for(let o=0;o<r.length;o++){if(ge([["word:\u914D\u5217","word:\u914D\u5217\u5909\u6570"],"word","word:\u3059\u3079\u3066",["word:\u8981\u7D20","word:\u5024"],"*","word:\u4EE3\u5165"],r,o)){let u=r[o+1];u.josi="";let c=r[o+4];c.josi="",r.splice(o,6,u,v("eq","=",u),v("word","\u639B"),v("(","("),v("[","["),c,v("]","]"),v("comma",","),v("number",me),v(")",")")),o+=6}if(ge(["word","word:\u3059\u3079\u3066",["word:\u8981\u7D20","word:\u5024"],["number","string","word"],"word:\u3059\u308B"],r,o)){let u=r[o];u.josi="";let c=r[o+3];c.josi="",r.splice(o,5,u,v("eq","=",u),v("word","\u639B"),v("(","("),v("[","["),c,v("]","]"),v("comma",","),v("number",me),v(")",")"))}if(ge([["word:\u914D\u5217\u5909\u6570","word:\u914D\u5217"],"word","word:\u521D\u671F\u5316"],r,o)){let u=r[o+1];u.josi="",r.splice(o,3,u,v("eq","=",u),v("word","\u639B"),v("(","("),v("[","["),v("number",0),v("]","]"),v("comma",","),v("number",me),v(")",")"))}}for(;;){let o=E(r,["word:\u4E8C\u9032","word:\u8868\u793A"]);if(o<0)break;r[o].value="\u4E8C\u9032\u8868\u793A",r[o].josi="",r.splice(o+1,1)}for(;;){let o=E(r,["word:\u6539\u884C","word:\u8868\u793A"]);if(o<0)break;let u=r[o];u.value="\u9023\u7D9A\u7121\u6539\u884C\u8868\u793A",u.josi="",r.splice(o+1,1)}let i=0;for(;i<r.length;){let o=r[i];if(o.type==="word"&&o.value.length>=2){let u=o.value.charAt(o.value.length-1);(u==="\u6E1B"||u==="\u5897")&&(o.value=o.value.substring(0,o.value.length-1),o.josi="\u3060\u3051",r.splice(i+1,0,x("word",u,o.indent,o.line,o.file))),i++;continue}i++}}for(let t=0;t<n.length;t++){let r=n[t],s=At[r.type+":"+r.value];s!==void 0&&(r.type=s[0],r.value=s[1])}return n=U(e),$t&&(console.log("// DEBUG---DNCL:tokens---BEGIN"),console.log(ie(n)),console.log("// DEBUG---DNCL:tokens---END")),n}function ge(n,e,t){let r=(s,i)=>{if(s instanceof Array){for(let u=0;u<s.length;u++)if(r(s[u],i))return!0;return!1}if(s==="*")return!0;if(s.indexOf(":")<0)return s===i.type;let o=`${i.type}:${i.value}`;return s===o};for(let s=0;s<n.length;s++){let i=s+t;if(i>=e.length)return!1;let o=n[s],u=e[i];if(!r(o,u))return!1}return!0}function E(n,e){let t=e.map(r=>r.split(":"));for(let r=0;r<n.length;r++){let s=!0;for(let i=0;i<t.length;i++){let o=t[i],u=r+i;if(u>=n.length)return-1;if(!(n[u].type===o[0]&&n[u].value===o[1])){s=!1;break}}if(s)return r}return-1}function Ft(n){for(let e=0;e<n.length&&!(e>100);e++){let t=n[e];if(t.type==="line_comment"&&Nt.indexOf(t.value)>=0)return t.type="DNCL2\u30E2\u30FC\u30C9",!0}return!1}var oe=class{constructor(e,t){this.sourceCodeLength=e,this.preprocessed=t;let r=0;this.cumulativeSum=[];for(let s of t)this.cumulativeSum.push(r),r+=s.text.length;this.lastIndex=0,this.lastPreprocessedCodePosition=0}map(e){let t=this.findIndex(e);return Math.min(this.preprocessed[t].sourcePosition+(e-this.cumulativeSum[t]),t===this.preprocessed.length-1?this.sourceCodeLength:this.preprocessed[t+1].sourcePosition-1)}findIndex(e){e<this.lastPreprocessedCodePosition&&(this.lastIndex=0),this.lastPreprocessedCodePosition=e;for(let t=this.lastIndex;t<this.preprocessed.length-1;t++)if(e<this.cumulativeSum[t+1])return this.lastIndex=t,t;return this.lastIndex=this.preprocessed.length-1,this.preprocessed.length-1}},ue=class{constructor(e,t,r){this.lines=[],this.linesInsertedByIndentationSyntax=t,this.linesDeletedByIndentationSyntax=r;let s=0;for(let i of e.split(`
|
|
412
413
|
`))this.lines.push({offset:s,len:i.length}),s+=i.length+1;this.lastLineNumber=0,this.lastOffset=0}map(e,t){if(e===null)return{startOffset:e,endOffset:t};let r=this.getLineNumber(e);for(let s of this.linesInsertedByIndentationSyntax){if(r===s){e=null,t=null;break}r>s&&(e-=this.lines[s].len+1,t!==null&&(t-=this.lines[s].len+1))}for(let s of this.linesDeletedByIndentationSyntax)r>=s.lineNumber&&(e!==null&&(e+=s.len+1),t!==null&&(t+=s.len+1));return{startOffset:e,endOffset:t}}getLineNumber(e){e<this.lastOffset&&(this.lastLineNumber=0),this.lastOffset=e;for(let t=this.lastLineNumber;t<this.lines.length-1;t++)if(e<this.lines[t+1].offset)return this.lastLineNumber=t,t;return this.lastLineNumber=this.lines.length-1,this.lines.length-1}},ce=class{constructor(e){this.lineOffsets=[];let t=0;for(let r of e.split(`
|
|
413
414
|
`))this.lineOffsets.push(t),t+=r.length+1;this.lastLineNumber=0,this.lastOffset=0}map(e,t){e<this.lastOffset&&(this.lastLineNumber=0),this.lastOffset=e;for(let r=this.lastLineNumber;r<this.lineOffsets.length-1;r++)if(e<this.lineOffsets[r+1])return this.lastLineNumber=r,{line:r+(t?1:0),column:e-this.lineOffsets[r]};return this.lastLineNumber=this.lineOffsets.length-1,{line:this.lineOffsets.length-1+(t?1:0),column:e-this.lineOffsets[this.lineOffsets.length-1]}}};function be(n,e){if(typeof n.startOffset=="number"&&(n.startOffset-=e.length),typeof n.endOffset=="number"&&(n.endOffset-=e.length),e!==""){let t=e.split(`
|
|
414
415
|
`);typeof n.line=="number"&&(n.line-=t.length-1),n.line===0&&typeof n.column=="number"&&(n.column-=t[t.length-1].length)}return n}var Ot={reset:"\x1B[0m",bold:"\x1B[1m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},ke=["black","red","green","yellow","blue","magenta","cyan","white"],Et=n=>n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),Ct=n=>{let e=n.replace(/\x1b\[\d+m/g,""),t=[],r="inherit",s="inherit",i=n===e?e:n.replace(/\x1b\[(\d+)m/g,(a,f)=>{let l=+f;return l===0&&(r="inherit",s="inherit"),l===1&&(s="bold"),l>=30&&l<=37&&(r=ke[l-30]),t.push(`color: ${r}; font-weight: ${s};`),"%c"}),o="inherit",u="inherit",c=n===e?e:"<span>"+Et(n).replace(/\x1b\[(\d+)m/g,(a,f)=>{let l=+f;return l===0&&(o="inherit",u="inherit"),l===1&&(u="bold"),l>=30&&l<=37&&(o=ke[l-30]),`</span><span style="color: ${o}; font-weight: ${u};">`})+"</span>";return{noColor:e,nodeConsole:n===e?e:n+"\x1B[0m",html:c,browserConsole:[i,...t]}},S={convertColorTextFormat:Ct,colorNames:ke,color:Ot};var $=class n{static fromS(e){let t=n.trace;switch(e){case"all":t=n.all;break;case"trace":t=n.trace;break;case"debug":t=n.debug;break;case"info":t=n.info;break;case"warn":t=n.warn;break;case"error":t=n.error;break;case"stdout":t=n.stdout;break;default:throw new Error("[NakoLogger] unknown logger level:"+e)}return t}static toString(e){return["all","trace","debug","info","warn","error","stdout"][e]}};$.all=0;$.trace=1;$.debug=2;$.info=3;$.warn=4;$.error=5;$.stdout=6;function Y(n){return n?`${n.file||""}${n.line===void 0?"":`(${n.line+1}\u884C\u76EE): `}`:""}var H=class{constructor(){this.listeners=[],this.logs="",this.position=""}getErrorLogs(){return[this.logs.replace(/\s+$/,""),this.position]}clear(){this.logs="",this.position=""}addListener(e,t){let r=$.fromS(e);this.listeners.push({level:r,callback:t})}removeListener(e){this.listeners=this.listeners.filter(t=>t.callback!==e)}trace(e,t=null){this.sendI($.trace,`${S.color.bold}[\u30C7\u30D0\u30C3\u30B0\u60C5\u5831\uFF08\u8A73\u7D30\uFF09]${S.color.reset}${Y(t)}${e}`,t)}debug(e,t=null){this.sendI($.debug,`${S.color.bold}[\u30C7\u30D0\u30C3\u30B0\u60C5\u5831]${S.color.reset}${Y(t)}${e}`,t)}info(e,t=null){this.sendI($.info,`${S.color.bold}${S.color.blue}[\u60C5\u5831]${S.color.reset}${Y(t)}${e}`,t)}warn(e,t=null){this.sendI($.warn,`${S.color.bold}${S.color.green}[\u8B66\u544A]${S.color.reset}${Y(t)}${e}`,t)}error(e,t=null){if(e instanceof Error&&typeof e.type=="string")switch(e.type){case"NakoRuntimeError":case"NakoError":if(e instanceof O){let s=e,i=t;i==null&&(i={file:s.file,line:s.line||0,startOffset:0,endOffset:0}),this.sendI($.error,s.message,i);return}}e instanceof Error&&(e=e.message),this.sendI($.error,`${S.color.bold}${S.color.red}[\u30A8\u30E9\u30FC]${S.color.reset}${Y(t)}${e}`,t)}runtimeError(e,t){return new D(e,t)}stdout(e,t=null){this.sendI($.stdout,`${e}`,t)}send(e,t,r,s=null,i=null){let o=$.fromS(e);this.sendI(o,t,r,s,i)}sendI(e,t,r,s=null,i=null){let o=()=>{let u=S.convertColorTextFormat(t),c="";return t.includes(`
|
|
@@ -416,7 +417,7 @@ ${s}
|
|
|
416
417
|
`,r&&this.position!==null&&(this.position=`l${r.line}:${r.file}`)}for(let u of this.listeners)if(u.level<=e){let c=o();u.callback(c)}}};var ae=class{constructor(e,t,r=0){this.guid=r,this.lastJSCode="",this.__locals=new Map,this.__varslist=[e.newVaiables(e.__varslist[0]),e.newVaiables(e.__varslist[1]),e.newVaiables(e.__varslist[2])],this.numFailures=0,this.index=0,this.nextIndex=-1,this.__code=[],this.__callstack=[],this.__stack=[],this.__labels=[],this.__genMode=t.genMode,this.version=e.version,this.coreVersion=e.coreVersion,this.__module={...e.__module},this.pluginfiles={...e.getPluginfiles()},this.gen=t,this.logger=e.getLogger(),this.compiler=e,this.josiList=e.josiList,this.reservedWords=e.reservedWords}clearLog(){this.__varslist[0].set("\u8868\u793A\u30ED\u30B0","")}get log(){let e=this.__varslist[0].get("\u8868\u793A\u30ED\u30B0");return e=e.replace(/\s+$/,""),e}__setSysVar(e,t){this.__varslist[0].set(e,t)}__getSysVar(e){return this.__varslist[0].get(e)}runEx(e,t,r,s=""){return r.preCode=s,r.nakoGlobal=this,this.compiler.runSync(e,t,r)}async runAsync(e,t,r,s=""){return r.preCode=s,r.nakoGlobal=this,await this.compiler.runAsync(e,t,r)}_runTests(e){let t=`${S.color.bold}\u30C6\u30B9\u30C8\u306E\u5B9F\u884C\u7D50\u679C${S.color.reset}
|
|
417
418
|
`,r=0,s=0;for(let i of e)try{i.f(),t+=`${S.color.green}\u2714${S.color.reset} ${i.name}
|
|
418
419
|
`,r++}catch(o){t+=`${S.color.red}\u2613${S.color.reset} ${i.name}: ${o.message}
|
|
419
|
-
`,s++}s>0?t+=`${S.color.green}\u6210\u529F ${r}\u4EF6 ${S.color.red}\u5931\u6557 ${s}\u4EF6`:t+=`${S.color.green}\u6210\u529F ${r}\u4EF6`,this.numFailures=s,this.logger.stdout(t)}clearPlugins(){let e="!\u30AF\u30EA\u30A2";for(let t in this.pluginfiles){let r=this.__module[t];r[e]&&r[e].fn&&r[e].fn(this)}}reset(){this.clearPlugins()}destroy(){this.reset()}};var Mt={version:"3.6.
|
|
420
|
+
`,s++}s>0?t+=`${S.color.green}\u6210\u529F ${r}\u4EF6 ${S.color.red}\u5931\u6557 ${s}\u4EF6`:t+=`${S.color.green}\u6210\u529F ${r}\u4EF6`,this.numFailures=s,this.logger.stdout(t)}clearPlugins(){let e="!\u30AF\u30EA\u30A2";for(let t in this.pluginfiles){let r=this.__module[t];r[e]&&r[e].fn&&r[e].fn(this)}}reset(){this.clearPlugins()}destroy(){this.reset()}};var Mt={version:"3.6.22",major:3,minor:6,patch:22},ve=Mt;var Ge={meta:{type:"const",value:{pluginName:"plugin_system",description:"\u30B7\u30B9\u30C6\u30E0\u95A2\u9023\u306E\u547D\u4EE4\u3092\u63D0\u4F9B\u3059\u308B\u30D7\u30E9\u30B0\u30A4\u30F3",pluginVersion:"3.6.0",nakoRuntime:["wnako","cnako","phpnako"],nakoVersion:"3.6.0"}},\u521D\u671F\u5316:{type:"func",josi:[],pure:!1,fn:function(sys){let system=sys;sys.isDebug=!1,sys.__setSysVar=(n,e)=>system.__v0.set(n,e),sys.__getSysVar=(n,e=void 0)=>{let t=system.__v0.get(n);return t===void 0?e:t},sys.__setSore=n=>(sys.__vars.set("\u305D\u308C",n),n),sys.__getSore=()=>sys.__vars.get("\u305D\u308C"),sys.tags={},sys.__setSysVar("\u30CA\u30C7\u30B7\u30B3\u30D0\u30FC\u30B8\u30E7\u30F3",sys.version),sys.__setSysVar("\u30CA\u30C7\u30B7\u30B3\u8A00\u8A9E\u30D0\u30FC\u30B8\u30E7\u30F3",sys.coreVersion),system.__namespaceList||(system.__namespaceList=[]),sys.__findVar=function(n,e){if(typeof n=="function")return n;let t=system.__locals.get(n);if(t)return t;if(n.indexOf("__")>=0){for(let s=2;s>=0;s--){let o=system.__varslist[s].get(n);if(o)return o}return e}let r=system.__modList?system.__modList:[system.__modName];for(let s of r){let i=s+"__"+n;for(let o=2;o>=0;o--){let c=system.__varslist[o].get(i);if(c)return c}}return e},sys.__findFunc=function(n,e){let t=sys.__findVar(n);if(typeof t=="function")return t;throw new Error(`\u300E${e}\u300F\u306B\u5B9F\u884C\u3067\u304D\u306A\u3044\u95A2\u6570\u304C\u6307\u5B9A\u3055\u308C\u307E\u3057\u305F\u3002`)},sys.__exec=function(n,e){let t=sys.__getSysVar(n);if(t)return t.apply(this,e);let r=sys.__findVar(n);if(!r)throw new Error("\u30B7\u30B9\u30C6\u30E0\u95A2\u6570\u3067\u30A8\u30A4\u30EA\u30A2\u30B9\u306E\u6307\u5B9A\u30DF\u30B9:"+n);return r.apply(this,e)},sys.__timeout=[],sys.__interval=[];let z2=sys.__zero2=n=>(n="00"+n,n.substring(n.length-2));sys.__zero=(n,e)=>{let t="";for(let r=0;r<e;r++)t+="0";return n=t+n,n.substring(n.length-e)},sys.__formatDate=n=>n.getFullYear()+"/"+z2(n.getMonth()+1)+"/"+z2(n.getDate()),sys.__formatTime=n=>z2(n.getHours())+":"+z2(n.getSeconds())+":"+z2(n.getMinutes()),sys.__formatDateTime=(n,e)=>{let t=n.getFullYear()+"/"+z2(n.getMonth()+1)+"/"+z2(n.getDate()),r=z2(n.getHours())+":"+z2(n.getMinutes())+":"+z2(n.getSeconds());return e.match(/^\d+\/\d+\/\d+\s+\d+:\d+:\d+$/)?t+" "+r:e.match(/^\d+\/\d+\/\d+$/)?t:e.match(/^\d+:\d+:\d+$/)?r:t+" "+r},sys.__str2date=n=>{if(n=(""+n).replace(/(^\s+|\s+$)/,""),n.match(/^(\d+|\d+\.\d+)$/))return new Date(parseFloat(n)*1e3);if(n.match(/^\d+:\d+(:\d+)?$/)){let t=new Date,r=(n+":0").split(":");return new Date(t.getFullYear(),t.getMonth(),t.getDate(),parseInt(r[0]),parseInt(r[1]),parseInt(r[2]))}n=n.replace(/[\s:\-T]/g,"/"),n+="/0/0/0";let e=n.split("/");return new Date(parseInt(e[0]),parseInt(e[1])-1,parseInt(e[2]),parseInt(e[3]),parseInt(e[4]),parseInt(e[5]))},sys.__printPool="",sys.__parseFloatOrBigint=n=>typeof n=="bigint"?n:parseFloat(n),system.chk=(n,e)=>{if(typeof n>"u"){let t=system.constPools[e],[r,s,i,o]=t,u=system.constPoolsTemplate[r];for(let a in s){let f=system.constPoolsTemplate[s[a]];u=u.split(`$${a}`).join(f)}let c=system.constPoolsTemplate[i];sys.logger.warn(u,{file:c,line:o})}return n},sys.__evalSafe=n=>{let e=eval;try{return e(n)}catch(t){return console.warn("[eval]",t),null}},sys.__evalJS=(src,sys)=>{try{return eval(src)}catch(n){return console.warn("[eval]",n),null}}}},"!\u30AF\u30EA\u30A2":{type:"func",josi:[],fn:function(n){n.__exec&&n.__exec("\u5168\u30BF\u30A4\u30DE\u30FC\u505C\u6B62",[n]),n.__setSysVar("\u8868\u793A\u30ED\u30B0","")}},\u30CA\u30C7\u30B7\u30B3\u30D0\u30FC\u30B8\u30E7\u30F3:{type:"const",value:"?"},\u30CA\u30C7\u30B7\u30B3\u8A00\u8A9E\u30D0\u30FC\u30B8\u30E7\u30F3:{type:"const",value:"?"},\u30CA\u30C7\u30B7\u30B3\u30A8\u30F3\u30B8\u30F3:{type:"const",value:"nadesi.com/v3"},\u30CA\u30C7\u30B7\u30B3\u7A2E\u985E:{type:"const",value:"?"},\u306F\u3044:{type:"const",value:1},\u3044\u3044\u3048:{type:"const",value:0},\u771F:{type:"const",value:1},\u507D:{type:"const",value:0},\u6C38\u9060:{type:"const",value:1},\u30AA\u30F3:{type:"const",value:1},\u30AA\u30D5:{type:"const",value:0},\u6539\u884C:{type:"const",value:`
|
|
420
421
|
`},\u30BF\u30D6:{type:"const",value:" "},\u30AB\u30C3\u30B3:{type:"const",value:"\u300C"},\u30AB\u30C3\u30B3\u9589:{type:"const",value:"\u300D"},\u6CE2\u30AB\u30C3\u30B3:{type:"const",value:"{"},\u6CE2\u30AB\u30C3\u30B3\u9589:{type:"const",value:"}"},OK:{type:"const",value:!0},NG:{type:"const",value:!1},\u30AD\u30E3\u30F3\u30BB\u30EB:{type:"const",value:0},TRUE:{type:"const",value:!0},FALSE:{type:"const",value:!1},true:{type:"const",value:!0},false:{type:"const",value:!1},PI:{type:"const",value:Math.PI},\u7A7A:{type:"const",value:""},NULL:{type:"const",value:null},undefined:{type:"const",value:void 0},\u672A\u5B9A\u7FA9:{type:"const",value:void 0},\u30A8\u30E9\u30FC\u30E1\u30C3\u30BB\u30FC\u30B8:{type:"const",value:""},\u5BFE\u8C61:{type:"const",value:""},\u5BFE\u8C61\u30AD\u30FC:{type:"const",value:""},\u56DE\u6570:{type:"const",value:""},CR:{type:"const",value:"\r"},LF:{type:"const",value:`
|
|
421
422
|
`},\u975E\u6570:{type:"const",value:NaN},\u7121\u9650\u5927:{type:"const",value:1/0},\u623B\u5024\u7121:{type:"const",value:0},\u623B\u5024\u6709:{type:"const",value:1},\u7A7A\u914D\u5217:{type:"func",josi:[],pure:!0,fn:function(){return[]}},\u7A7A\u8F9E\u66F8:{type:"func",josi:[],pure:!0,fn:function(){return{}}},\u7A7A\u30CF\u30C3\u30B7\u30E5:{type:"func",josi:[],pure:!0,fn:function(){return{}}},\u7A7A\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8:{type:"func",josi:[],pure:!1,fn:function(n){return n.__exec("\u7A7A\u30CF\u30C3\u30B7\u30E5",[n])}},\u8868\u793A:{type:"func",josi:[["\u3092","\u3068"]],pure:!0,fn:function(n,e){n=e.__printPool+n,e.__printPool="",e.__setSysVar("\u8868\u793A\u30ED\u30B0",e.__getSysVar("\u8868\u793A\u30ED\u30B0")+n+`
|
|
422
423
|
`),e.logger.send("stdout",n+"")},return_none:!0},\u7D99\u7D9A\u8868\u793A:{type:"func",josi:[["\u3092","\u3068"]],pure:!0,fn:function(n,e){e.__printPool+=n},return_none:!0},\u9023\u7D9A\u8868\u793A:{type:"func",josi:[["\u3068","\u3092"]],isVariableJosi:!0,pure:!0,fn:function(...n){let e=n.pop(),t=n.join("");e.__exec("\u8868\u793A",[t,e])},return_none:!0},\u9023\u7D9A\u7121\u6539\u884C\u8868\u793A:{type:"func",josi:[["\u3068","\u3092"]],isVariableJosi:!0,pure:!0,fn:function(...n){let e=n.pop(),t=n.join("");e.__exec("\u7D99\u7D9A\u8868\u793A",[t,e])},return_none:!0},\u8868\u793A\u30ED\u30B0:{type:"const",value:""},\u8868\u793A\u30ED\u30B0\u30AF\u30EA\u30A2:{type:"func",josi:[],pure:!0,fn:function(n){n.__setSysVar("\u8868\u793A\u30ED\u30B0","")},return_none:!0},\u8A00:{type:"func",josi:[["\u3092","\u3068"]],pure:!0,fn:function(n,e){e.logger.send("stdout",n+"")},return_none:!0},\u30B3\u30F3\u30BD\u30FC\u30EB\u8868\u793A:{type:"func",josi:[["\u3092","\u3068"]],pure:!0,fn:function(n){console.log(n)},return_none:!0},\u8DB3:{type:"func",josi:[["\u306B","\u3068"],["\u3092"]],isVariableJosi:!1,pure:!0,fn:function(n,e){return n+e}},\u5F15:{type:"func",josi:[["\u304B\u3089"],["\u3092"]],pure:!0,fn:function(n,e){return n-e}},\u639B:{type:"func",josi:[["\u306B","\u3068"],["\u3092"]],pure:!0,fn:function(n,e){if(typeof n=="number")return n*e;if(typeof n=="string"){let t="";for(let r=0;r<parseInt(e);r++)t+=n;return t}if(n instanceof Array){let t=[];for(let r=0;r<parseInt(e);r++)t.push(...n);return t}return n*e}},\u500D:{type:"func",josi:[["\u306E","\u3092"],[""]],pure:!0,fn:function(n,e){return n*e}},\u5272:{type:"func",josi:[["\u3092"],["\u3067"]],pure:!0,fn:function(n,e){return n/e}},\u5272\u4F59:{type:"func",josi:[["\u3092"],["\u3067"]],pure:!0,fn:function(n,e){return n%e}},\u5076\u6570:{type:"func",josi:[["\u304C"]],pure:!0,fn:function(n){return parseInt(n)%2===0}},\u5947\u6570:{type:"func",josi:[["\u304C"]],pure:!0,fn:function(n){return parseInt(n)%2===1}},\u4E8C\u4E57:{type:"func",josi:[["\u306E","\u3092"]],pure:!0,fn:function(n){return n*n}},\u3079\u304D\u4E57:{type:"func",josi:[["\u306E"],["\u306E"]],pure:!0,fn:function(n,e){return Math.pow(n,e)}},\u4EE5\u4E0A:{type:"func",josi:[["\u304C"],[""]],pure:!0,fn:function(n,e){return n>=e}},\u4EE5\u4E0B:{type:"func",josi:[["\u304C"],[""]],pure:!0,fn:function(n,e){return n<=e}},\u672A\u6E80:{type:"func",josi:[["\u304C"],[""]],pure:!0,fn:function(n,e){return n<e}},\u8D85:{type:"func",josi:[["\u304C"],[""]],pure:!0,fn:function(n,e){return n>e}},\u7B49:{type:"func",josi:[["\u304C"],["\u3068"]],pure:!0,fn:function(n,e){return n===e}},\u7B49\u7121:{type:"func",josi:[["\u304C"],["\u3068"]],pure:!0,fn:function(n,e){return n!==e}},\u4E00\u81F4:{type:"func",josi:[["\u304C"],["\u3068"]],pure:!0,fn:function(n,e){if(typeof n=="object"){let t=JSON.stringify(n),r=JSON.stringify(e);return t===r}return n===e}},\u4E0D\u4E00\u81F4:{type:"func",josi:[["\u304C"],["\u3068"]],pure:!0,fn:function(n,e){if(typeof n=="object"){let t=JSON.stringify(n),r=JSON.stringify(e);return t!==r}return n!==e}},\u7BC4\u56F2\u5185:{type:"func",josi:[["\u304C"],["\u304B\u3089"],["\u306E","\u307E\u3067\u306E"]],pure:!0,fn:function(n,e,t){return e<=n&&n<=t}},\u7BC4\u56F2:{type:"func",josi:[["\u304B\u3089"],["\u306E","\u307E\u3067\u306E"]],pure:!0,fn:function(n,e){return{\u5148\u982D:n,\u672B\u5C3E:e}}},\u9023\u7D9A\u52A0\u7B97:{type:"func",josi:[["\u3092"],["\u306B","\u3068"]],isVariableJosi:!0,pure:!0,fn:function(n,...e){return e.pop(),e.push(n),e.reduce((t,r)=>t+r)}},\u304F\u3060\u3055\u3044:{type:"func",josi:[],pure:!0,fn:function(n){n.__reisetu||(n.__reisetu=0),n.__reisetu++},return_none:!0},\u304A\u9858:{type:"func",josi:[],pure:!0,fn:function(n){n.__reisetu||(n.__reisetu=0),n.__reisetu++},return_none:!0},\u3067\u3059:{type:"func",josi:[],pure:!0,fn:function(n){n.__reisetu||(n.__reisetu=0),n.__reisetu++},return_none:!0},\u62DD\u5553:{type:"func",josi:[],pure:!0,fn:function(n){n.__reisetu=0},return_none:!0},\u656C\u5177:{type:"func",josi:[],pure:!0,fn:function(n){n.__reisetu+=100},return_none:!0},\u793C\u7BC0\u30EC\u30D9\u30EB\u53D6\u5F97:{type:"func",josi:[],pure:!0,fn:function(n){return n.__reisetu||(n.__reisetu=0),n.__reisetu}},JS\u5B9F\u884C:{type:"func",josi:[["\u3092","\u3067"]],pure:!0,fn:function(n,e){return e.__evalJS(n,e)}},JS\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u53D6\u5F97:{type:"func",josi:[["\u306E"]],pure:!1,fn:function(n,e){return e.__findVar(n,null)}},JS\u95A2\u6570\u5B9F\u884C:{type:"func",josi:[["\u3092"],["\u3067"]],fn:function(n,e,t){if(typeof n=="string"&&(n=t.__evalJS(n,t)),typeof n!="function")throw new Error("JS\u95A2\u6570\u53D6\u5F97\u3067\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3002");return e instanceof Array||(e=[e]),n.apply(null,e)}},ASYNC:{type:"func",josi:[],asyncFn:!0,pure:!0,fn:async function(){},return_none:!0},AWAIT\u5B9F\u884C:{type:"func",josi:[["\u3092"],["\u3067"]],pure:!0,asyncFn:!0,fn:async function(n,e,t){if(typeof n=="string"&&(n=t.__findFunc(n,"AWAIT\u5B9F\u884C")),!(n instanceof Function))throw new Error("\u300EAWAIT\u5B9F\u884C\u300F\u306E\u7B2C\u4E00\u5F15\u6570\u306F\u306A\u3067\u3057\u3053\u95A2\u6570\u540D\u304BFunction\u578B\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");return await n(...e)}},JS\u30E1\u30BD\u30C3\u30C9\u5B9F\u884C:{type:"func",josi:[["\u306E"],["\u3092"],["\u3067"]],fn:function(n,e,t,r){if(typeof n=="string"&&(n=r.__evalJS(n,r)),typeof n!="object")throw new Error("JS\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002");return typeof e!="function"&&(e=n[e]),t instanceof Array||(t=[t]),e.apply(n,t)}},\u30CA\u30C7\u30B7\u30B3:{type:"func",josi:[["\u3092","\u3067"]],pure:!1,fn:function(n,e){e.__setSysVar("\u8868\u793A\u30ED\u30B0",""),e.__self.runEx(n,e.__modName,{resetEnv:!1,resetLog:!0});let t=e.__getSysVar("\u8868\u793A\u30ED\u30B0")+"";return t&&e.logger.trace(t),t}},\u30CA\u30C7\u30B7\u30B3\u7D9A:{type:"func",josi:[["\u3092","\u3067"]],fn:function(n,e){e.__self.runEx(n,e.__modName,{resetEnv:!1,resetAll:!1});let t=e.__getSysVar("\u8868\u793A\u30ED\u30B0")+"";return t&&e.logger.trace(t),t}},\u5B9F\u884C:{type:"func",josi:[["\u3092","\u306B","\u3067"]],pure:!1,fn:function(n,e){if(typeof n=="function")return n(e);if(typeof n=="string"){let t=e.__findFunc(n,"\u5B9F\u884C");if(typeof t=="function")return t(e)}return n}},\u5B9F\u884C\u6642\u9593\u8A08\u6E2C:{type:"func",josi:[["\u306E"]],pure:!1,fn:function(n,e){if(typeof n=="string"&&(n=e.__findFunc(n,"\u5B9F\u884C\u6642\u9593\u8A08\u6E2C")),performance&&performance.now){let t=performance.now();return n(e),performance.now()-t}else{let t=Date.now();return n(e),Date.now()-t}}},\u7D42:{type:"func",josi:[],pure:!0,fn:function(n){if(n.__setSysVar("__forceClose",!0),!n.__getSysVar("__useDebug"))throw new Error("__\u7D42\u308F\u308B__")}},\u5909\u6570\u578B\u78BA\u8A8D:{type:"func",josi:[["\u306E"]],pure:!0,fn:function(n){return typeof n}},TYPEOF:{type:"func",josi:[["\u306E"]],pure:!0,fn:function(n){return typeof n}},\u6587\u5B57\u5217\u5909\u63DB:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n){return String(n)}},TOSTR:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n){return String(n)}},\u6574\u6570\u5909\u63DB:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n){return parseInt(n)}},TOINT:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n){return parseInt(n)}},\u5B9F\u6570\u5909\u63DB:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n){return parseFloat(n)}},TOFLOAT:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n){return parseFloat(n)}},INT:{type:"func",josi:[["\u306E"]],pure:!0,fn:function(n){return parseInt(n)}},FLOAT:{type:"func",josi:[["\u306E"]],pure:!0,fn:function(n){return parseFloat(n)}},NAN\u5224\u5B9A:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n){return isNaN(n)}},\u975E\u6570\u5224\u5B9A:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n){return Number.isNaN(n)}},HEX:{type:"func",josi:[["\u306E"]],pure:!0,fn:function(n){return parseInt(n).toString(16)}},\u9032\u6570\u5909\u63DB:{type:"func",josi:[["\u3092","\u306E"],[""]],pure:!0,fn:function(n,e){return parseInt(n).toString(e)}},\u4E8C\u9032:{type:"func",josi:[["\u3092","\u306E","\u304B\u3089"]],pure:!0,fn:function(n){return parseInt(n).toString(2)}},\u4E8C\u9032\u8868\u793A:{type:"func",josi:[["\u3092","\u306E","\u304B\u3089"]],pure:!0,fn:function(n,e){let t=parseInt(n).toString(2);e.__exec("\u8868\u793A",[t,e])}},RGB:{type:"func",josi:[["\u3068"],["\u306E"],["\u3067"]],pure:!0,fn:function(n,e,t){let r=s=>{let i="00"+parseInt(""+s).toString(16);return i.substring(i.length-2,i.length)};return"#"+r(n)+r(e)+r(t)}},\u8AD6\u7406OR:{type:"func",josi:[["\u3068"],["\u306E"]],pure:!0,fn:function(n,e){return n||e}},\u8AD6\u7406AND:{type:"func",josi:[["\u3068"],["\u306E"]],pure:!0,fn:function(n,e){return n&&e}},\u8AD6\u7406NOT:{type:"func",josi:[["\u306E"]],pure:!0,fn:function(n){return n?0:1}},OR:{type:"func",josi:[["\u3068"],["\u306E"]],pure:!0,fn:function(n,e){return n|e}},AND:{type:"func",josi:[["\u3068"],["\u306E"]],pure:!0,fn:function(n,e){return n&e}},XOR:{type:"func",josi:[["\u3068"],["\u306E"]],pure:!0,fn:function(n,e){return n^e}},NOT:{type:"func",josi:[["\u306E"]],pure:!0,fn:function(n){return~n}},SHIFT_L:{type:"func",josi:[["\u3092"],["\u3067"]],pure:!0,fn:function(n,e){return n<<e}},SHIFT_R:{type:"func",josi:[["\u3092"],["\u3067"]],pure:!0,fn:function(n,e){return n>>e}},SHIFT_UR:{type:"func",josi:[["\u3092"],["\u3067"]],pure:!0,fn:function(n,e){return n>>>e}},\u6587\u5B57\u6570:{type:"func",josi:[["\u306E"]],pure:!0,fn:function(n){return Array.from?Array.from(n).length:String(n).length}},\u4F55\u6587\u5B57\u76EE:{type:"func",josi:[["\u3067","\u306E"],["\u304C"]],pure:!0,fn:function(n,e){return String(n).indexOf(e)+1}},CHR:{type:"func",josi:[["\u306E"]],pure:!0,fn:function(n){return String.fromCodePoint?String.fromCodePoint(n):String.fromCharCode(n)}},ASC:{type:"func",josi:[["\u306E"]],pure:!0,fn:function(n){return String.prototype.codePointAt?String(n).codePointAt(0):String(n).charCodeAt(0)}},\u6587\u5B57\u633F\u5165:{type:"func",josi:[["\u3067","\u306E"],["\u306B","\u3078"],["\u3092"]],pure:!0,fn:function(n,e,t){e<=0&&(e=1);let r=String(n),s=r.substring(0,e-1),i=r.substring(e-1);return s+t+i}},\u6587\u5B57\u691C\u7D22:{type:"func",josi:[["\u3067","\u306E"],["\u304B\u3089"],["\u3092"]],pure:!0,fn:function(n,e,t){let r=String(n);r=r.substring(e);let s=r.indexOf(t);return s===-1?0:s+1+e}},\u8FFD\u52A0:{type:"func",josi:[["\u3067","\u306B","\u3078"],["\u3092"]],pure:!0,fn:function(n,e){return n instanceof Array?(n.push(e),n):String(n)+String(e)}},\u4E00\u884C\u8FFD\u52A0:{type:"func",josi:[["\u3067","\u306B","\u3078"],["\u3092"]],pure:!0,fn:function(n,e){return n instanceof Array?(n.push(e),n):String(n)+String(e)+`
|
|
@@ -429,7 +430,7 @@ ${s}
|
|
|
429
430
|
`){o.push(""),i.push(o),o=[],n=n.substring(1);continue}if(n=n.replace(/^\s+/,""),u=n.charAt(0),u===e){console.log("delimiter"),o.push(""),n=n.substring(e.length);continue}if(u==="="&&n.charAt(1)==='"'){n=n.substring(1);continue}if(u!=='"'){let f=r.exec(n);if(!f){o.push(s(n)),i.push(o),o=[];break}f[2]===`
|
|
430
431
|
`?(o.push(s(f[1])),i.push(o),o=[]):f[2]===e&&o.push(s(f[1])),n=n.substring(f[0].length);continue}if(n.substring(0,2)==='""'){o.push(""),n=n.substring(2);continue}let c=1,a="";for(;c<n.length;){let f=n.charAt(c),l=n.charAt(c+1);if(f==='"'&&l==='"'){c+=2,a+='"';continue}if(f==='"'){if(c++,l===e){c++,o.push(s(a)),a="";break}if(l===`
|
|
431
432
|
`){c++,o.push(s(a)),i.push(o),o=[];break}c++;continue}a+=f,c++}n=n.substr(c)}return o.length>0&&i.push(o),i}function Se(n,e=void 0,t=void 0){e===void 0&&(e=I.delimiter),t===void 0&&(t=I.eol);let r=Tt(e);if(n===void 0)return"";let s="";for(let i=0;i<n.length;i++){let o=n[i];if(o===void 0){s+=t;continue}for(let u=0;u<o.length;u++)o[u]=r(o[u]);s+=o.join(e)+t}return s=s.replace(/(\r\n|\r|\n)/g,t),s}function Tt(n){return function(e){e=""+e;let t=!1;return(e.indexOf(`
|
|
432
|
-
`)>=0||e.indexOf("\r")>=0)&&(t=!0),e.indexOf(n)>=0&&(t=!0),e.indexOf('"')>=0&&(t=!0,e=e.replace(/"/g,'""')),t&&(e='"'+e+'"'),e}}var Vt={meta:{type:"const",value:{pluginName:"plugin_csv",description:"CSV\u95A2\u9023\u306E\u547D\u4EE4\u3092\u63D0\u4F9B\u3059\u308B\u30D7\u30E9\u30B0\u30A4\u30F3",pluginVersion:"3.6.0",nakoRuntime:["wnako","cnako","phpnako"],nakoVersion:"3.6.0"}},\u521D\u671F\u5316:{type:"func",josi:[],pure:!0,fn:function(){}},CSV\u53D6\u5F97:{type:"func",josi:[["\u3092","\u306E","\u3067"]],pure:!0,fn:function(n){return I.delimiter=",",we(n)}},TSV\u53D6\u5F97:{type:"func",josi:[["\u3092","\u306E","\u3067"]],pure:!0,fn:function(n){return I.delimiter=" ",we(n)}},\u8868CSV\u5909\u63DB:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n){return I.delimiter=",",Se(n)}},\u8868TSV\u5909\u63DB:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n){return I.delimiter=" ",Se(n)}}},Ue=Vt;var We={meta:{type:"const",value:{pluginName:"plugin_promise",description:"promise\u95A2\u9023\u306E\u547D\u4EE4\u3092\u63D0\u4F9B\u3059\u308B\u30D7\u30E9\u30B0\u30A4\u30F3",pluginVersion:"3.6.0",nakoRuntime:["wnako","cnako"],nakoVersion:"^3.6.0"}},\u521D\u671F\u5316:{type:"func",josi:[],pure:!0,fn:function(n){n.__promise==null&&(n.__promise={setLastPromise:function(e){return n.__setSysVar("\u305D",e),e}})}},\u305D:{type:"const",value:""},\u52D5\u6642:{type:"func",josi:[["\u3092","\u3067"]],pure:!0,fn:function(n,e){return e.__promise.setLastPromise(new Promise((t,r)=>n(t,r)))},return_none:!1},\u6210\u529F\u6642:{type:"func",josi:[["\u3092"],["\u306E","\u304C","\u306B"]],pure:!0,fn:function(n,e,t){return t.__promise.setLastPromise(e.then(r=>(t.__setSysVar("\u5BFE\u8C61",r),n(r))))},return_none:!1},\u51E6\u7406\u6642:{type:"func",josi:[["\u3092"],["\u306E","\u304C","\u306B"]],pure:!0,fn:function(n,e,t){return t.__promise.setLastPromise(e.then(r=>(t.__setSysVar("\u5BFE\u8C61",r),n(!0,r,t)),r=>(t.__setSysVar("\u5BFE\u8C61",r),n(!1,r,t))))},return_none:!1},\u5931\u6557\u6642:{type:"func",josi:[["\u3092"],["\u306E","\u304C","\u306B"]],pure:!0,fn:function(n,e,t){return t.__promise.setLastPromise(e.catch(r=>(t.__setSysVar("\u5BFE\u8C61",r),n(r))))},return_none:!1},\u7D42\u4E86\u6642:{type:"func",josi:[["\u3092"],["\u306E","\u304C","\u306B"]],pure:!0,fn:function(n,e,t){return t.__promise.setLastPromise(e.finally(()=>n()))},return_none:!1},\u675F:{type:"func",josi:[["\u3068","\u3092"]],pure:!0,fn:function(...n){return n.pop().__promise.setLastPromise(Promise.all(n))},return_none:!1}};var qe={meta:{type:"const",value:{pluginName:"plugin_test",description:"\u30C6\u30B9\u30C8\u3092\u63D0\u4F9B\u3059\u308B\u30D7\u30E9\u30B0\u30A4\u30F3",pluginVersion:"3.6.0",nakoRuntime:["wnako","cnako","phpnako"],nakoVersion:"^3.6.0"}},\u521D\u671F\u5316:{type:"func",josi:[],pure:!0,fn:function(){}},ASSERT\u7B49:{type:"func",josi:[["\u3068"],["\u304C"]],pure:!0,fn:function(n,e){if(n!==e)throw new Error(`\u4E0D\u4E00\u81F4 [\u5B9F\u969B]${n} [\u671F\u5F85]${e}`);return!0}},\u30C6\u30B9\u30C8\u5B9F\u884C:{type:"func",josi:[["\u3068"],["\u3067"]],pure:!1,fn:function(n,e,t){t.__exec("ASSERT\u7B49",[n,e,t])}},\u30C6\u30B9\u30C8\u7B49:{type:"func",josi:[["\u3068"],["\u304C"]],pure:!1,fn:function(n,e,t){t.__exec("ASSERT\u7B49",[n,e,t])}}};var je=n=>JSON.parse(JSON.stringify(n)),ze=600;function L(n={}){return typeof n!="object"&&(n={}),n.testOnly=n.testOnly||!1,n.resetEnv=n.resetEnv||!1,n.resetAll=n.resetAll||!1,n.preCode=n.preCode||"",n.nakoGlobal=n.nakoGlobal||null,n}var fe=class n{constructor(e=void 0){e===void 0&&(e={useBasicPlugin:!0}),this.__varslist=[this.newVaiables(),this.newVaiables(),this.newVaiables()],this.__locals=this.newVaiables(),this.__self=this,this.__vars=this.__varslist[2],this.__v1=this.__varslist[1],this.__v0=this.__varslist[0],this.version=ve.version,this.coreVersion=ve.version,this.__globals=[],this.__globalObj=null,this.__module={},this.pluginFunclist={},this.funclist=this.newVaiables(),this.moduleExport=this.newVaiables(),this.pluginfiles={},this.commandlist=new Set,this.nakoFuncList=this.newVaiables(),this.eventList=[],this.codeGenerateor={},this.debugOption={useDebug:!1,waitTime:0},this.logger=new H,this.filename="main.nako3",this.dependencies={},this.usedFuncs=new Set,this.numFailures=0,e.useBasicPlugin&&this.addBasicPlugins(),this.prepare=re.getInstance(),this.parser=new ne(this.logger),this.lexer=new F(this.logger),this.lexer.setFuncList(this.funclist),this.lexer.setModuleExport(this.moduleExport),this.reservedWords=JSON.parse(JSON.stringify(this.lexer.reservedWords)),this.josiList=JSON.parse(JSON.stringify(this.lexer.josiList))}getModList(){return this.lexer.modList}getLogger(){return this.logger}getNakoFuncList(){return this.nakoFuncList}getNakoFunc(e){return this.nakoFuncList.get(e)}getPluginfiles(){return this.pluginfiles}addBasicPlugins(){this.addPlugin(Ge),this.addPlugin(Be),this.addPlugin(We),this.addPlugin(qe),this.addPlugin(Ue)}replaceLogger(){return this.lexer.logger=this.parser.logger=this.logger=new H}static listRequireStatements(e){let t=[];for(let r=0;r+2<e.length;r++){if(!(e[r].type==="not"&&(e[r+1].type==="string"||e[r+1].type==="string_ex")&&e[r+2].value==="\u53D6\u8FBC"))continue;let s=e[r+1].value+"";if(s.startsWith("\u8CAF\u8535\u5EAB:")&&(s=`https://n3s.nadesi.com/plain/${s.substring(4)}`),s.startsWith("\u62E1\u5F35\u30D7\u30E9\u30B0\u30A4\u30F3:")){let o=s.split(":")[1].match(/^([a-zA-Z0-9_-]+)\.(js|mjs|nako3)(@[0-9.]+)?$/);if(o){let u=o[1],c=o[2],a=o[3]||"@latest";c==="js"||c==="mjs"?(u.startsWith("nadesiko3-")||(u=`nadesiko3-${u}`),s=`https://cdn.jsdelivr.net/npm/${u}${a}/${u}.${c}`):s=`https://n3s.nadesi.com/plain/${u}.${c}`}else throw new q("\u300E\u53D6\u8FBC\u300F\u306E\u6307\u5B9A\u30A8\u30E9\u30FC\u3002\u300E\u62E1\u5F35\u30D7\u30E9\u30B0\u30A4\u30F3:(\u30D5\u30A1\u30A4\u30EB\u540D).(js|nako3)(@ver)\u300F\u306E\u66F8\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",e[r].file,e[r].line)}t.push({...e[r],start:r,end:r+3,value:s,firstToken:e[r],lastToken:e[r+2]}),r+=2}return t}_loadDependencies(e,t,r,s){let i={},o=new n({useBasicPlugin:!0}),u=(f,l)=>{let h=s.readJs(f.filePath,f.firstToken);l.push(h.task.then(p=>{let _=p();this.addPluginFile(f.value,f.filePath,_,!1),i[f.filePath].funclist=_,i[f.filePath].moduleExport={},i[f.filePath].addPluginFile=()=>{this.addPluginFile(f.value,f.filePath,_,!1)}}))},c=(f,l)=>{let h=s.readNako3(f.filePath,f.firstToken),p=_=>{let g=F.filenameToModName(f.filePath);_=`\u300E${g}\u300F\u306B\u540D\u524D\u7A7A\u9593\u8A2D\u5B9A;\u300E${g}\u300F\u306B\u30D7\u30E9\u30B0\u30A4\u30F3\u540D\u8A2D\u5B9A;`+_+";\u540D\u524D\u7A7A\u9593\u30DD\u30C3\u30D7;";let m=this.rawtokenize(_,0,f.filePath);i[f.filePath].tokens=m;let b=new Map,y=new Map;return F.preDefineFunc(je(m),this.logger,b,y),i[f.filePath].funclist=b,i[f.filePath].moduleExport=y,a(_,f.filePath,"")};l.push(h.task.then(_=>p(_)))},a=(f,l,h)=>{let p=[],g=n.listRequireStatements(o.rawtokenize(f,0,l,h)).map(m=>({...m,...s.resolvePath(m.value,m.firstToken,l)}));for(let m of g){if(i.hasOwnProperty(m.filePath)){i[m.filePath].alias.add(m.value);continue}if(i[m.filePath]={tokens:[],alias:new Set([m.value]),addPluginFile:()=>{},funclist:{},moduleExport:{}},m.type==="js"||m.type==="mjs")u(m,p);else if(m.type==="nako3")c(m,p);else throw new q(`\u30D5\u30A1\u30A4\u30EB\u300E${m.value}\u300F\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3002\u30D5\u30A1\u30A4\u30EB\u304C\u5B58\u5728\u3057\u306A\u3044\u304B\u672A\u5BFE\u5FDC\u306E\u62E1\u5F35\u5B50\u3067\u3059\u3002`,m.firstToken.file,m.firstToken.line)}if(p.length>0)return Promise.all(p)};try{let f=a(e,t,r);return f!==void 0&&f.catch(l=>{this.logger.error(l.msg),this.numFailures++}),this.dependencies=i,f}catch(f){throw this.logger.error(""+f),f}}rawtokenize(e,t,r,s=""){if(!e.startsWith(s))throw new Error("code\u306E\u5148\u982D\u306B\u306FpreCode\u3092\u542B\u3081\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002");let i=F.filenameToModName(r),o=this.getModList();o.indexOf(i)<0&&o.unshift(i);let u=this.prepare.convert(e),c=new oe(e.length,u),a=new ue(e,[],[]),f=new ce(e),l;try{l=this.lexer.tokenize(u.map(h=>h.text).join(""),t,r)}catch(h){if(!(h instanceof M))throw h;let p=a.map(c.map(h.preprocessedCodeStartOffset),c.map(h.preprocessedCodeEndOffset)),_=p.startOffset===null?h.line:f.map(p.startOffset,!1).line,g=be({...p,line:_},s);throw new P(h.msg,g.startOffset,g.endOffset,g.line,r)}return l=Re(l),l=Je(l),l=Le(l),l=Te(l),l=l.map(h=>{let p=a.map(c.map(h.preprocessedCodeOffset||0),c.map((h.preprocessedCodeOffset||0)+(h.preprocessedCodeLength||0))),_=h.line,g=0;if(h.type==="eol"&&p.endOffset!==null){let m=f.map(p.endOffset,!1);_=m.line,g=m.column}else if(p.startOffset!==null){let m=f.map(p.startOffset,!1);_=m.line,g=m.column}return{...h,...be({line:_,column:g,startOffset:p.startOffset,endOffset:p.endOffset},s),rawJosi:h.josi}}),l}converttoken(e,t,r){return this.lexer.replaceTokens(e,t,r)}reset(e=void 0){(!e||e.needToClearPlugin)&&this.clearPlugins(),this.__varslist=[this.__varslist[0],this.newVaiables(),this.newVaiables()],this.__v0=this.__varslist[0],this.__v1=this.__varslist[1],this.__vars=this.__varslist[2],this.__locals=this.newVaiables(),this.funclist=new Map;for(let t of this.__v0.keys()){let r=this.pluginFunclist[t];r&&this.funclist.set(t,JSON.parse(JSON.stringify(r)))}this.lexer.setFuncList(this.funclist),this.moduleExport=new Map,this.lexer.setModuleExport(this.moduleExport),this.logger.clear()}lexCodeToken(e,t,r,s){let i=this.rawtokenize(e,t,r,"");if(s===null)for(let u of i)u.startOffset=void 0,u.endOffset=void 0;else for(let u of i)u.startOffset!==void 0&&(u.startOffset+=s),u.endOffset!==void 0&&(u.endOffset+=s);let o=i.filter(u=>u.type==="line_comment"||u.type==="range_comment").map(u=>({...u}));return i=this.converttoken(i,!1,r),{tokens:i,commentTokens:o}}replaceRequireStatements(e,t=new Set){let r=[];for(let s of n.listRequireStatements(e).reverse()){if(t.has(s.value)){r.push(...e.splice(s.start||0,(s.end||0)-(s.start||0)));continue}let i=Object.keys(this.dependencies).find(u=>this.dependencies[u].alias.has(s.value));if(i===void 0)throw s.firstToken?new P(`\u30D5\u30A1\u30A4\u30EB\u300E${s.value}\u300F\u304C\u8AAD\u307F\u8FBC\u307E\u308C\u3066\u3044\u307E\u305B\u3093\u3002`,s.firstToken.startOffset||0,s.firstToken.endOffset||0,s.firstToken.line,s.firstToken.file):new Error(`\u30D5\u30A1\u30A4\u30EB\u300E${s.value}\u300F\u304C\u8AAD\u307F\u8FBC\u307E\u308C\u3066\u3044\u307E\u305B\u3093\u3002`);this.dependencies[i].addPluginFile();let o=je(this.dependencies[i].tokens);t.add(s.value),r.push(...this.replaceRequireStatements(o,t)),r.push(...e.splice(s.start||0,(s.end||0)-(s.start||0),...o))}return r}removeRequireStatements(e){let t=[];for(let r of n.listRequireStatements(e).reverse()){let s=Object.keys(this.dependencies).find(i=>this.dependencies[i].alias.has(r.value));s!==void 0&&this.dependencies[s].addPluginFile(),t.push(...e.splice(r.start||0,(r.end||0)-(r.start||0)))}return t}lex(e,t="main.nako3",r="",s=!1){let i=this.rawtokenize(e,0,t,r),o=s?this.removeRequireStatements(i):this.replaceRequireStatements(i,void 0);for(let c of o)(c.type==="word"||c.type==="not")&&(c.type="require");if(o.length>=3)for(let c=0;c<o.length;c+=3){let a=o[c+1].value;a=F.filenameToModName(a),this.lexer.modList.indexOf(a)<0&&this.lexer.modList.push(a)}let u=i.filter(c=>c.type==="line_comment"||c.type==="range_comment").map(c=>({...c}));i=this.converttoken(i,!0,t);for(let c=0;c<i.length;c++)if(i[c]&&i[c].type==="code"){let a=this.lexCodeToken(i[c].value,i[c].line,t,i[c].startOffset||0);u.push(...a.commentTokens),i.splice(c,1,...a.tokens),c--}return this.logger.trace(`--- lex ---
|
|
433
|
+
`)>=0||e.indexOf("\r")>=0)&&(t=!0),e.indexOf(n)>=0&&(t=!0),e.indexOf('"')>=0&&(t=!0,e=e.replace(/"/g,'""')),t&&(e='"'+e+'"'),e}}var Vt={meta:{type:"const",value:{pluginName:"plugin_csv",description:"CSV\u95A2\u9023\u306E\u547D\u4EE4\u3092\u63D0\u4F9B\u3059\u308B\u30D7\u30E9\u30B0\u30A4\u30F3",pluginVersion:"3.6.0",nakoRuntime:["wnako","cnako","phpnako"],nakoVersion:"3.6.0"}},\u521D\u671F\u5316:{type:"func",josi:[],pure:!0,fn:function(){}},CSV\u53D6\u5F97:{type:"func",josi:[["\u3092","\u306E","\u3067"]],pure:!0,fn:function(n){return I.delimiter=",",we(n)}},TSV\u53D6\u5F97:{type:"func",josi:[["\u3092","\u306E","\u3067"]],pure:!0,fn:function(n){return I.delimiter=" ",we(n)}},\u8868CSV\u5909\u63DB:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n){return I.delimiter=",",Se(n)}},\u8868TSV\u5909\u63DB:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n){return I.delimiter=" ",Se(n)}}},Ue=Vt;var We={meta:{type:"const",value:{pluginName:"plugin_promise",description:"promise\u95A2\u9023\u306E\u547D\u4EE4\u3092\u63D0\u4F9B\u3059\u308B\u30D7\u30E9\u30B0\u30A4\u30F3",pluginVersion:"3.6.0",nakoRuntime:["wnako","cnako"],nakoVersion:"^3.6.0"}},\u521D\u671F\u5316:{type:"func",josi:[],pure:!0,fn:function(n){n.__promise==null&&(n.__promise={setLastPromise:function(e){return n.__setSysVar("\u305D",e),e}})}},\u305D:{type:"const",value:""},\u52D5\u6642:{type:"func",josi:[["\u3092","\u3067"]],pure:!0,fn:function(n,e){return e.__promise.setLastPromise(new Promise((t,r)=>n(t,r)))},return_none:!1},\u6210\u529F\u6642:{type:"func",josi:[["\u3092"],["\u306E","\u304C","\u306B"]],pure:!0,fn:function(n,e,t){return t.__promise.setLastPromise(e.then(r=>(t.__setSysVar("\u5BFE\u8C61",r),n(r))))},return_none:!1},\u51E6\u7406\u6642:{type:"func",josi:[["\u3092"],["\u306E","\u304C","\u306B"]],pure:!0,fn:function(n,e,t){return t.__promise.setLastPromise(e.then(r=>(t.__setSysVar("\u5BFE\u8C61",r),n(!0,r,t)),r=>(t.__setSysVar("\u5BFE\u8C61",r),n(!1,r,t))))},return_none:!1},\u5931\u6557\u6642:{type:"func",josi:[["\u3092"],["\u306E","\u304C","\u306B"]],pure:!0,fn:function(n,e,t){return t.__promise.setLastPromise(e.catch(r=>(t.__setSysVar("\u5BFE\u8C61",r),n(r))))},return_none:!1},\u7D42\u4E86\u6642:{type:"func",josi:[["\u3092"],["\u306E","\u304C","\u306B"]],pure:!0,fn:function(n,e,t){return t.__promise.setLastPromise(e.finally(()=>n()))},return_none:!1},\u675F:{type:"func",josi:[["\u3068","\u3092"]],pure:!0,fn:function(...n){return n.pop().__promise.setLastPromise(Promise.all(n))},return_none:!1}};var qe={meta:{type:"const",value:{pluginName:"plugin_test",description:"\u30C6\u30B9\u30C8\u3092\u63D0\u4F9B\u3059\u308B\u30D7\u30E9\u30B0\u30A4\u30F3",pluginVersion:"3.6.0",nakoRuntime:["wnako","cnako","phpnako"],nakoVersion:"^3.6.0"}},\u521D\u671F\u5316:{type:"func",josi:[],pure:!0,fn:function(){}},ASSERT\u7B49:{type:"func",josi:[["\u3068"],["\u304C"]],pure:!0,fn:function(n,e){if(n!==e)throw new Error(`\u4E0D\u4E00\u81F4 [\u5B9F\u969B]${n} [\u671F\u5F85]${e}`);return!0}},\u30C6\u30B9\u30C8\u5B9F\u884C:{type:"func",josi:[["\u3068"],["\u3067"]],pure:!1,fn:function(n,e,t){t.__exec("ASSERT\u7B49",[n,e,t])}},\u30C6\u30B9\u30C8\u7B49:{type:"func",josi:[["\u3068"],["\u304C"]],pure:!1,fn:function(n,e,t){t.__exec("ASSERT\u7B49",[n,e,t])}}};var je=n=>JSON.parse(JSON.stringify(n)),ze=600;function L(n={}){return typeof n!="object"&&(n={}),n.testOnly=n.testOnly||!1,n.resetEnv=n.resetEnv||!1,n.resetAll=n.resetAll||!1,n.preCode=n.preCode||"",n.nakoGlobal=n.nakoGlobal||null,n}var fe=class n{constructor(e=void 0){e===void 0&&(e={useBasicPlugin:!0}),this.__varslist=[this.newVaiables(),this.newVaiables(),this.newVaiables()],this.__locals=this.newVaiables(),this.__self=this,this.__vars=this.__varslist[2],this.__v1=this.__varslist[1],this.__v0=this.__varslist[0],this.version=ve.version,this.coreVersion=ve.version,this.__globals=[],this.__globalObj=null,this.__module={},this.pluginFunclist={},this.funclist=this.newVaiables(),this.moduleExport=this.newVaiables(),this.pluginfiles={},this.commandlist=new Set,this.nakoFuncList=this.newVaiables(),this.eventList=[],this.codeGenerateor={},this.debugOption={useDebug:!1,waitTime:0},this.logger=new H,this.filename="main.nako3",this.dependencies={},this.usedFuncs=new Set,this.numFailures=0,e.useBasicPlugin&&this.addBasicPlugins(),this.prepare=re.getInstance(),this.parser=new ne(this.logger),this.lexer=new F(this.logger),this.lexer.setFuncList(this.funclist),this.lexer.setModuleExport(this.moduleExport),this.reservedWords=JSON.parse(JSON.stringify(this.lexer.reservedWords)),this.josiList=JSON.parse(JSON.stringify(this.lexer.josiList))}getModList(){return this.lexer.modList}getLogger(){return this.logger}getNakoFuncList(){return this.nakoFuncList}getNakoFunc(e){return this.nakoFuncList.get(e)}getPluginfiles(){return this.pluginfiles}addBasicPlugins(){this.addPlugin(Ge),this.addPlugin(Be),this.addPlugin(We),this.addPlugin(qe),this.addPlugin(Ue)}replaceLogger(){return this.lexer.logger=this.parser.logger=this.logger=new H}static listRequireStatements(e){let t=[];for(let r=0;r+2<e.length;r++){if(!(e[r].type==="not"&&(e[r+1].type==="string"||e[r+1].type==="string_ex")&&e[r+2].value==="\u53D6\u8FBC"))continue;let s=e[r+1].value+"";if(s.startsWith("\u8CAF\u8535\u5EAB:")&&(s=`https://n3s.nadesi.com/plain/${s.substring(4)}`),s.startsWith("\u62E1\u5F35\u30D7\u30E9\u30B0\u30A4\u30F3:")){let o=s.split(":")[1].match(/^([a-zA-Z0-9_-]+)\.(js|mjs|nako3)(@[0-9.]+)?$/);if(o){let u=o[1],c=o[2],a=o[3]||"@latest";c==="js"||c==="mjs"?(u.startsWith("nadesiko3-")||(u=`nadesiko3-${u}`),s=`https://cdn.jsdelivr.net/npm/${u}${a}/${u}.${c}`):s=`https://n3s.nadesi.com/plain/${u}.${c}`}else throw new q("\u300E\u53D6\u8FBC\u300F\u306E\u6307\u5B9A\u30A8\u30E9\u30FC\u3002\u300E\u62E1\u5F35\u30D7\u30E9\u30B0\u30A4\u30F3:(\u30D5\u30A1\u30A4\u30EB\u540D).(js|nako3)(@ver)\u300F\u306E\u66F8\u5F0F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",e[r].file,e[r].line)}t.push({...e[r],start:r,end:r+3,value:s,firstToken:e[r],lastToken:e[r+2]}),r+=2}return t}_loadDependencies(e,t,r,s){let i={},o=new n({useBasicPlugin:!0}),u=(f,l)=>{let h=s.readJs(f.filePath,f.firstToken);l.push(h.task.then(p=>{let _=p();this.addPluginFile(f.value,f.filePath,_,!1),i[f.filePath].funclist=_,i[f.filePath].moduleExport={},i[f.filePath].addPluginFile=()=>{this.addPluginFile(f.value,f.filePath,_,!1)}}))},c=(f,l)=>{let h=s.readNako3(f.filePath,f.firstToken),p=_=>{let m=F.filenameToModName(f.filePath);_=`\u300E${m}\u300F\u306B\u540D\u524D\u7A7A\u9593\u8A2D\u5B9A;\u300E${m}\u300F\u306B\u30D7\u30E9\u30B0\u30A4\u30F3\u540D\u8A2D\u5B9A;`+_+";\u540D\u524D\u7A7A\u9593\u30DD\u30C3\u30D7;";let g=this.rawtokenize(_,0,f.filePath);i[f.filePath].tokens=g;let k=new Map,y=new Map;return F.preDefineFunc(je(g),this.logger,k,y),i[f.filePath].funclist=k,i[f.filePath].moduleExport=y,a(_,f.filePath,"")};l.push(h.task.then(_=>p(_)))},a=(f,l,h)=>{let p=[],m=n.listRequireStatements(o.rawtokenize(f,0,l,h)).map(g=>({...g,...s.resolvePath(g.value,g.firstToken,l)}));for(let g of m){if(i.hasOwnProperty(g.filePath)){i[g.filePath].alias.add(g.value);continue}if(i[g.filePath]={tokens:[],alias:new Set([g.value]),addPluginFile:()=>{},funclist:{},moduleExport:{}},g.type==="js"||g.type==="mjs")u(g,p);else if(g.type==="nako3")c(g,p);else throw new q(`\u30D5\u30A1\u30A4\u30EB\u300E${g.value}\u300F\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3002\u30D5\u30A1\u30A4\u30EB\u304C\u5B58\u5728\u3057\u306A\u3044\u304B\u672A\u5BFE\u5FDC\u306E\u62E1\u5F35\u5B50\u3067\u3059\u3002`,g.firstToken.file,g.firstToken.line)}if(p.length>0)return Promise.all(p)};try{let f=a(e,t,r);return f!==void 0&&f.catch(l=>{this.logger.error(l.msg),this.numFailures++}),this.dependencies=i,f}catch(f){throw this.logger.error(""+f),f}}rawtokenize(e,t,r,s=""){if(!e.startsWith(s))throw new Error("code\u306E\u5148\u982D\u306B\u306FpreCode\u3092\u542B\u3081\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002");let i=F.filenameToModName(r),o=this.getModList();o.indexOf(i)<0&&o.unshift(i);let u=this.prepare.convert(e),c=new oe(e.length,u),a=new ue(e,[],[]),f=new ce(e),l;try{l=this.lexer.tokenize(u.map(h=>h.text).join(""),t,r)}catch(h){if(!(h instanceof M))throw h;let p=a.map(c.map(h.preprocessedCodeStartOffset),c.map(h.preprocessedCodeEndOffset)),_=p.startOffset===null?h.line:f.map(p.startOffset,!1).line,m=be({...p,line:_},s);throw new P(h.msg,m.startOffset,m.endOffset,m.line,r)}return l=Re(l),l=Je(l),l=Le(l),l=Te(l),l=l.map(h=>{let p=a.map(c.map(h.preprocessedCodeOffset||0),c.map((h.preprocessedCodeOffset||0)+(h.preprocessedCodeLength||0))),_=h.line,m=0;if(h.type==="eol"&&p.endOffset!==null){let g=f.map(p.endOffset,!1);_=g.line,m=g.column}else if(p.startOffset!==null){let g=f.map(p.startOffset,!1);_=g.line,m=g.column}return{...h,...be({line:_,column:m,startOffset:p.startOffset,endOffset:p.endOffset},s),rawJosi:h.josi}}),l}converttoken(e,t,r){return this.lexer.replaceTokens(e,t,r)}reset(e=void 0){(!e||e.needToClearPlugin)&&this.clearPlugins(),this.__varslist=[this.__varslist[0],this.newVaiables(),this.newVaiables()],this.__v0=this.__varslist[0],this.__v1=this.__varslist[1],this.__vars=this.__varslist[2],this.__locals=this.newVaiables(),this.funclist=new Map;for(let t of this.__v0.keys()){let r=this.pluginFunclist[t];r&&this.funclist.set(t,JSON.parse(JSON.stringify(r)))}this.lexer.setFuncList(this.funclist),this.moduleExport=new Map,this.lexer.setModuleExport(this.moduleExport),this.logger.clear()}lexCodeToken(e,t,r,s){let i=this.rawtokenize(e,t,r,"");if(s===null)for(let u of i)u.startOffset=void 0,u.endOffset=void 0;else for(let u of i)u.startOffset!==void 0&&(u.startOffset+=s),u.endOffset!==void 0&&(u.endOffset+=s);let o=i.filter(u=>u.type==="line_comment"||u.type==="range_comment").map(u=>({...u}));return i=this.converttoken(i,!1,r),{tokens:i,commentTokens:o}}replaceRequireStatements(e,t=new Set){let r=[];for(let s of n.listRequireStatements(e).reverse()){if(t.has(s.value)){r.push(...e.splice(s.start||0,(s.end||0)-(s.start||0)));continue}let i=Object.keys(this.dependencies).find(u=>this.dependencies[u].alias.has(s.value));if(i===void 0)throw s.firstToken?new P(`\u30D5\u30A1\u30A4\u30EB\u300E${s.value}\u300F\u304C\u8AAD\u307F\u8FBC\u307E\u308C\u3066\u3044\u307E\u305B\u3093\u3002`,s.firstToken.startOffset||0,s.firstToken.endOffset||0,s.firstToken.line,s.firstToken.file):new Error(`\u30D5\u30A1\u30A4\u30EB\u300E${s.value}\u300F\u304C\u8AAD\u307F\u8FBC\u307E\u308C\u3066\u3044\u307E\u305B\u3093\u3002`);this.dependencies[i].addPluginFile();let o=je(this.dependencies[i].tokens);t.add(s.value),r.push(...this.replaceRequireStatements(o,t)),r.push(...e.splice(s.start||0,(s.end||0)-(s.start||0),...o))}return r}removeRequireStatements(e){let t=[];for(let r of n.listRequireStatements(e).reverse()){let s=Object.keys(this.dependencies).find(i=>this.dependencies[i].alias.has(r.value));s!==void 0&&this.dependencies[s].addPluginFile(),t.push(...e.splice(r.start||0,(r.end||0)-(r.start||0)))}return t}lex(e,t="main.nako3",r="",s=!1){let i=this.rawtokenize(e,0,t,r),o=s?this.removeRequireStatements(i):this.replaceRequireStatements(i,void 0);for(let c of o)(c.type==="word"||c.type==="not")&&(c.type="require");if(o.length>=3)for(let c=0;c<o.length;c+=3){let a=o[c+1].value;a=F.filenameToModName(a),this.lexer.modList.indexOf(a)<0&&this.lexer.modList.push(a)}let u=i.filter(c=>c.type==="line_comment"||c.type==="range_comment").map(c=>({...c}));i=this.converttoken(i,!0,t);for(let c=0;c<i.length;c++)if(i[c]&&i[c].type==="code"){let a=this.lexCodeToken(i[c].value,i[c].line,t,i[c].startOffset||0);u.push(...a.commentTokens),i.splice(c,1,...a.tokens),c--}return this.logger.trace(`--- lex ---
|
|
433
434
|
`+JSON.stringify(i,null,2)),{commentTokens:u,tokens:i,requireTokens:o}}parse(e,t,r=""){this.lexer.setFuncList(this.funclist),this.parser.setFuncList(this.funclist),this.lexer.setModuleExport(this.moduleExport),this.parser.setModuleExport(this.moduleExport);let s=this.lex(e,t,r),i;try{this.parser.genMode="sync",i=this.parser.parse(s.tokens,t)}catch(o){throw typeof o.startOffset!="number"?d.fromNode(o.message,s.tokens[this.parser.getIndex()]):o}return this.usedFuncs=this.parser.usedFuncs,this.deleteUnNakoFuncs(),this.logger.trace(`--- ast ---
|
|
434
435
|
`+JSON.stringify(i,null,2)),i}getUsedFuncs(e){return this.usedFuncs=new Set,this._getUsedFuncs(e),this.deleteUnNakoFuncs()}_getUsedFuncs(e){if(e){if((e.type==="func"||e.type==="func_pointer")&&e.name)this.usedFuncs.add(e.name);else if(e.blocks)for(let t of e.blocks)this._getUsedFuncs(t)}}deleteUnNakoFuncs(){for(let e of this.usedFuncs)this.commandlist.has(e)||this.usedFuncs.delete(e);return this.usedFuncs}compile(e,t,r=!1,s=""){let i=L();return i.testOnly=r,i.preCode=s,this.compileFromCode(e,t,i).runtimeEnv}compileFromCode(e,t,r=void 0){t===""&&(t="main.nako3"),r===void 0&&(r=L());try{r.resetEnv&&this.reset(),r.resetAll&&this.clearPlugins(),this.eventList.filter(o=>o.eventName==="beforeParse").map(o=>o.callback(e));let s=this.parse(e,t,r.preCode);this.eventList.filter(o=>o.eventName==="beforeGenerate").map(o=>o.callback(s));let i=this.generateCode(s,new X(r.testOnly));return this.eventList.filter(o=>o.eventName==="afterGenerate").map(o=>o.callback(i)),i}catch(s){throw this.logger.error(s),s}}generateCode(e,t){let r=e.genMode||"";if(r==="sync")return Ce(this,e,t);r==="\u975E\u540C\u671F\u30E2\u30FC\u30C9"&&this.logger.error("\u300E!\u975E\u540C\u671F\u30E2\u30FC\u30C9\u300F\u306F\u5EC3\u6B62\u3055\u308C\u307E\u3057\u305F\u3002[\u8A73\u7D30](https://github.com/kujirahand/nadesiko3/issues/1164)");let s=this.codeGenerateor[r];if(!s)throw new Error(`\u30B3\u30FC\u30C9\u30B8\u30A7\u30CD\u30EC\u30FC\u30BF\u306E\u300C${r}\u300D\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002`);return s.generate(this,e,t.isTest)}addCodeGenerator(e,t){this.codeGenerateor[e]=t}async _run(e,t,r,s,i=""){let o=L({resetEnv:r,resetAll:r,testOnly:s,preCode:i});return this._runEx(e,t,o)}clearPlugins(){this.__globals.forEach(e=>{e.__setSysVar("__forceClose",!0),e.reset()}),this.__globals=[]}evalJS(e,t){this.__globalObj=t,this.__globalObj.lastJSCode=e,this.eventList.filter(r=>r.eventName==="beforeRun").map(r=>r.callback(t));try{new Function(t.lastJSCode).apply(t)}catch(r){throw t.numFailures++,this.getLogger().error(r),r}this.eventList.filter(r=>r.eventName==="finish").map(r=>r.callback(t))}runSync(e,t,r=void 0){r=L(r);let s=this.compileFromCode(e,t,r),i=this.getNakoGlobal(r,s.gen,t);return this.evalJS(s.runtimeEnv,i),i}async runAsync(e,t,r=void 0){r=L(r);let s=this.compileFromCode(e,t,r),i=this.getNakoGlobal(r,s.gen,t);return this.evalJS(s.runtimeEnv,i),i}getNakoGlobal(e,t,r){let s=e.nakoGlobal;return s||(this.__globals.length>0&&e.resetAll===!1&&e.resetEnv===!1?s=this.__globals[this.__globals.length-1]:s=new ae(this,t,this.__globals.length+1),s.__varslist[0].set("\u540D\u524D\u7A7A\u9593",F.filenameToModName(r))),this.__globals.indexOf(s)<0&&this.__globals.push(s),s}addListener(e,t){this.eventList.push({eventName:e,callback:t})}test(e,t,r="",s=!1){let i=L();return i.preCode=r,i.testOnly=s,this.runSync(e,t,i)}run(e,t="main.nako3",r=""){let s=L();return s.preCode=r,this.runSync(e,t,s)}compileStandalone(e,t,r){r===void 0&&(r=new X);let s=this.parse(e,t);return this.generateCode(s,r).standalone}addPlugin(e,t=!0,r=""){let s=this.__varslist[0],i=s.get("__pluginInfo");i||(i={},s.set("__pluginInfo",i));let o=0,u="unknown",c={pluginName:"unknown",nakoVersionResult:!0,nakoVersion:"0.0.0",path:""};if(e.meta&&e.meta.value&&typeof e.meta=="object"){c=e.meta.value||{pluginName:"unknown",nakoVersion:"0.0.0"},u=c.pluginName||"unknown";let h=((c.nakoVersion||"0.0.0")+".0.0").split(".").map(p=>parseInt(p));o=h[1]*100+h[2],c.path=r}if(u==="unknown"&&(u=Object.keys(e).join("-")),i[u]!==void 0)return;if(u=(f=>f.replace(/[^a-zA-z0-9\-_\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FAF\u3400-\u4DBF\uF900-\uFAFF]/g,"_"))(u),i[u]=c,ze>o){let f=Object.keys(e).join(",");if(u==="unknown"&&(u=f.substring(0,30)+"..."),u!==""){let l=`\u306A\u3067\u3057\u3053\u30D7\u30E9\u30B0\u30A4\u30F3\u300E${u}\u300F\u306F\u53E4\u3044\u5F62\u5F0F\u306A\u306E\u3067\u6B63\u3057\u304F\u52D5\u4F5C\u3057\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002(\u30E9\u30F3\u30BF\u30A4\u30E0\u306E\u8981\u6C42: ${ze}/\u30D7\u30E9\u30B0\u30A4\u30F3: ${o})`;console.warn(l,"see","https://github.com/kujirahand/nadesiko3/issues/1647"),this.logger.warn(l),c.nakoVersionResult=!1}}if(this.__module[u]=e,this.pluginfiles[u]="*",typeof e.\u521D\u671F\u5316=="object"){let f=e.\u521D\u671F\u5316;delete e.\u521D\u671F\u5316;let l=`!${u}:\u521D\u671F\u5316`;e[l]=f}for(let f in e){let l=e[f];if(this.funclist.set(f,l),t&&(this.pluginFunclist[f]=JSON.parse(JSON.stringify(l))),l.type==="func")s.set(f,l.fn),l.asyncFn&&(l.pure=!0);else if(l.type==="const"||l.type==="var")s.set(f,l.value);else throw console.error("[\u30D7\u30E9\u30B0\u30A4\u30F3\u8FFD\u52A0\u30A8\u30E9\u30FC]",l),new Error("\u30D7\u30E9\u30B0\u30A4\u30F3\u306E\u8FFD\u52A0\u3067\u30A8\u30E9\u30FC\u3002");f==="\u521D\u671F\u5316"||f.substring(0,1)==="!"||this.commandlist.add(f)}}addPluginObject(e,t,r=!0){t.meta===void 0&&(t.meta={type:"const",value:{pluginName:e,nakoVersion:"0.0.0"}}),this.addPlugin(t,r)}addPluginFile(e,t,r,s=!0){this.addPluginFromFile(t,r,s)}addPluginFromFile(e,t,r=!0){this.addPlugin(t,r,e)}addFunc(e,t,r,s=!0,i=!1){let o={josi:t,fn:r,type:"func",return_none:s,asyncFn:i,pure:!0};this.funclist.set(e,o),this.pluginFunclist[e]=je(o),this.__varslist[0].set(e,r)}setFunc(e,t,r,s=!0,i=!1){this.addFunc(e,t,r,s,i)}getFunc(e){return this.funclist.get(e)}_runEx(e,t,r,s="",i=void 0){return r.preCode=s,i&&(r.nakoGlobal=i),this.runSync(e,t,r)}runEx(e,t,r,s=""){return this._runEx(e,t,r,s)}async runReset(e,t="main.nako3",r=""){let s=L({resetAll:!0,resetEnv:!0});return this._runEx(e,t,s,r)}newVaiables(e){return new Map(e)}};var Xe={\u6C34\u8272:{type:"const",value:"aqua"},\u7D2B\u8272:{type:"const",value:"fuchsia"},\u7DD1\u8272:{type:"const",value:"lime"},\u9752\u8272:{type:"const",value:"blue"},\u8D64\u8272:{type:"const",value:"red"},\u9EC4\u8272:{type:"const",value:"yellow"},\u9ED2\u8272:{type:"const",value:"black"},\u767D\u8272:{type:"const",value:"white"},\u8336\u8272:{type:"const",value:"maroon"},\u7070\u8272:{type:"const",value:"gray"},\u91D1\u8272:{type:"const",value:"gold"},\u9EC4\u91D1\u8272:{type:"const",value:"gold"},\u9280\u8272:{type:"const",value:"silver"},\u767D\u91D1\u8272:{type:"const",value:"silver"},\u30AA\u30EA\u30FC\u30D6\u8272:{type:"const",value:"olive"},\u30D9\u30FC\u30B8\u30E5\u8272:{type:"const",value:"beige"},\u30A2\u30EA\u30B9\u30D6\u30EB\u30FC\u8272:{type:"const",value:"aliceblue"},RGB:{type:"func",josi:[["\u3068"],["\u3068"],["\u3067","\u306E"]],pure:!0,fn:function(n,e,t){let r=s=>{let i="00"+s.toString(16);return i.substr(i.length-2,2)};return"#"+r(n)+r(e)+r(t)},return_none:!1},\u8272\u6DF7:{type:"func",josi:[["\u306E"]],pure:!0,fn:function(n){let e=t=>{let r="00"+t.toString(16);return r.substr(r.length-2,2)};if(!n)throw new Error("\u300E\u8272\u6DF7\u305C\u308B\u300F\u306E\u5F15\u6570\u306B\u306F\u914D\u5217\u3092\u6307\u5B9A\u3057\u307E\u3059");if(n.length<3)throw new Error("\u300E\u8272\u6DF7\u305C\u308B\u300F\u306E\u5F15\u6570\u306B\u306F[RR,GG,BB]\u5F62\u5F0F\u306E\u914D\u5217\u3092\u6307\u5B9A\u3057\u307E\u3059");return"#"+e(n[0])+e(n[1])+e(n[2])},return_none:!1}};var Ye={HTTP\u53D6\u5F97:{type:"func",josi:[["\u306E","\u304B\u3089","\u3092"]],pure:!0,asyncFn:!0,fn:async function(n,e){return e.__exec("AJAX\u30C6\u30AD\u30B9\u30C8\u53D6\u5F97",[n,e])}},AJAX\u53D7\u4FE1:{type:"func",josi:[["\u304B\u3089","\u3092"]],pure:!0,asyncFn:!0,fn:async function(n,e){return e.__exec("AJAX\u30C6\u30AD\u30B9\u30C8\u53D6\u5F97",[n,e])}},AJAX\u53D7\u4FE1\u6642:{type:"func",josi:[["\u3067"],["\u304B\u3089","\u3092"]],pure:!0,fn:function(n,e,t){t.__exec("AJAX\u9001\u4FE1\u6642",[n,e,t])},return_none:!0},AJAX\u9001\u4FE1:{type:"func",josi:[["\u307E\u3067","\u3078","\u306B"]],pure:!0,asyncFn:!0,fn:async function(n,e){return e.__exec("AJAX\u30C6\u30AD\u30B9\u30C8\u53D6\u5F97",[n,e])}},AJAX\u9001\u4FE1\u6642:{type:"func",josi:[["\u306E"],["\u307E\u3067","\u3078","\u306B"]],pure:!0,fn:function(n,e,t){let r=t.__getSysVar("AJAX\u30AA\u30D7\u30B7\u30E7\u30F3");r===""&&(r={method:"GET"}),fetch(e,r).then(s=>s.status!==200?t.__getSysVar("AJAX:ONERROR")(s.status):s.text()).then(s=>{t.__setSysVar("\u5BFE\u8C61",s),n(s,t)}).catch(s=>{t.__getSysVar("AJAX:ONERROR")(s)})},return_none:!0},AJAX\u30AA\u30D7\u30B7\u30E7\u30F3:{type:"const",value:""},AJAX\u30AA\u30D7\u30B7\u30E7\u30F3\u8A2D\u5B9A:{type:"func",josi:[["\u306B","\u3078","\u3068"]],pure:!0,fn:function(n,e){e.__setSysVar("AJAX\u30AA\u30D7\u30B7\u30E7\u30F3",n)},return_none:!0},AJAX\u30AA\u30D7\u30B7\u30E7\u30F3POST\u8A2D\u5B9A:{type:"func",josi:[["\u3092","\u3067"]],pure:!0,fn:function(n,e){let t=e.__exec("POST\u30C7\u30FC\u30BF\u751F\u6210",[n,e]),r={method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t};e.__setSysVar("AJAX\u30AA\u30D7\u30B7\u30E7\u30F3",r)},return_none:!0},AJAX\u5931\u6557\u6642:{type:"func",josi:[["\u306E"]],pure:!0,fn:function(n,e){e.__setSysVar("AJAX:ONERROR",n)}},AJAX\u30C6\u30AD\u30B9\u30C8\u53D6\u5F97:{type:"func",josi:[["\u304B\u3089","\u3092"]],pure:!0,asyncFn:!0,fn:async function(n,e){let t=e.__getSysVar("AJAX\u30AA\u30D7\u30B7\u30E7\u30F3");return t===""&&(t={method:"GET"}),await(await fetch(n,t)).text()},return_none:!1},AJAX_JSON\u53D6\u5F97:{type:"func",josi:[["\u304B\u3089"]],pure:!0,asyncFn:!0,fn:async function(n,e){let t=e.__getSysVar("AJAX\u30AA\u30D7\u30B7\u30E7\u30F3");return t===""&&(t={method:"GET"}),await(await fetch(n,t)).json()},return_none:!1},AJAX\u30D0\u30A4\u30CA\u30EA\u53D6\u5F97:{type:"func",josi:[["\u304B\u3089"]],pure:!0,asyncFn:!0,fn:async function(n,e){let t=e.__getSysVar("AJAX\u30AA\u30D7\u30B7\u30E7\u30F3");return t===""&&(t={method:"GET"}),await(await fetch(n,t)).blob()},return_none:!1},GET\u9001\u4FE1\u6642:{type:"func",josi:[["\u306E"],["\u307E\u3067","\u3078","\u306B"]],pure:!0,fn:function(n,e,t){t.__exec("AJAX\u9001\u4FE1\u6642",[n,e,t])},return_none:!0},POST\u9001\u4FE1\u6642:{type:"func",josi:[["\u306E"],["\u307E\u3067","\u3078","\u306B"],["\u3092"]],pure:!0,fn:function(n,e,t,r){let s=r.__exec("POST\u30C7\u30FC\u30BF\u751F\u6210",[t,r]);fetch(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s}).then(o=>o.text()).then(o=>{r.__setSysVar("\u5BFE\u8C61",o),n(o)}).catch(o=>{r.__getSysVar("AJAX:ONERROR")(o)})}},POST\u30D5\u30A9\u30FC\u30E0\u9001\u4FE1\u6642:{type:"func",josi:[["\u306E"],["\u307E\u3067","\u3078","\u306B"],["\u3092"]],pure:!0,fn:function(n,e,t,r){let s=new FormData;for(let o in t)s.set(o,t[o]);fetch(e,{method:"POST",body:s}).then(o=>o.text()).then(o=>{r.__setSysVar("\u5BFE\u8C61",o),n(o)}).catch(o=>{r.__getSysVar("AJAX:ONERROR")(o)})}},POST\u30C7\u30FC\u30BF\u751F\u6210:{type:"func",josi:[["\u306E","\u3092"]],pure:!0,fn:function(n,e){let t=[];for(let r in n){let s=n[r],i=encodeURIComponent(r)+"="+encodeURIComponent(s);t.push(i)}return t.join("&")}},POST\u9001\u4FE1:{type:"func",josi:[["\u307E\u3067","\u3078","\u306B"],["\u3092"]],pure:!0,asyncFn:!0,fn:function(n,e,t){return new Promise((r,s)=>{let i=t.__exec("POST\u30C7\u30FC\u30BF\u751F\u6210",[e,t]);fetch(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i}).then(u=>u.text()).then(u=>{r(u)}).catch(u=>{s(u.message)})})}},POST\u30D5\u30A9\u30FC\u30E0\u9001\u4FE1:{type:"func",josi:[["\u307E\u3067","\u3078","\u306B"],["\u3092"]],pure:!0,asyncFn:!0,fn:function(n,e,t){return new Promise((r,s)=>{let i=new FormData;for(let u in e)i.set(u,e[u]);fetch(n,{method:"POST",body:i}).then(u=>u.text()).then(u=>{r(u)}).catch(u=>{s(u.message)})})}},AJAX\u4FDD\u969C\u9001\u4FE1:{type:"func",josi:[["\u307E\u3067","\u3078","\u306B"]],pure:!0,fn:function(n,e){let t=e.__getSysVar("AJAX\u30AA\u30D7\u30B7\u30E7\u30F3");return t===""&&(t={method:"GET"}),fetch(n,t)},return_none:!1},HTTP\u4FDD\u969C\u53D6\u5F97:{type:"func",josi:[["\u306E","\u304B\u3089","\u3092"]],pure:!0,fn:function(n,e){return e.__exec("AJAX\u4FDD\u969C\u9001\u4FE1",[n,e])},return_none:!1},POST\u4FDD\u969C\u9001\u4FE1:{type:"func",josi:[["\u307E\u3067","\u3078","\u306B"],["\u3092"]],pure:!0,fn:function(n,e,t){let r=t.__exec("POST\u30C7\u30FC\u30BF\u751F\u6210",[e,t]);return fetch(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:r})},return_none:!1},POST\u30D5\u30A9\u30FC\u30E0\u4FDD\u969C\u9001\u4FE1:{type:"func",josi:[["\u307E\u3067","\u3078","\u306B"],["\u3092"]],pure:!0,fn:function(n,e,t){let r=new FormData;for(let i in e)r.set(i,e[i]);return fetch(n,{method:"POST",body:r})},return_none:!1},AJAX\u5185\u5BB9\u53D6\u5F97:{type:"func",josi:[["\u304B\u3089"],["\u3067"]],pure:!0,fn:function(n,e,t){return e=e.toString().toUpperCase(),e==="TEXT"||e==="\u30C6\u30AD\u30B9\u30C8"?n.text():e==="JSON"?n.json():e==="BLOB"?n.blob():e==="ARRAY"||e==="\u914D\u5217"?n.arrayBuffer():e==="BODY"||e==="\u672C\u4F53"?n.body:n.body()},return_none:!1},BLOB\u4F5C\u6210:{type:"func",josi:[["\u3092","\u304B\u3089"],["\u3067"]],pure:!0,fn:function(n,e){return n instanceof Array||(n=[n]),new Blob(n,e)}},AJAX\u9010\u6B21\u9001\u4FE1:{type:"func",josi:[["\u307E\u3067","\u3078","\u306B"]],pure:!0,fn:function(n,e){if(!e.resolve)throw new Error("\u300EAJAX\u9010\u6B21\u9001\u4FE1\u300F\u306F\u300E\u9010\u6B21\u5B9F\u884C\u300F\u69CB\u6587\u5185\u3067\u5229\u7528\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002");e.resolveCount++;let t=e.resolve,r=e.reject,s=e.__getSysVar("AJAX\u30AA\u30D7\u30B7\u30E7\u30F3");s===""&&(s={method:"GET"}),fetch(n,s).then(i=>i.text()).then(i=>{e.__setSysVar("\u5BFE\u8C61",i),t()}).catch(i=>{r(i.message)})},return_none:!0},HTTP\u9010\u6B21\u53D6\u5F97:{type:"func",josi:[["\u306E","\u304B\u3089","\u3092"]],pure:!0,fn:function(n,e){if(!e.resolve)throw new Error("\u300EHTTP\u9010\u6B21\u53D6\u5F97\u300F\u306F\u300E\u9010\u6B21\u5B9F\u884C\u300F\u69CB\u6587\u5185\u3067\u5229\u7528\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002");e.__exec("AJAX\u9010\u6B21\u9001\u4FE1",[n,e])},return_none:!0},POST\u9010\u6B21\u9001\u4FE1:{type:"func",josi:[["\u307E\u3067","\u3078","\u306B"],["\u3092"]],pure:!0,fn:function(n,e,t){if(!t.resolve)throw new Error("\u300EPOST\u9001\u4FE1\u300F\u306F\u300E\u9010\u6B21\u5B9F\u884C\u300F\u69CB\u6587\u5185\u3067\u5229\u7528\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002");t.resolveCount++;let r=t.resolve,s=t.reject,i=t.__exec("POST\u30C7\u30FC\u30BF\u751F\u6210",[e,t]);fetch(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i}).then(u=>u.text()).then(u=>{t.__setSysVar("\u5BFE\u8C61",u),r(u)}).catch(u=>{s(u.message)})},return_none:!0},POST\u30D5\u30A9\u30FC\u30E0\u9010\u6B21\u9001\u4FE1:{type:"func",josi:[["\u307E\u3067","\u3078","\u306B"],["\u3092"]],pure:!0,fn:function(n,e,t){if(!t.resolve)throw new Error("\u300EPOST\u30D5\u30A9\u30FC\u30E0\u9010\u6B21\u9001\u4FE1\u300F\u306F\u300E\u9010\u6B21\u5B9F\u884C\u300F\u69CB\u6587\u5185\u3067\u5229\u7528\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002");t.resolveCount++;let r=t.resolve,s=t.reject,i=new FormData;for(let u in e)i.set(u,e[u]);fetch(n,{method:"POST",body:i}).then(u=>u.text()).then(u=>{t.__setSysVar("\u5BFE\u8C61",u),r(u)}).catch(u=>{s(u.message)})},return_none:!0}};var He={HTML\u5909\u63DB:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n){return String(n).replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<")}},\u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u8A2D\u5B9A:{type:"func",josi:[["\u3092"]],pure:!0,asyncFn:!0,fn:async function(n){if(navigator.clipboard){await navigator.clipboard.writeText(n);return}let e=document.createElement("div"),t=document.createElement("pre");t.style.webkitUserSelect="auto",t.style.userSelect="auto",e.appendChild(t).textContent=n,e.style.position="fixed",e.right="200%",document.body.appendChild(e),document.getSelection().selectAllChildren(e),document.execCommand("copy"),document.body.removeChild(e)},return_none:!0},\u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u53D6\u5F97\u6642:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n,e){if(navigator.clipboard)typeof n=="string"&&(n=e.__findFunc(n,"\u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u53D6\u5F97\u6642")),navigator.clipboard.readText().then(r=>{e.__setSysVar("\u5BFE\u8C61",r),n(e)});else throw new Error("Clipbard API\u304C\u5229\u7528\u3067\u304D\u307E\u305B\u3093\u3002")}},\u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u53D6\u5F97:{type:"func",josi:[],pure:!0,asyncFn:!0,fn:async function(n){if(navigator.clipboard)return await navigator.clipboard.readText();throw new Error("Clipbard API\u304C\u5229\u7528\u3067\u304D\u307E\u305B\u3093\u3002")}}};var Ke={WS\u63A5\u7D9A\u5B8C\u4E86\u6642:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n,e){e.__setSysVar("WS:ONOPEN",n)},return_none:!0},WS\u53D7\u4FE1\u6642:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n,e){e.__setSysVar("WS:ONMESSAGE",n)},return_none:!0},WS\u30A8\u30E9\u30FC\u767A\u751F\u6642:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n,e){e.__setSysVar("WS:ONERROR",n)},return_none:!0},WS\u63A5\u7D9A:{type:"func",josi:[["\u306B","\u3078","\u306E"]],pure:!0,fn:function(n,e){let t=new WebSocket(n);return t.onopen=()=>{let r=e.__getSysVar("WS:ONOPEN");r&&r(e)},t.onerror=r=>{let s=e.__getSysVar("WS:ONERROR");s&&s(r,e),console.log("WS\u30A8\u30E9\u30FC",r)},t.onmessage=r=>{e.__setSysVar("\u5BFE\u8C61",r.data);let s=e.__getSysVar("WS:ONMESSAGE");s&&s(e)},e.__setSysVar("WS:SOCKET",t),t}},WS\u9001\u4FE1:{type:"func",josi:[["\u3092","\u3068"]],pure:!0,fn:function(n,e){e.__getSysVar("WS:SOCKET").send(n)}},WS\u5207\u65AD:{type:"func",josi:[],pure:!0,fn:function(n){n.__getSysVar("WS:SOCKET").close()}}};var It=[Xe,Ye,He,Ke],Ze={\u521D\u671F\u5316:{type:"func",josi:[],pure:!0,fn:function(n){typeof self>"u"&&(self={}),typeof navigator>"u"&&(navigator={}),n.__setSysVar("AJAX:ONERROR",e=>{console.log(e)}),n.__v0.SELF=self,n.__v0.NAVIGATOR=navigator}}};It.forEach(n=>{let e={};Object.assign(e,n),typeof e.\u521D\u671F\u5316<"u"&&delete e.\u521D\u671F\u5316,Object.assign(Ze,e)});var Qe=Ze;var Lt={\u521D\u671F\u5316:{type:"func",josi:[],pure:!0,fn:function(n){n.__v0.SELF=self||{},n.__v0.\u4F9D\u983C\u4E3B=self||{}}},\u5BFE\u8C61\u30A4\u30D9\u30F3\u30C8:{type:"const",value:""},\u53D7\u4FE1\u30C7\u30FC\u30BF:{type:"const",value:""},SELF:{type:"const",value:""},\u4F9D\u983C\u4E3B:{type:"const",value:""},NAKO\u30EF\u30FC\u30AB\u30FC\u30C7\u30FC\u30BF\u53D7\u4FE1\u6642:{type:"func",josi:[["\u3067"]],pure:!1,fn:function(n,e){n=e.__findVar(n,null),e.__setSysVar("PluginWorker:ondata",(t,r)=>(e.__v0.\u53D7\u4FE1\u30C7\u30FC\u30BF=t,e.__v0.\u5BFE\u8C61\u30A4\u30D9\u30F3\u30C8=r,n(r,e)))},return_none:!0},\u30EF\u30FC\u30AB\u30FC\u30E1\u30C3\u30BB\u30FC\u30B8\u53D7\u4FE1\u6642:{type:"func",josi:[["\u3067"]],pure:!1,fn:function(n,e){n=e.__findVar(n,null),self.onmessage=t=>(e.__v0.\u53D7\u4FE1\u30C7\u30FC\u30BF=t.data,e.__v0.\u5BFE\u8C61\u30A4\u30D9\u30F3\u30C8=t,n(t,e))},return_none:!0},NAKO\u30EF\u30FC\u30AB\u30FC\u30C7\u30FC\u30BF\u9001\u4FE1:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n,e){postMessage({type:"data",data:n})},return_none:!0},\u30EF\u30FC\u30AB\u30FC\u30E1\u30C3\u30BB\u30FC\u30B8\u9001\u4FE1:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n,e){postMessage(n)},return_none:!0},\u8868\u793A:{type:"func",josi:[["\u3092"]],pure:!0,fn:function(n,e){postMessage({type:"output",data:n})},return_none:!0},\u7D42\u4E86:{type:"func",josi:[],pure:!0,fn:function(n){close()},return_none:!0}},et=Lt;var xe=class extends fe{constructor(){super(),this.__setSysVar("\u30CA\u30C7\u30B7\u30B3\u7A2E\u985E","wwnako3"),this.__setSysVar("PluginWorker:ondata",(e,t)=>{throw new Error("\u300ENAKO\u30EF\u30FC\u30AB\u30FC\u30C7\u30FC\u30BF\u53D7\u4FE1\u6642\u300F\u304C\u547C\u3070\u308C\u3066\u3044\u307E\u305B\u3093\u3002")})}};if(typeof navigator=="object"&&self&&self instanceof WorkerGlobalScope){let n=navigator.nako3=new xe,e=n;n.addPluginObject("PluginBrowserInWorker",Qe),n.addPluginObject("PluginWorker",et),n.getLogger().addListener("error",function(t){self.postMessage({type:"error",data:t})},!1),self.onmessage=t=>{let r=t.data||{type:"",data:""},s=r.type||"",i=r.data||"";switch(s){case"reset":n.reset();break;case"close":self.close();break;case"run":e=e.runEx(i,"_webworker.nako3",{resetEnv:!1,resetLog:!1});break;case"trans":i.forEach(o=>{if(o.type==="func")n.nakoFuncList[o.name]=o.content.meta,n.funclist[o.name]=o.content.func,n.__varslist[1].set(o.name,()=>{});else if(o.type==="val")n.__varslist[2].set(o.name,o.content);else if(o.type==="env")if(o.name==="modlist")for(let u of o.content)n.lexer.modList.indexOf(u.name)<0&&n.lexer.modList.push(u.name),u.export!=null&&!n.moduleExport.hasOwnProperty(u.name)&&(n.moduleExport[u.name]=u.export);else o.name==="constPools"?n.constPools=o.content:o.name==="constPoolsTemplate"?n.constPoolsTemplate=o.content:o.name==="chk"&&(n.chk=o.content)});break;case"data":e.__getSysVar("PluginWorker:ondata")&&e.__getSysVar("PluginWorker:ondata").apply(e,[i,t]);break}}}})();
|
|
435
436
|
//# sourceMappingURL=wnako3webworker.js.map
|