mode-crystal-23c1767b.js 10 KB

1
  1. import{g as T}from"./index-3157015c.js";function N(b,$){for(var a=0;a<$.length;a++){const d=$[a];if(typeof d!="string"&&!Array.isArray(d)){for(const k in d)if(k!=="default"&&!(k in b)){const f=Object.getOwnPropertyDescriptor(d,k);f&&Object.defineProperty(b,k,f.get?f:{enumerable:!0,get:()=>d[k]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var A={exports:{}};(function(b,$){ace.define("ace/mode/crystal_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(a,d,k){var f=a("../lib/oop"),m=a("./text_highlight_rules").TextHighlightRules,g=function(){var p="puts|initialize|previous_def|typeof|as|pointerof|sizeof|instance_sizeof",n="if|end|else|elsif|unless|case|when|break|while|next|until|def|return|class|new|getter|setter|property|lib|fun|do|struct|private|protected|public|module|super|abstract|include|extend|begin|enum|raise|yield|with|alias|rescue|ensure|macro|uninitialized|union|type|require",v="true|TRUE|false|FALSE|nil|NIL|__LINE__|__END_LINE__|__FILE__|__DIR__",t="$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|root_url|flash|session|cookies|params|request|response|logger|self",o=this.$keywords=this.createKeywordMapper({keyword:n,"constant.language":v,"variable.language":t,"support.function":p},"identifier"),e="(?:0[xX][\\dA-Fa-f]+)",r="(?:[0-9][\\d_]*)",l="(?:0o[0-7][0-7]*)",i="(?:0[bB][01]+)",c="(?:[+-]?)(?:"+e+"|"+r+"|"+l+"|"+i+")(?:_?[iIuU](?:8|16|32|64))?\\b",_=/\\(?:[nsrtvfbae'"\\]|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u{[\da-fA-F]{1,6}})/,s=/\\(?:[nsrtvfbae'"\\]|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u{[\da-fA-F]{1,6}}|u{(:?[\da-fA-F]{2}\s)*[\da-fA-F]{2}})/;this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string.regexp",regex:"[/]",push:[{token:"constant.language.escape",regex:s},{token:"string.regexp",regex:"[/][imx]*(?=[).,;\\s]|$)",next:"pop"},{defaultToken:"string.regexp"}]},[{regex:"[{}]",onMatch:function(u,x,h){return this.next=u=="{"?this.nextState:"",u=="{"&&h.length?(h.unshift("start",x),"paren.lparen"):u=="}"&&h.length&&(h.shift(),this.next=h.shift(),this.next.indexOf("string")!=-1)?"paren.end":u=="{"?"paren.lparen":"paren.rparen"},nextState:"start"},{token:"string.start",regex:/"/,push:[{token:"constant.language.escape",regex:s},{token:"string",regex:/\\#{/},{token:"paren.start",regex:/#{/,push:"start"},{token:"string.end",regex:/"/,next:"pop"},{defaultToken:"string"}]},{token:"string.start",regex:/`/,push:[{token:"constant.language.escape",regex:s},{token:"string",regex:/\\#{/},{token:"paren.start",regex:/#{/,push:"start"},{token:"string.end",regex:/`/,next:"pop"},{defaultToken:"string"}]},{stateName:"rpstring",token:"string.start",regex:/%[Qx]?\(/,push:[{token:"constant.language.escape",regex:s},{token:"string.start",regex:/\(/,push:"rpstring"},{token:"string.end",regex:/\)/,next:"pop"},{token:"paren.start",regex:/#{/,push:"start"},{defaultToken:"string"}]},{stateName:"spstring",token:"string.start",regex:/%[Qx]?\[/,push:[{token:"constant.language.escape",regex:s},{token:"string.start",regex:/\[/,push:"spstring"},{token:"string.end",regex:/]/,next:"pop"},{token:"paren.start",regex:/#{/,push:"start"},{defaultToken:"string"}]},{stateName:"fpstring",token:"string.start",regex:/%[Qx]?{/,push:[{token:"constant.language.escape",regex:s},{token:"string.start",regex:/{/,push:"fpstring"},{token:"string.end",regex:/}/,next:"pop"},{token:"paren.start",regex:/#{/,push:"start"},{defaultToken:"string"}]},{stateName:"tpstring",token:"string.start",regex:/%[Qx]?</,push:[{token:"constant.language.escape",regex:s},{token:"string.start",regex:/</,push:"tpstring"},{token:"string.end",regex:/>/,next:"pop"},{token:"paren.start",regex:/#{/,push:"start"},{defaultToken:"string"}]},{stateName:"ppstring",token:"string.start",regex:/%[Qx]?\|/,push:[{token:"constant.language.escape",regex:s},{token:"string.end",regex:/\|/,next:"pop"},{token:"paren.start",regex:/#{/,push:"start"},{defaultToken:"string"}]},{stateName:"rpqstring",token:"string.start",regex:/%[qwir]\(/,push:[{token:"string.start",regex:/\(/,push:"rpqstring"},{token:"string.end",regex:/\)/,next:"pop"},{defaultToken:"string"}]},{stateName:"spqstring",token:"string.start",regex:/%[qwir]\[/,push:[{token:"string.start",regex:/\[/,push:"spqstring"},{token:"string.end",regex:/]/,next:"pop"},{defaultToken:"string"}]},{stateName:"fpqstring",token:"string.start",regex:/%[qwir]{/,push:[{token:"string.start",regex:/{/,push:"fpqstring"},{token:"string.end",regex:/}/,next:"pop"},{defaultToken:"string"}]},{stateName:"tpqstring",token:"string.start",regex:/%[qwir]</,push:[{token:"string.start",regex:/</,push:"tpqstring"},{token:"string.end",regex:/>/,next:"pop"},{defaultToken:"string"}]},{stateName:"ppqstring",token:"string.start",regex:/%[qwir]\|/,push:[{token:"string.end",regex:/\|/,next:"pop"},{defaultToken:"string"}]},{token:"string.start",regex:/'/,push:[{token:"constant.language.escape",regex:_},{token:"string.end",regex:/'|$/,next:"pop"},{defaultToken:"string"}]}],{token:"text",regex:"::"},{token:"variable.instance",regex:"@{1,2}[a-zA-Z_\\d]+"},{token:"variable.fresh",regex:"%[a-zA-Z_\\d]+"},{token:"support.class",regex:"[A-Z][a-zA-Z_\\d]+"},{token:"constant.other.symbol",regex:"[:](?:(?:===|<=>|\\[]\\?|\\[]=|\\[]|>>|\\*\\*|<<|==|!=|>=|<=|!~|=~|<|\\+|-|\\*|\\/|%|&|\\||\\^|>|!|~)|(?:(?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?))"},{token:"constant.numeric",regex:"[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?(?:_?[fF](?:32|64))?\\b"},{token:"constant.numeric",regex:c},{token:"constant.other.symbol",regex:':"',push:[{token:"constant.language.escape",regex:s},{token:"constant.other.symbol",regex:'"',next:"pop"},{defaultToken:"constant.other.symbol"}]},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"support.function",regex:"(?:is_a\\?|nil\\?|responds_to\\?|as\\?)"},{token:o,regex:"[a-zA-Z_$][a-zA-Z0-9_$!?]*\\b"},{token:"variable.system",regex:"\\$\\!|\\$\\?"},{token:"punctuation.separator.key-value",regex:"=>"},{stateName:"heredoc",onMatch:function(u,x,h){var L="heredoc",y=u.split(this.splitRegex);return h.push(L,y[3]),[{type:"constant",value:y[1]},{type:"string",value:y[2]},{type:"support.class",value:y[3]},{type:"string",value:y[4]}]},regex:"(<<-)([']?)([\\w]+)([']?)",rules:{heredoc:[{token:"string",regex:"^ +"},{onMatch:function(u,x,h){return u===h[1]?(h.shift(),h.shift(),this.next=h[0]||"start","support.class"):(this.next="","string")},regex:".*$",next:"start"}]}},{regex:"$",token:"empty",next:function(u,x){return x[0]==="heredoc"?x[0]:u}},{token:"punctuation.operator",regex:/[.]\s*(?![.])/,push:[{token:"punctuation.operator",regex:/[.]\s*(?![.])/},{token:"support.function",regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{regex:"",token:"empty",next:"pop"}]},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|\\?|\\:|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\^|\\|"},{token:"punctuation.operator",regex:/[?:,;.]/},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}]},this.normalizeRules()};f.inherits(g,m),d.CrystalHighlightRules=g}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,d,k){var f=a("../range").Range,m=function(){};(function(){this.checkOutdent=function(g,p){return/^\s+$/.test(g)?/^\s*\}/.test(p):!1},this.autoOutdent=function(g,p){var n=g.getLine(p),v=n.match(/^(\s*\})/);if(!v)return 0;var t=v[1].length,o=g.findMatchingBracket({row:p,column:t});if(!o||o.row==p)return 0;var e=this.$getIndent(g.getLine(o.row));g.replace(new f(p,0,p,t-1),e)},this.$getIndent=function(g){return g.match(/^\s*/)[0]}}).call(m.prototype),d.MatchingBraceOutdent=m}),ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(a,d,k){var f=a("../../lib/oop"),m=a("./fold_mode").FoldMode,g=a("../../range").Range,p=d.FoldMode=function(){};f.inherits(p,m),function(){this.getFoldWidgetRange=function(n,v,t){var o=this.indentationBlock(n,t);if(o)return o;var e=/\S/,r=n.getLine(t),l=r.search(e);if(!(l==-1||r[l]!="#")){for(var i=r.length,c=n.getLength(),_=t,s=t;++t<c;){r=n.getLine(t);var u=r.search(e);if(u!=-1){if(r[u]!="#")break;s=t}}if(s>_){var x=n.getLine(s).length;return new g(_,i,s,x)}}},this.getFoldWidget=function(n,v,t){var o=n.getLine(t),e=o.search(/\S/),r=n.getLine(t+1),l=n.getLine(t-1),i=l.search(/\S/),c=r.search(/\S/);if(e==-1)return n.foldWidgets[t-1]=i!=-1&&i<c?"start":"","";if(i==-1){if(e==c&&o[e]=="#"&&r[e]=="#")return n.foldWidgets[t-1]="",n.foldWidgets[t+1]="","start"}else if(i==e&&o[e]=="#"&&l[e]=="#"&&n.getLine(t-2).search(/\S/)==-1)return n.foldWidgets[t-1]="start",n.foldWidgets[t+1]="","";return i!=-1&&i<e?n.foldWidgets[t-1]="start":n.foldWidgets[t-1]="",e<c?"start":""}}.call(p.prototype)}),ace.define("ace/mode/crystal",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/crystal_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/folding/coffee"],function(a,d,k){var f=a("../lib/oop"),m=a("./text").Mode,g=a("./crystal_highlight_rules").CrystalHighlightRules,p=a("./matching_brace_outdent").MatchingBraceOutdent,n=a("../range").Range,v=a("./folding/coffee").FoldMode,t=function(){this.HighlightRules=g,this.$outdent=new p,this.$behaviour=this.$defaultBehaviour,this.foldingRules=new v};f.inherits(t,m),function(){this.lineCommentStart="#",this.getNextLineIndent=function(o,e,r){var l=this.$getIndent(e),i=this.getTokenizer().getLineTokens(e,o),c=i.tokens;if(c.length&&c[c.length-1].type=="comment")return l;if(o=="start"){var _=e.match(/^.*[\{\(\[]\s*$/),s=e.match(/^\s*(class|def|module)\s.*$/),u=e.match(/.*do(\s*|\s+\|.*\|\s*)$/),x=e.match(/^\s*(if|else|when)\s*/);(_||s||u||x)&&(l+=r)}return l},this.checkOutdent=function(o,e,r){return/^\s+(end|else)$/.test(e+r)||this.$outdent.checkOutdent(e,r)},this.autoOutdent=function(o,e,r){var l=e.getLine(r);if(/}/.test(l))return this.$outdent.autoOutdent(e,r);var i=this.$getIndent(l),c=e.getLine(r-1),_=this.$getIndent(c),s=e.getTabString();_.length<=i.length&&i.slice(-s.length)==s&&e.remove(new n(r,i.length-s.length,r,i.length))},this.$id="ace/mode/crystal"}.call(t.prototype),d.Mode=t}),function(){ace.require(["ace/mode/crystal"],function(a){b&&(b.exports=a)})}()})(A);var F=A.exports;const R=T(F),z=N({__proto__:null,default:R},[F]);export{z as m};