wikijs-fork/assets/js/ace/mode-c9search.js

1 line
4.0 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

ace.define("ace/mode/c9search_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";function r(e,t){try{return new RegExp(e,t)}catch(e){}}var i=e("../lib/oop"),a=e("../lib/lang"),s=e("./text_highlight_rules").TextHighlightRules,o=function(){this.$rules={start:[{tokenNames:["c9searchresults.constant.numeric","c9searchresults.text","c9searchresults.text","c9searchresults.keyword"],regex:/(^\s+[0-9]+)(:)(\d*\s?)([^\r\n]+)/,onMatch:function(e,t,n){var r=this.splitRegex.exec(e),i=this.tokenNames,a=[{type:i[0],value:r[1]},{type:i[1],value:r[2]}];r[3]&&(" "==r[3]?a[1]={type:i[1],value:r[2]+" "}:a.push({type:i[1],value:r[3]}));var s,o=n[1],c=r[4],u=0;if(o&&o.exec)for(o.lastIndex=0;s=o.exec(c);){var h=c.substring(u,s.index);if(u=o.lastIndex,h&&a.push({type:i[2],value:h}),s[0])a.push({type:i[3],value:s[0]});else if(!h)break}return u<c.length&&a.push({type:i[2],value:c.substr(u)}),a}},{regex:"^Searching for [^\\r\\n]*$",onMatch:function(e,t,n){var i=e.split("");if(i.length<3)return"text";var s,o,c,u=0,h=[{value:i[u++]+"'",type:"text"},{value:o=i[u++],type:"text"},{value:"'"+i[u++],type:"text"}];for(" in"!==i[2]&&(c=i[u],h.push({value:"'"+i[u++]+"'",type:"text"},{value:i[u++],type:"text"})),h.push({value:" "+i[u++]+" ",type:"text"}),i[u+1]?(s=i[u+1],h.push({value:"("+i[u+1]+")",type:"text"}),u+=1):u-=1;u++<i.length;)i[u]&&h.push({value:i[u],type:"text"});c&&(o=c,s=""),o&&(/regex/.test(s)||(o=a.escapeRegExp(o)),/whole/.test(s)&&(o="\\b"+o+"\\b"));var l=o&&r("("+o+")",/ sensitive/.test(s)?"g":"ig");return l&&(n[0]=t,n[1]=l),h}},{regex:"^(?=Found \\d+ matches)",token:"text",next:"numbers"},{token:"string",regex:"^\\S:?[^:]+",next:"numbers"}],numbers:[{regex:"\\d+",token:"constant.numeric"},{regex:"$",token:"text",next:"start"}]},this.normalizeRules()};i.inherits(o,s),t.C9SearchHighlightRules=o}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return!!/^\s+$/.test(e)&&/^\s*\}/.test(t)},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var a=i[1].length,s=e.findMatchingBracket({row:t,column:a});if(!s||s.row==t)return 0;var o=this.$getIndent(e.getLine(s.row));e.replace(new r(t,0,t,a-1),o)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),ace.define("ace/mode/folding/c9search",["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,a=e("./fold_mode").FoldMode,s=t.FoldMode=function(){};r.inherits(s,a),function(){this.foldingStartMarker=/^(\S.*:|Searching for.*)$/,this.foldingStopMarker=/^(\s+|Found.*)$/,this.getFoldWidgetRange=function(e,t,n){var r=e.doc.getAllLines(n),a=r[n],s=/^(Found.*|Searching for.*)$/,o=s.test(a)?s:/^(\S.*:|\s*)$/,c=n,u=n;if(this.foldingStartMarker.test(a)){for(var h=n+1,l=e.getLength();h<l&&!o.test(r[h]);h++);u=h}else if(this.foldingStopMarker.test(a)){for(var h=n-1;h>=0&&(a=r[h],!o.test(a));h--);c=h}if(c!=u){var g=a.length;return o===s&&(g=a.search(/\(Found[^)]+\)$|$/)),new i(c,g,u,0)}}}.call(s.prototype)}),ace.define("ace/mode/c9search",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/c9search_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/c9search"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,a=e("./c9search_highlight_rules").C9SearchHighlightRules,s=e("./matching_brace_outdent").MatchingBraceOutdent,o=e("./folding/c9search").FoldMode,c=function(){this.HighlightRules=a,this.$outdent=new s,this.foldingRules=new o};r.inherits(c,i),function(){this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id="ace/mode/c9search"}.call(c.prototype),t.Mode=c});