Seditio Source
Root |
./othercms/xenForo 2.2.8/js/vendor/codemirror/mode/ruby/ruby.min.js
(function(d){"object"==typeof exports&&"object"==typeof module?d(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)})(function(d){function m(d){for(var l={},g=0,n=d.length;g<n;++g)l[d[g]]=!0;return l}var q="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__".split(" "),
t=m(q),u=m("def class case for while until module then catch loop proc begin".split(" ")),v=m(["end","until"]),r={"[":"]","{":"}","(":")"},w={"]":"[","}":"{",")":"("};d.defineMode("ruby",function(m){function l(a,c,b){b.tokenize.push(a);return a(c,b)}function g(a,c){if(a.sol()&&a.match("=begin")&&a.eol())return c.tokenize.push(x),"comment";if(a.eatSpace())return null;var b=a.next();if("`"==b||"'"==b||'"'==b)return l(p(b,"string",'"'==b||"`"==b),a,c);if("/"==b){var e=a.pos;for(var h=0,f,d=!1,g=!1;null!=
(f=a.next());)if(g)g=!1;else{if(-1<"[{(".indexOf(f))h++;else if(-1<"]})".indexOf(f)){if(h--,0>h)break}else if("/"==f&&0==h){d=!0;break}g="\\"==f}a.backUp(a.pos-e);return d?l(p(b,"string-2",!0),a,c):"operator"}if("%"==b){b="string";e=!0;a.eat("s")?b="atom":a.eat(/[WQ]/)?b="string":a.eat(/[r]/)?b="string-2":a.eat(/[wxq]/)&&(b="string",e=!1);h=a.eat(/[^\w\s=]/);if(!h)return"operator";r.propertyIsEnumerable(h)&&(h=r[h]);return l(p(h,b,e,!0),a,c)}if("#"==b)return a.skipToEnd(),"comment";if("<"==b&&(e=
a.match(/^<([-~])[`"']?([a-zA-Z_?]\w*)[`"']?(?:;|$)/)))return l(y(e[2],e[1]),a,c);if("0"==b)return a.eat("x")?a.eatWhile(/[\da-fA-F]/):a.eat("b")?a.eatWhile(/[01]/):a.eatWhile(/[0-7]/),"number";if(/\d/.test(b))return a.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number";if("?"==b){for(;a.match(/^\\[CM]-/););a.eat("\\")?a.eatWhile(/\w/):a.next();return"string"}if(":"==b)return a.eat("'")?l(p("'","atom",!1),a,c):a.eat('"')?l(p('"',"atom",!0),a,c):a.eat(/[<>]/)?(a.eat(/[<>]/),"atom"):a.eat(/[\+\-\*\/&\|:!]/)?
"atom":a.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(a.eatWhile(/[\w$\xa1-\uffff]/),a.eat(/[\?!=]/),"atom"):"operator";if("@"==b&&a.match(/^@?[a-zA-Z_\xa1-\uffff]/))return a.eat("@"),a.eatWhile(/[\w\xa1-\uffff]/),"variable-2";if("$"==b)return a.eat(/[a-zA-Z_]/)?a.eatWhile(/[\w]/):a.eat(/\d/)?a.eat(/\d/):a.next(),"variable-3";if(/[a-zA-Z_\xa1-\uffff]/.test(b))return a.eatWhile(/[\w\xa1-\uffff]/),a.eat(/[\?!]/),a.eat(":")?"atom":"ident";if("|"!=b||!c.varList&&"{"!=c.lastTok&&"do"!=c.lastTok)return/[\(\)\[\]{}\\;]/.test(b)?
(k=b,null):"-"==b&&a.eat(">")?"arrow":/[=+\-\/*:\.^%<>~|]/.test(b)?(a=a.eatWhile(/[=+\-\/*:\.^%<>~|]/),"."!=b||a||(k="."),"operator"):null;k="|";return null}function n(a){a||(a=1);return function(c,b){if("}"==c.peek()){if(1==a)return b.tokenize.pop(),b.tokenize[b.tokenize.length-1](c,b);b.tokenize[b.tokenize.length-1]=n(a-1)}else"{"==c.peek()&&(b.tokenize[b.tokenize.length-1]=n(a+1));return g(c,b)}}function q(){var a=!1;return function(c,b){if(a)return b.tokenize.pop(),b.tokenize[b.tokenize.length-
1](c,b);a=!0;return g(c,b)}}function p(a,c,b,e){return function(h,f){var d=!1,g;"read-quoted-paused"===f.context.type&&(f.context=f.context.prev,h.eat("}"));for(;null!=(g=h.next());){if(g==a&&(e||!d)){f.tokenize.pop();break}if(b&&"#"==g&&!d)if(h.eat("{")){"}"==a&&(f.context={prev:f.context,type:"read-quoted-paused"});f.tokenize.push(n());break}else if(/[@\$]/.test(h.peek())){f.tokenize.push(q());break}d=!d&&"\\"==g}return c}}function y(a,c){return function(b,e){c&&b.eatSpace();b.match(a)?e.tokenize.pop():
b.skipToEnd();return"string"}}function x(a,c){a.sol()&&a.match("=end")&&a.eol()&&c.tokenize.pop();a.skipToEnd();return"comment"}var k;return{startState:function(){return{tokenize:[g],indented:0,context:{type:"top",indented:-m.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(a,c){k=null;a.sol()&&(c.indented=a.indentation());var b=c.tokenize[c.tokenize.length-1](a,c),e,d=k;if("ident"==b){var f=a.current();b="."==c.lastTok?"property":t.propertyIsEnumerable(a.current())?"keyword":
/^[A-Z]/.test(f)?"tag":"def"==c.lastTok||"class"==c.lastTok||c.varList?"def":"variable";"keyword"==b&&(d=f,u.propertyIsEnumerable(f)?e="indent":v.propertyIsEnumerable(f)?e="dedent":"if"!=f&&"unless"!=f||a.column()!=a.indentation()?"do"==f&&c.context.indented<c.indented&&(e="indent"):e="indent")}if(k||b&&"comment"!=b)c.lastTok=d;"|"==k&&(c.varList=!c.varList);"indent"==e||/[\(\[\{]/.test(k)?c.context={prev:c.context,type:k||b,indented:c.indented}:("dedent"==e||/[\)\]\}]/.test(k))&&c.context.prev&&
(c.context=c.context.prev);a.eol()&&(c.continuedLine="\\"==k||"operator"==b);return b},indent:function(a,c){if(a.tokenize[a.tokenize.length-1]!=g)return d.Pass;var b=c&&c.charAt(0),e=a.context;c=e.type==w[b]||"keyword"==e.type&&/^(?:end|until|else|elsif|when|rescue)\b/.test(c);return e.indented+(c?0:m.indentUnit)+(a.continuedLine?m.indentUnit:0)},electricInput:/^\s*(?:end|rescue|elsif|else|\})$/,lineComment:"#",fold:"indent"}});d.defineMIME("text/x-ruby","ruby");d.registerHelper("hintWords","ruby",
q)});