- md5
- f88e61c529cc39dc60f906163d4554f0
- sha1
- 1d7f00ced0a67875a2dfee82dc4a35265852f8fc
- sha256
- ee7d6581f13715e1a84f86b970b74431693e8763c7aa6c556a4c3d0a2de12ea6
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("ruby",function(e){function t(e){for(var t={},n=0,r=e.length;n<r;++n)t[e[n]]=!0;return t}function n(e,t,n){return n.tokenize.push(e),e(t,n)}function r(e,t){if(e.sol()&&e.match("=begin")&&e.eol())return t.tokenize.push(u),"comment";if(e.eatSpace())return null;var r,i=e.next();if("`"==i||"'"==i||'"'==i)return n(a(i,"string",'"'==i||"`"==i),e,t);if("/"==i)return function(e){var t,n=e.pos,r=0,i=!1,o=!1;for(;null!=(t=e.next());)if(o)o=!1;else{if("[{(".indexOf(t)>-1)r++;else if("]})".indexOf(t)>-1){if(--r<0)break}else if("/"==t&&0==r){i=!0;break}o="\\"==t}return e.backUp(e.pos-n),i}(e)?n(a(i,"string-2",!0),e,t):"operator";if("%"==i){var o="string",l=!0;e.eat("s")?o="atom":e.eat(/[WQ]/)?o="string":e.eat(/[r]/)?o="string-2":e.eat(/[wxq]/)&&(o="string",l=!1);var d=e.eat(/[^\w\s=]/);return d?(c.propertyIsEnumerable(d)&&(d=c[d]),n(a(d,o,l,!0),e,t)):"operator"}if("#"==i)return e.skipToEnd(),"comment";if("<"==i&&(r=e.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return n(function(e){return function(t,n){return t.match(e)?n.tokenize.pop():t.skipToEnd(),"string"}}(r[1]),e,t);if("0"==i)return e.eat("x")?e.eatWhile(/[\da-fA-F]/):e.eat("b")?e.eatWhile(/[01]/):e.eatWhile(/[0-7]/),"number";if(/\d/.test(i))return e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number";if("?"==i){for(;e.match(/^\\[CM]-/););return e.eat("\\")?e.eatWhile(/\w/):e.next(),"string"}if(":"==i)return e.eat("'")?n(a("'","atom",!1),e,t):e.eat('"')?n(a('"',"atom",!0),e,t):e.eat(/[\<\>]/)?(e.eat(/[\<\>]/),"atom"):e.eat(/[\+\-\*\/\&\|\:\!]/)?"atom":e.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(e.eatWhile(/[\w$\xa1-\uffff]/),e.eat(/[\?\!\=]/),"atom"):"operator";if("@"==i&&e.match(/^@?[a-zA-Z_\xa1-\uffff]/))return e.eat("@"),e.eatWhile(/[\w\xa1-\uffff]/),"variable-2";if("$"==i)return e.eat(/[a-zA-Z_]/)?e.eatWhile(/[\w]/):e.eat(/\d/)?e.eat(/\d/):e.next(),"variable-3";if(/[a-zA-Z_\xa1-\uffff]/.test(i))return e.eatWhile(/[\w\xa1-\uffff]/),e.eat(/[\?\!]/),e.eat(":")?"atom":"ident";if("|"!=i||!t.varList&&"{"!=t.lastTok&&"do"!=t.lastTok){if(/[\(\)\[\]{}\\;]/.test(i))return f=i,null;if("-"==i&&e.eat(">"))return"arrow";if(/[=+\-\/*:\.^%<>~|]/.test(i)){var s=e.eatWhile(/[=+\-\/*:\.^%<>~|]/);return"."!=i||s||(f="."),"operator"}return null}return f="|",null}function i(e){return e||(e=1),function(t,n){if("}"==t.peek()){if(1==e)return n.tokenize.pop(),n.tokenize[n.tokenize.length-1](t,n);n.tokenize[n.tokenize.length-1]=i(e-1)}else"{"==t.peek()&&(n.tokenize[n.tokenize.length-1]=i(e+1));return r(t,n)}}function o(){var e=!1;return function(t,n){return e?(n.tokenize.pop(),n.tokenize[n.tokenize.length-1](t,n)):(e=!0,r(t,n))}}function a(e,t,n,r){return function(a,u){var f,l=!1;for("read-quoted-paused"===u.context.type&&(u.context=u.context.prev,a.eat("}"));null!=(f=a.next());){if(f==e&&(r||!l)){u.tokenize.pop();break}if(n&&"#"==f&&!l){if(a.eat("{")){"}"==e&&(u.context={prev:u.context,type:"read-quoted-paused"}),u.tokenize.push(i());break}if(/[@\$]/.test(a.peek())){u.tokenize.push(o());break}}l=!l&&"\\"==f}return t}}function u(e,t){return e.sol()&&e.match("=end")&&e.eol()&&t.tokenize.pop(),e.skipToEnd(),"comment"}var f,l=t(["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload","__END__","__FILE__","__LINE__","__dir__"]),d=t(["def","class","case","for","while","until","module","then","catch","loop","proc","begin"]),s=t(["end","until"]),c={"[":"]","{":"}","(":")"};return{startState:function(){return{tokenize:[r],indented:0,context:{type:"top",indented:-e.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,t){f=null,e.sol()&&(t.indented=e.indentation());var n,r=t.tokenize[t.tokenize.length-1](e,t),i=f;if("ident"==r){var o=e.current();"keyword"==(r="."==t.lastTok?"property":l.propertyIsEnumerable(e.current())?"keyword":/^[A-Z]/.test(o)?"tag":"def"==t.lastTok||"class"==t.lastTok||t.varList?"def":"variable")&&(i=o,d.propertyIsEnumerable(o)?n="indent":s.propertyIsEnumerable(o)?n="dedent":"if"!=o&&"unless"!=o||e.column()!=e.indentation()?"do"==o&&t.context.indented<t.indented&&(n="indent"):n="indent")}return(f||r&&"comment"!=r)&&(t.lastTok=i),"|"==f&&(t.varList=!t.varList),"indent"==n||/[\(\[\{]/.test(f)?t.context={prev:t.context,type:f||r,indented:t.indented}:("dedent"==n||/[\)\]\}]/.test(f))&&t.context.prev&&(t.context=t.context.prev),e.eol()&&(t.continuedLine="\\"==f||"operator"==r),r},indent:function(t,n){if(t.tokenize[t.tokenize.length-1]!=r)return 0;var i=n&&n.charAt(0),o=t.context,a=o.type==c[i]||"keyword"==o.type&&/^(?:end|until|else|elsif|when|rescue)\b/.test(n);return o.indented+(a?0:e.indentUnit)+(t.continuedLine?e.indentUnit:0)},electricInput:/^\s*(?:end|rescue|elsif|else|\})$/,lineComment:"#",fold:"indent"}}),e.defineMIME("text/x-ruby","ruby")});
No other release has this exact content. See every version of this file.