thedesk/app/js/ace/mode-aiscript.js
2021-04-02 10:56:01 +09:00

9 lines
8.2 KiB
JavaScript

define("ace/mode/aiscript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{include:"#comments"},{include:"#keywords"},{include:"#strings"},{include:"#back-quote"},{include:"#numeric-literal"},{include:"#boolean-literal"},{include:"#null-literal"},{include:"#undefined-literal"},{include:"#numericConstant-literal"},{include:"#array-literal"},{include:"#vars"},{include:"#math"}],"#comments":[{token:"comment.line",regex:/\/\/.*/},{token:"comment.block",regex:/### {/,push:[{token:"comment.block",regex:/}/,next:"pop"},{defaultToken:"comment.block"}]}],"#vars":[{token:"storage.modifier.aiscript",regex:/#[0-9a-zA-Z_]+/},{token:"variable.name.aiscript",regex:/\$[0-9a-zA-Z_]+/}],"#keywords":[{token:"keyword.control.aiscript",regex:/\breturn\b/}],"#strings":[{token:"string.quoted.double.aiscript",regex:/"/,push:[{token:"string.quoted.double.aiscript",regex:/"/,next:"pop"},{token:"constant.character.escape.aiscript",regex:/\\./},{defaultToken:"string.quoted.double.aiscript"}]}],"#back-quote":[{token:"string.quoted.double.aiscript",regex:/`/,push:[{token:"string.quoted.double.aiscript",regex:/`/,next:"pop"},{token:"constant.character.escape.aiscript",regex:/\\./},{defaultToken:"string.quoted.double.aiscript"}]}],"#boolean-literal":[{token:"constant.language.boolean.true.aiscript",regex:/(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))yes(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))/},{token:"constant.language.boolean.false.aiscript",regex:/(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))no(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))/}],"#numeric-literal":[{token:["constant.numeric.hex.aiscript","constant.numeric.hex.aiscript","storage.type.numeric.bigint.aiscript"],regex:/\b(?<!\$)(0)(?:x|X)([0-9a-fA-F][0-9a-fA-F_]*)((?:n)?)\b(?!\$)/},{token:["constant.numeric.binary.aiscript","constant.numeric.binary.aiscript","storage.type.numeric.bigint.aiscript"],regex:/\b(?<!\$)(0)(?:b|B)([01][01_]*)((?:n)?)\b(?!\$)/},{token:["constant.numeric.octal.aiscript","constant.numeric.octal.aiscript","storage.type.numeric.bigint.aiscript"],regex:/\b(?<!\$)(0)(?:o|O)?([0-7][0-7_]*)((?:n)?)\b(?!\$)/},{token:["text","meta.delimiter.decimal.period.aiscript","text","storage.type.numeric.bigint.aiscript","text","meta.delimiter.decimal.period.aiscript","text","storage.type.numeric.bigint.aiscript","meta.delimiter.decimal.period.aiscript","text","storage.type.numeric.bigint.aiscript","text","storage.type.numeric.bigint.aiscript","text","meta.delimiter.decimal.period.aiscript","text","storage.type.numeric.bigint.aiscript","text","meta.delimiter.decimal.period.aiscript","storage.type.numeric.bigint.aiscript","meta.delimiter.decimal.period.aiscript","text","storage.type.numeric.bigint.aiscript","text","storage.type.numeric.bigint.aiscript"],regex:/(?<!\$)(?:\b([0-9][0-9_]*)(\.)([0-9][0-9_]*[eE][+-]?[0-9][0-9_]*)((?:n)?)\b|\b([0-9][0-9_]*)(\.)([eE][+-]?[0-9][0-9_]*)((?:n)?)\b|\B(\.)([0-9][0-9_]*[eE][+-]?[0-9][0-9_]*)((?:n)?)\b|\b([0-9][0-9_]*[eE][+-]?[0-9][0-9_]*)((?:n)?)\b|\b([0-9][0-9_]*)(\.)([0-9][0-9_]*)((?:n)?)\b|\b([0-9][0-9_]*)(\.)((?:n)?)\B|\B(\.)([0-9][0-9_]*)((?:n)?)\b|\b([0-9][0-9_]*)((?:n)?)\b(?!\.))(?!\$)/}],"#null-literal":[{token:"constant.language.null.aiscript",regex:/(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))null(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))/}],"#undefined-literal":[{token:"constant.language.undefined.aiscript",regex:/(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))undefined(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.))/}],"#math":[{token:["support.constant.math.aiscript","text","punctuation.accessor.aiscript","punctuation.accessor.optional.aiscript","text","support.function.math.aiscript","support.constant.property.math.aiscript"],regex:/(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Math)(?:(\s*)(?:(:)|(\?:(?!\s*[[:digit:]])))(\s*)(?:(abs|acos|acosh|asin|asinh|atan|atan2|atanh|cbrt|ceil|clz32|cos|cosh|exp|expm1|floor|fround|hypot|imul|log|log10|log1p|log2|max|min|pow|rnd|round|sign|sin|sinh|sqrt|tan|tanh|trunc)|(E|LN10|LN2|LOG10E|LOG2E|PI|SQRT1_2|SQRT2)))?\b(?!\$)/},{token:["support.constant.math.aiscript","text","punctuation.accessor.aiscript","punctuation.accessor.optional.aiscript","text","support.function.math.aiscript"],regex:/(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Arr)(?:(\s*)(?:(:)|(\?:(?!\s*[[:digit:]])))(\s*)(len))?\b(?!\$)/},{token:["support.constant.math.aiscript","text","punctuation.accessor.aiscript","punctuation.accessor.optional.aiscript","text","support.function.math.aiscript"],regex:/(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(Str)(?:(\s*)(?:(:)|(\?:(?!\s*[[:digit:]])))(\s*)(split|replace))?\b(?!\$)/},{token:["support.constant.math.aiscript","text","punctuation.accessor.aiscript","punctuation.accessor.optional.aiscript","text","support.function.math.aiscript"],regex:/(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(TheDesk)(?:(\s*)(?:(:)|(\?:(?!\s*[[:digit:]])))(\s*)(dialog|confirm|css|openLink|api|getRequest|changeText|refreshTipsView|postText|postCW|postNSFW|postClearbox|postExec))?\b(?!\$)/}]},this.normalizeRules()};s.metaData={$schema:"https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.aiscripton",name:"aiscript",scopeName:"source.aiscript"},r.inherits(s,i),t.aiscriptHighlightRules=s}),define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++n<s){t=e.getLine(n);var f=u.exec(t);if(!f)continue;f[1]?a--:a++;if(!a)break}var l=n;if(l>o)return new i(o,r,l,t.length)}}.call(o.prototype)}),define("ace/mode/aiscript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/aiscript_highlight_rules","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./aiscript_highlight_rules").aiscriptHighlightRules,o=e("./folding/cstyle").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.$id="ace/mode/aiscript"}.call(u.prototype),t.Mode=u});
(function() {
window.require(["ace/mode/aiscript"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();