nadesiko3
Version:
Japanese Programming Language
12 lines • 288 kB
JavaScript
"use strict";(()=>{var I={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},W=["\u3044\u3066","\u3048\u3066","\u304D\u3066","\u3051\u3066","\u3057\u3066","\u3063\u3066","\u306B\u3066","\u307F\u3066","\u3081\u3066","\u306D\u3066","\u306B\u306F","\u3093\u3067"],oe=[];for(let n in I)oe.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 ue=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",this.localvars=new Map([["\u305D\u308C",{type:"var",value:""}]]),this.usedFuncs=new Set,this.funcLevel=0,this.usedAsyncFn=!1,this.isReadingCalc=!1,this.isExportDefault=!0,this.isExportStack=[],this.namespaceStack=[],this.modList=[],this.stackList=[],this.recentlyCalledFunc=[],this.arrayIndexFrom=0,this.flagReverseArrayIndex=!1,this.flagCheckArrayInit=!1,this.isModifiedNodes=!1}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 M=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}},ce=class extends M{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}},P=class extends M{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}},R=class extends M{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}},y=class n extends M{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}},G=class n extends M{constructor(e,t){let r="unknown";typeof e=="string"?r=e:e instanceof n||e instanceof M?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}},Z=class extends M{constructor(e,t,r){super("\u53D6\u308A\u8FBC\u307F\u30A8\u30E9\u30FC",e,t,r),this.file=t,this.line=r}};var At=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"]]),Se=At;function Re(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 fe=["\u306B\u3064\u3044\u3066","\u304F\u3089\u3044","\u306A\u306E\u304B","\u307E\u3067\u3092","\u307E\u3067\u306E","\u306B\u3088\u308B","\u3068\u3057\u3066","\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","\u3093\u3067","\u305A\u3064","\u306F","\u3092","\u306B","\u3078","\u3067","\u3068","\u304C","\u306E"],Nt=["\u3067\u306A\u3051\u308C\u3070","\u306A\u3051\u308C\u3070","\u306A\u3089\u3070","\u306A\u3089","\u305F\u3089","\u308C\u3070"],Ot=["\u3053\u3068","\u3067\u3042\u308B","\u3067\u3059","\u3057\u307E\u3059","\u3067\u3057\u305F","\u306B\u3083\u3093"],je={};Nt.forEach(n=>{fe.push(n),je[n]=!0});var U={};Ot.forEach(n=>{fe.push(n),U[n]=!0});var ae=[];for(let n of fe)ae.push("\u3082\u306E"+n),ae.push(n);ae.sort((n,e)=>e.length-n.length);var Ft="^[\\t \u3000]*("+ae.join("|")+")",q=new RegExp(Ft),Ge=fe;var Et=/^[\u3005\u4E00-\u9FCF_a-zA-Z0-9ァ-ヶー\u2460-\u24FF\u2776-\u277F\u3251-\u32BF]+/,We=/^[ぁ-ん]/,Ct=/^[ぁ-ん]+$/,Tt=/^.+(以上|以下|超|未満)$/,Mt=/^(かつ|または)/,Be=n=>function(){throw new Error("\u7A81\u7136\u306E\u300E"+n+"\u300F\u304C\u3042\u308A\u307E\u3059\u3002")},Ue=/^(円|ドル|元|歩|㎡|坪|度|℃|°|個|つ|本|冊|才|歳|匹|枚|皿|セット|羽|人|件|行|列|機|品|m|mm|cm|km|g|kg|t|b|mb|kb|gb)/,qe=/^(px|em|ex|rem|vw|vh|vmin|vmax)/,ze=[{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:It},{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:z},{name:"number",pattern:/^0[oO][0-7]+(_[0-7]+)*/,readJosi:!0,cb:z},{name:"number",pattern:/^0[bB][0-1]+(_[0-1]+)*/,readJosi:!0,cb:z},{name:"number",pattern:/^\d+(_\d+)*\.(\d+(_\d+)*)?([eE][+|-]?\d+(_\d+)*)?/,readJosi:!0,cb:z},{name:"number",pattern:/^\.\d+(_\d+)*([eE][+|-]?\d+(_\d+)*)?/,readJosi:!0,cb:z},{name:"number",pattern:/^\d+(_\d+)*([eE][+|-]?\d+(_\d+)*)?/,readJosi:!0,cb:z},{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:"word",pattern:/^\$\{.+?\}/,cbParser:n=>Lt(n)},{name:"$",pattern:/^(\$|\.)/},{name:"string",pattern:/^🌿/,cbParser:n=>B("\u{1F33F}","\u{1F33F}",n)},{name:"string_ex",pattern:/^🌴/,cbParser:n=>B("\u{1F334}","\u{1F334}",n)},{name:"string_ex",pattern:/^「/,cbParser:n=>B("\u300C","\u300D",n)},{name:"string",pattern:/^『/,cbParser:n=>B("\u300E","\u300F",n)},{name:"string_ex",pattern:/^“/,cbParser:n=>B("\u201C","\u201D",n)},{name:"string_ex",pattern:/^"/,cbParser:n=>B('"','"',n)},{name:"string",pattern:/^'/,cbParser:n=>B("'","'",n)},{name:"\u300D",pattern:/^」/,cbParser:Be("\u300D")},{name:"\u300F",pattern:/^』/,cbParser:Be("\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:Pt}];function Vt(n){return We.test(n)?Ct.test(n)?n:n.replace(/[ぁ-ん]+$/g,""):n.replace(/[ぁ-ん]+/g,"")}function It(n){let e="",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)===`
`&&r++;return e=e.replace(/(^\s+|\s+$)/,""),{src:n,res:e,josi:"",numEOL:r}}function Pt(n,e=!0){let t="",r="";for(;n!=="";){if(t.length>0){if(Mt.exec(n))break;let c=q.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=Et.exec(n);if(i){t+=i[0],n=n.substring(i[0].length);continue}if(We.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=Tt.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)),U[r]&&(r=""),e&&(t=Vt(t)),t===""&&r!==""&&(t=r,r=""),{src:n,res:t,josi:r,numEOL:0}}function B(n,e,t){let r="",s="",i=0;t=t.substring(n.length);let o=t.indexOf(e);if(o<0)throw r=t,t="",new Error(`\u300E${n}\u300F\u3067\u59CB\u3081\u305F\u6587\u5B57\u5217\u306E\u7D42\u7AEF\u8A18\u53F7\u300E${e}\u300F\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002`);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=q.exec(t);u&&(s=u[0].replace(/^\s+/,""),t=t.substring(u[0].length),t.charAt(0)===","&&(t=t.substring(1))),U[s]&&(s=""),s.substring(0,2)==="\u3082\u306E"&&(s=s.substring(2));for(let c=0;c<r.length;c++)r.charAt(c)===`
`&&i++;return{src:t,res:r,josi:s,numEOL:i}}function Lt(n){let e="",t="",r=0;n=n.substring(2);let s=n.indexOf("}");if(s<0)throw new Error("\u5909\u6570\u540D\u306E\u7D42\u308F\u308A\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002");e=n.substring(0,s),n=n.substring(s+1);let i=q.exec(n);i&&(t=i[0].replace(/^\s+/,""),n=n.substring(i[0].length),n.charAt(0)===","&&(n=n.substring(1)));for(let o=0;o<e.length;o++)e.charAt(o)===`
`&&r++;if(r>0)throw new Error("\u5909\u6570\u540D\u306B\u6539\u884C\u3092\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002");return{src:n,res:e,josi:t,numEOL:r}}function z(n){return Number(n.replace(/_/g,""))}var T=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(Se.keys()),this.josiList=Ge}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 d=e[i];if(i++,d.type===")")break;d.type==="func"?o=!0:d.type!=="|"&&d.type!=="comma"&&(o&&(d.funcPointer=!0,o=!1),c.push(d),a[d.value]||(a[d.value]=[]),a[d.value].push(d.josi))}let f=[],l=[],p=[],h={};for(let d of c)if(!h[d.value]){let m=a[d.value];p.push(m),f.push(d.value),d.funcPointer?l.push(d.value):l.push(null),h[d.value]=!0}return[p,f,l]};for(;i<e.length;){let c=e[i];if(c.type==="not"&&e.length-i>3){let _={type:"eol"};if(i>=1&&(_=e[i-1]),_.type==="eol"){let v=e[i+1];if(v.type==="word"&&v.value==="\u30E2\u30B8\u30E5\u30FC\u30EB\u516C\u958B\u65E2\u5B9A\u5024"){if(v.type="\u30E2\u30B8\u30E5\u30FC\u30EB\u516C\u958B\u65E2\u5B9A\u5024",v=e[i+2],v.type==="string"&&v.value==="\u975E\u516C\u958B"){let $=n.filenameToModName(c.file);s.set($,!1),i+=3;continue}else if(v.type==="string"&&v.value==="\u516C\u958B"){let $=n.filenameToModName(c.file);s.set($,!0),i+=3;continue}}}}if(c.type==="word"&&c.josi==="\u306B\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 _=e[i+1];_.value==="\u7E70\u8FD4"&&(_.value="\u9593",_.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 _={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,_),c.endOffset--,i++}if(c.type==="word"){let _=Se.get(c.value);_&&(c.type=_),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 p=[],h=[],d=[],m="",g=null,k=null;if(e[i]&&e[i].type==="{"){i++;let _=e[i]&&e[i].type==="word"?e[i].value:"";_==="\u516C\u958B"?k=!0:_==="\u975E\u516C\u958B"?k=!1:_==="\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8"?k=!0:t.warn(`\u4E0D\u660E\u306A\u95A2\u6570\u5C5E\u6027\u300E${String(_)}\u300F\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002`),i++,e[i]&&e[i].type==="}"&&i++}if(e[i]&&e[i].type==="("&&([p,h,d]=u()),!a&&e[i]&&e[i].type==="word"&&(g=e[i++],m=g.value),p.length===0&&e[i]&&e[i].type==="("&&([p,h,d]=u()),m!==""&&g){if(m=n.filenameToModName(c.file)+"__"+m,r.has(m)){let v=m.replace(/^main__/,"");t.warn(`\u95A2\u6570\u300E${v}\u300F\u306F\u65E2\u306B\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u3059\u3002`,l)}g.value=m,r.set(m,{type:"func",josi:p,fn:null,asyncFn:!1,isExport:k,varnames:h,funcPointers:d})}let b={type:"func",josi:p,varnames:h,funcPointers:d};l.meta=b}}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 P("\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 P("\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=String(c.value);if(a.indexOf("__")<0){let l=`${u}__${a}`,p=this.funclist.get(l);if(p&&p.type==="func"){let h=c;h.type=s?"func_pointer":"func",h.meta=p,h.value=l,s&&(s=!1,e.splice(r-1,1));continue}for(let h of this.modList){let d=`${h}__${a}`,m=this.funclist.get(d),g=this.moduleExport.get(h);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=d,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"||I[f]||e[r-1].josi!=="")&&(e.splice(r,1),a==="number"?e[r].value*=-1:e[r].value="-"+String(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(je[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=Re(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 p=!1;for(let h of ze){let d=h.pattern.exec(e);if(!d)continue;let m=h.name;if(p=!0,h.name==="space"){c+=d[0].length,e=e.substring(d[0].length);continue}if(h.cbParser){let _;if(a&&h.name==="word")_=h.cbParser(e,!1);else try{_=h.cbParser(e)}catch(v){throw new R(v.message,s-e.length,s-e.length+1,t,r)}if(h.name==="string_ex"){let v=this.splitStringEx(_.res);if(v===null)throw new P("\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-_.src.length,t,r);if(v.length===1){i.push({type:"string",value:v[0],josi:_.josi,indent:f,file:r,line:t,column:c,preprocessedCodeOffset:s-e.length,preprocessedCodeLength:e.length-_.src.length}),t+=_.numEOL,c+=e.length-_.src.length,e=_.src,_.numEOL>0&&(c=1);break}i.push({type:"(",value:"(",josi:"",indent:f,file:r,line:t,column:c,preprocessedCodeOffset:s-e.length,preprocessedCodeLength:0});let $=0;for(let C=0;C<v.length;C++)C%2===0?(i.push({type:"string",value:v[C],file:r,josi:"",indent:f,line:t,column:c,preprocessedCodeOffset:s-e.length+$,preprocessedCodeLength:v[C].length+2}),$+=v[C].length+2):(i.push({type:"&",value:"&",josi:"",indent:f,file:r,line:t,column:c,preprocessedCodeOffset:s-e.length+$,preprocessedCodeLength:0}),i.push({type:"(",value:"(",josi:"",indent:f,file:r,line:t,column:c,preprocessedCodeOffset:s-e.length+$,preprocessedCodeLength:0}),i.push({type:"code",value:v[C],josi:"",indent:f,file:r,line:t,column:c,preprocessedCodeOffset:s-e.length+$,preprocessedCodeLength:v[C].length}),i.push({type:")",value:")",josi:"",indent:f,file:r,line:t,column:c,preprocessedCodeOffset:s-e.length+$+v[C].length,preprocessedCodeLength:0}),i.push({type:"&",value:"&",josi:"",indent:f,file:r,line:t,column:c,preprocessedCodeOffset:s-e.length+$+v[C].length,preprocessedCodeLength:0}),$+=v[C].length);t+=_.numEOL,c+=e.length-_.src.length,e=_.src,_.numEOL>0&&(c=1),i.push({type:")",value:")",josi:_.josi,indent:f,file:r,line:t,column:c,preprocessedCodeOffset:s-e.length,preprocessedCodeLength:0});break}o=c,c+=e.length-_.src.length,i.push({type:h.name,value:_.res,josi:_.josi,indent:f,line:t,column:o,file:r,preprocessedCodeOffset:s-e.length,preprocessedCodeLength:e.length-_.src.length}),e=_.src,t+=_.numEOL,_.numEOL>0&&(c=1);break}let g=s-e.length,k=d[0];if(h.cb&&(k=h.cb(k)),o=c,u=t,c+=d[0].length,e=e.substring(d[0].length),(h.name==="eol"&&k===`
`||h.name==="_eol")&&(k=t++,c=1),h.name==="number"){let _=Ue.exec(e);_&&(e=e.substring(_[0].length),c+=d[0].length);let v=qe.exec(e);v&&(m="string",e=e.substring(v[0].length),c+=d[0].length,k+=v[0])}let b="";if(h.readJosi){let _=q.exec(e);_&&(c+=_[0].length,b=_[0].replace(/^\s+/,""),e=e.substring(_[0].length),e.charAt(0)===","&&(e=e.substring(1)),U[b]&&(b=""),b.substring(0,2)==="\u3082\u306E"&&(b=b.substring(2)))}switch(m){case"def_test":{a=!0;break}case"eol":{a=!1;break}default:break}if(m==="dec_lineno"){t--;continue}if(i.push({type:m,value:k,indent:f,line:u,column:o,file:r,josi:b,preprocessedCodeOffset:g,preprocessedCodeLength:s-e.length-g}),m==="eol"&&c===1){let _=this.countIndent(e);f=_[0],c+=_[1],e=e.substring(_[1])}break}if(!p)throw new P("\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 le=class extends ue{parse(e,t){this.reset(),this.tokens=e,this.modName=T.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),y.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),y.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()}}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+=String(i.name)+`
`}return this.recentlyCalledFunc=[],`\u672A\u89E3\u6C7A\u306E\u5358\u8A9E\u304C\u3042\u308A\u307E\u3059: [${t}]
\u6B21\u306E\u547D\u4EE4\u306E\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059:
${r}`}yEOL(){let e=this.get();if(!e)return null;if(this.stack.length>0){let t=this.makeStackBalanceReport();throw y.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.yDebugPrint();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 y.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(W.indexOf(t.josi||"")>=0){if(this.stack.length>=1){let i=this.makeStackBalanceReport();throw y.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 p=this.get();if(this.check("}"))this.get();else throw y.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);p!==null&&(p.value==="\u516C\u958B"&&(i=!0),p.value==="\u975E\u516C\u958B"&&(i=!1),p.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),y.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),y.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 p=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 d=h.value;this.localvars.set(d,{type:"var",value:""})}if(c=this.yBlock(),this.check("\u3053\u3053\u307E\u3067"))this.get();else{let h=this.peek(),d=JSON.stringify(h);throw h&&h.type&&h.value&&(d=h.value),y.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\u300E${d}\u300F\u306E\u524D\u306B\u300E\u3053\u3053\u307E\u3067\u300F\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002`,s)}this.loadStack()}else this.saveStack(),c=this.ySentence()||this.yNop(),this.loadStack();this.funcLevel--,f=this.usedAsyncFn,this.localvars=p}catch(p){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
`+String(p.message),s),y.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
`+String(p.message),s)}let l=this.funclist.get(u.value);return l&&!l.asyncFn&&f&&(l.asyncFn=f),{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 y.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 y.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),y.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 y.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 y.fromNode(`\u300E\u3082\u3057\u300F\u6587\u306E\u6761\u4EF6\u3067\u6B21\u306E\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3059\u3002
`+String(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 y.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&&I[r.type]){r=this.getCur(),t.push(r);let s=this.yValue();if(s===null)throw y.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 y.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()}}yDebugPrint(){let e=this.peekSourceMap(),t=this.get();if(!t||t.value!=="??")throw y.fromNode("\u300E??\u300F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",e);let r=this.yCalc();if(!r)throw y.fromNode("\u300E??(\u8A08\u7B97\u5F0F)\u300F\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",e);let s=this.funclist.get("\u30CF\u30C6\u30CA\u95A2\u6570\u5B9F\u884C");if(!s)throw new Error("\u95A2\u6570\u300E\u30CF\u30C6\u30CA\u95A2\u6570\u5B9F\u884C\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:"\u30CF\u30C6\u30CA\u95A2\u6570\u5B9F\u884C",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=>I[i.type]?I[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(!I[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) ---
`+JSON.stringify(s)),y.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.yCalc();if(i){this.pushStack(i),this.check("comma")&&this.get();continue}break}if(!t)throw y.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 y.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:"repeat_times",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 y.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 y.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 y.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=String(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"]),p="";if(l!==null){if(l.type!=="word")throw y.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);p=l.value}if((f===null||a===null)&&!(f===null&&a&&a.type==="func"&&a.name==="\u7BC4\u56F2"))throw y.fromNode(e,o);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 d=this.yNop();if(h)if(d=this.yBlock(),this.check("\u3053\u3053\u307E\u3067"))this.get();else throw y.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&&(d=m)}return d||(d=this.yNop()),{type:"for",blocks:[f,a,c,d],flagDown:t,flagUp:r,loopDirection:s,word:p,josi:"",...i,end:this.peekSourceMap()}}yReturn(){let e=this.peekSourceMap();if(!this.check("\u623B\u308B"))return