Current File : /home/pacjaorg/public_html/kmm/media/vendor/codemirror/mode/crystal/crystal.min.js
(function(c){typeof exports=="object"&&typeof module=="object"?c(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],c):c(CodeMirror)})(function(c){"use strict";c.defineMode("crystal",function(y){function l(n,e){return new RegExp((e?"":"^")+"(?:"+n.join("|")+")"+(e?"$":"\\b"))}function o(n,e,r){return r.tokenize.push(n),n(e,r)}var F=/^(?:[-+/%|&^]|\*\*?|[<>]{2})/,v=/^(?:[=!]~|===|<=>|[<>=!]=?|[|&]{2}|~)/,x=/^(?:\[\][?=]?)/,s=/^(?:\.(?:\.{2})?|->|[?:])/,p=/^[a-z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/,k=/^[A-Z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/,S=l(["abstract","alias","as","asm","begin","break","case","class","def","do","else","elsif","end","ensure","enum","extend","for","fun","if","include","instance_sizeof","lib","macro","module","next","of","out","pointerof","private","protected","rescue","return","require","select","sizeof","struct","super","then","type","typeof","uninitialized","union","unless","until","when","while","with","yield","__DIR__","__END_LINE__","__FILE__","__LINE__"]),A=l(["true","false","nil","self"]),T=["def","fun","macro","class","module","struct","lib","enum","union","do","for"],K=l(T),O=["if","unless","case","while","until","begin","then"],M=l(O),b=["end","else","elsif","rescue","ensure"],Z=l(b),g=["\\)","\\}","\\]"],j=new RegExp("^(?:"+g.join("|")+")$"),I={def:E,fun:E,macro:D,class:a,module:a,struct:a,lib:a,enum:a,union:a},z={"[":"]","{":"}","(":")","<":">"};function _(n,e){if(n.eatSpace())return null;if(e.lastToken!="\\"&&n.match("{%",!1))return o(f("%","%"),n,e);if(e.lastToken!="\\"&&n.match("{{",!1))return o(f("{","}"),n,e);if(n.peek()=="#")return n.skipToEnd(),"comment";var r;if(n.match(p))return n.eat(/[?!]/),r=n.current(),n.eat(":")?"atom":e.lastToken=="."?"property":S.test(r)?(K.test(r)?!(r=="fun"&&e.blocks.indexOf("lib")>=0)&&!(r=="def"&&e.lastToken=="abstract")&&(e.blocks.push(r),e.currentIndent+=1):(e.lastStyle=="operator"||!e.lastStyle)&&M.test(r)?(e.blocks.push(r),e.currentIndent+=1):r=="end"&&(e.blocks.pop(),e.currentIndent-=1),I.hasOwnProperty(r)&&e.tokenize.push(I[r]),"keyword"):A.test(r)?"atom":"variable";if(n.eat("@"))return n.peek()=="["?o(h("[","]","meta"),n,e):(n.eat("@"),n.match(p)||n.match(k),"variable-2");if(n.match(k))return"tag";if(n.eat(":"))return n.eat('"')?o(w('"',"atom",!1),n,e):n.match(p)||n.match(k)||n.match(F)||n.match(v)||n.match(x)?"atom":(n.eat(":"),"operator");if(n.eat('"'))return o(w('"',"string",!0),n,e);if(n.peek()=="%"){var t="string",i=!0,u;if(n.match("%r"))t="string-2",u=n.next();else if(n.match("%w"))i=!1,u=n.next();else if(n.match("%q"))i=!1,u=n.next();else if(u=n.match(/^%([^\w\s=])/))u=u[1];else{if(n.match(/^%[a-zA-Z_\u009F-\uFFFF][\w\u009F-\uFFFF]*/))return"meta";if(n.eat("%"))return"operator"}return z.hasOwnProperty(u)&&(u=z[u]),o(w(u,t,i),n,e)}return(r=n.match(/^<<-('?)([A-Z]\w*)\1/))?o(N(r[2],!r[1]),n,e):n.eat("'")?(n.match(/^(?:[^']|\\(?:[befnrtv0'"]|[0-7]{3}|u(?:[0-9a-fA-F]{4}|\{[0-9a-fA-F]{1,6}\})))/),n.eat("'"),"atom"):n.eat("0")?(n.eat("x")?n.match(/^[0-9a-fA-F_]+/):n.eat("o")?n.match(/^[0-7_]+/):n.eat("b")&&n.match(/^[01_]+/),"number"):n.eat(/^\d/)?(n.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?/),"number"):n.match(F)?(n.eat("="),"operator"):n.match(v)||n.match(s)?"operator":(r=n.match(/[({[]/,!1))?(r=r[0],o(h(r,z[r],null),n,e)):n.eat("\\")?(n.next(),"meta"):(n.next(),null)}function h(n,e,r,t){return function(i,u){if(!t&&i.match(n))return u.tokenize[u.tokenize.length-1]=h(n,e,r,!0),u.currentIndent+=1,r;var d=_(i,u);return i.current()===e&&(u.tokenize.pop(),u.currentIndent-=1,d=r),d}}function f(n,e,r){return function(t,i){return!r&&t.match("{"+n)?(i.currentIndent+=1,i.tokenize[i.tokenize.length-1]=f(n,e,!0),"meta"):t.match(e+"}")?(i.currentIndent-=1,i.tokenize.pop(),"meta"):_(t,i)}}function D(n,e){if(n.eatSpace())return null;var r;if(r=n.match(p)){if(r=="def")return"keyword";n.eat(/[?!]/)}return e.tokenize.pop(),"def"}function E(n,e){return n.eatSpace()?null:(n.match(p)?n.eat(/[!?]/):n.match(F)||n.match(v)||n.match(x),e.tokenize.pop(),"def")}function a(n,e){return n.eatSpace()?null:(n.match(k),e.tokenize.pop(),"def")}function w(n,e,r){return function(t,i){for(var u=!1;t.peek();)if(u)t.next(),u=!1;else{if(t.match("{%",!1))return i.tokenize.push(f("%","%")),e;if(t.match("{{",!1))return i.tokenize.push(f("{","}")),e;if(r&&t.match("#{",!1))return i.tokenize.push(h("#{","}","meta")),e;var d=t.next();if(d==n)return i.tokenize.pop(),e;u=r&&d=="\\"}return e}}function N(n,e){return function(r,t){if(r.sol()&&(r.eatSpace(),r.match(n)))return t.tokenize.pop(),"string";for(var i=!1;r.peek();)if(i)r.next(),i=!1;else{if(r.match("{%",!1))return t.tokenize.push(f("%","%")),"string";if(r.match("{{",!1))return t.tokenize.push(f("{","}")),"string";if(e&&r.match("#{",!1))return t.tokenize.push(h("#{","}","meta")),"string";i=e&&r.next()=="\\"}return"string"}}return{startState:function(){return{tokenize:[_],currentIndent:0,lastToken:null,lastStyle:null,blocks:[]}},token:function(n,e){var r=e.tokenize[e.tokenize.length-1](n,e),t=n.current();return r&&r!="comment"&&(e.lastToken=t,e.lastStyle=r),r},indent:function(n,e){return e=e.replace(/^\s*(?:\{%)?\s*|\s*(?:%\})?\s*$/g,""),Z.test(e)||j.test(e)?y.indentUnit*(n.currentIndent-1):y.indentUnit*n.currentIndent},fold:"indent",electricInput:l(g.concat(b),!0),lineComment:"#"}}),c.defineMIME("text/x-crystal","crystal")});
Site is undergoing maintenance

PACJA Events

Maintenance mode is on

Site will be available soon. Thank you for your patience!