?
Path : /home/admin/public_html/old/media/editors/codemirror/mode/rust/ |
Current File : /home/admin/public_html/old/media/editors/codemirror/mode/rust/rust.min.js |
!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("rust",function(){function a(a,b){return S=a,b}function b(b,e){var f=b.next();if('"'==f)return e.tokenize=c,e.tokenize(b,e);if("'"==f)return S="atom",b.eat("\\")?b.skipTo("'")?(b.next(),"string"):"error":(b.next(),b.eat("'")?"string":"error");if("/"==f){if(b.eat("/"))return b.skipToEnd(),"comment";if(b.eat("*"))return e.tokenize=d(1),e.tokenize(b,e)}if("#"==f)return b.eat("[")?(S="open-attr",null):(b.eatWhile(/\w/),a("macro","meta"));if(":"==f&&b.match(":<"))return a("op",null);if(f.match(/\d/)||"."==f&&b.eat(/\d/)){var g=!1;return b.match(/^x[\da-f]+/i)||b.match(/^b[01]+/)||(b.eatWhile(/\d/),b.eat(".")&&(g=!0,b.eatWhile(/\d/)),b.match(/^e[+\-]?\d+/i)&&(g=!0)),g?b.match(/^f(?:32|64)/):b.match(/^[ui](?:8|16|32|64)/),a("atom","number")}return f.match(/[()\[\]{}:;,]/)?a(f,null):"-"==f&&b.eat(">")?a("->",null):f.match(Y)?(b.eatWhile(Y),a("op",null)):(b.eatWhile(/\w/),T=b.current(),b.match(/^::\w/)?(b.backUp(1),a("prefix","variable-2")):e.keywords.propertyIsEnumerable(T)?a(e.keywords[T],T.match(/true|false/)?"atom":"keyword"):a("name","variable"))}function c(c,d){for(var e,f=!1;e=c.next();){if('"'==e&&!f)return d.tokenize=b,a("atom","string");f=!f&&"\\"==e}return a("op","string")}function d(a){return function(c,e){for(var f,g=null;f=c.next();){if("/"==f&&"*"==g){if(1==a){e.tokenize=b;break}return e.tokenize=d(a-1),e.tokenize(c,e)}if("*"==f&&"/"==g)return e.tokenize=d(a+1),e.tokenize(c,e);g=f}return"comment"}}function e(){for(var a=arguments.length-1;a>=0;a--)Z.cc.push(arguments[a])}function f(){return e.apply(null,arguments),!0}function g(a,b){var c=function(){var c=Z.state;c.lexical={indented:c.indented,column:Z.stream.column(),type:a,prev:c.lexical,info:b}};return c.lex=!0,c}function h(){var a=Z.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function i(){Z.state.keywords=X}function j(){Z.state.keywords=W}function k(a,b){function c(d){return","==d?f(a,c):d==b?f():f(c)}return function(d){return d==b?f():e(a,c)}}function l(a,b){return f(g("stat",b),a,h,m)}function m(a){return"}"==a?f():"let"==a?l(u,"let"):"fn"==a?l(y):"type"==a?f(g("stat"),z,n,h,m):"enum"==a?l(A):"mod"==a?l(C):"iface"==a?l(D):"impl"==a?l(E):"open-attr"==a?f(g("]"),k(o,"]"),h):"ignore"==a||a.match(/[\]\);,]/)?f(m):e(g("stat"),o,h,n,m)}function n(a){return";"==a?f():e()}function o(a){return"atom"==a||"name"==a?f(p):"{"==a?f(g("}"),r,h):a.match(/[\[\(]/)?Q(a,o):a.match(/[\]\)\};,]/)?e():"if-style"==a?f(o,o):"else-style"==a||"op"==a?f(o):"for"==a?f(K,w,x,o,o):"alt"==a?f(o,M):"fn"==a?f(y):"macro"==a?f(P):f()}function p(a){return"."==T?f(q):"::<"==T?f(F,p):"op"==a||":"==T?f(o):"("==a||"["==a?Q(a,o):e()}function q(){return T.match(/^\w+$/)?(Z.marked="variable",f(p)):e(o)}function r(a){if("op"==a){if("|"==T)return f(t,h,g("}","block"),m);if("||"==T)return f(h,g("}","block"),m)}return e("mutable"==T||T.match(/^\w+$/)&&":"==Z.stream.peek()&&!Z.stream.match("::",!1)?s(o):m)}function s(a){function b(c){return"mutable"==T||"with"==T?(Z.marked="keyword",f(b)):T.match(/^\w*$/)?(Z.marked="variable",f(b)):":"==c?f(a,b):"}"==c?f():f(b)}return b}function t(a){return"name"==a?(Z.marked="def",f(t)):"op"==a&&"|"==T?f():f(t)}function u(a){return a.match(/[\]\)\};]/)?f():"="==T?f(o,v):","==a?f(u):e(K,w,u)}function v(a){return a.match(/[\]\)\};,]/)?e(u):e(o,v)}function w(a){return":"==a?f(i,H,j):e()}function x(a){return"name"==a&&"in"==T?(Z.marked="keyword",f()):e()}function y(a){return"@"==T||"~"==T?(Z.marked="keyword",f(y)):"name"==a?(Z.marked="def",f(y)):"<"==T?f(F,y):"{"==a?e(o):"("==a?f(g(")"),k(G,")"),h,y):"->"==a?f(i,H,j,y):";"==a?f():f(y)}function z(a){return"name"==a?(Z.marked="def",f(z)):"<"==T?f(F,z):"="==T?f(i,H,j):f(z)}function A(a){return"name"==a?(Z.marked="def",f(A)):"<"==T?f(F,A):"="==T?f(i,H,j,n):"{"==a?f(g("}"),i,B,j,h):f(A)}function B(a){return"}"==a?f():"("==a?f(g(")"),k(H,")"),h,B):(T.match(/^\w+$/)&&(Z.marked="def"),f(B))}function C(a){return"name"==a?(Z.marked="def",f(C)):"{"==a?f(g("}"),m,h):e()}function D(a){return"name"==a?(Z.marked="def",f(D)):"<"==T?f(F,D):"{"==a?f(g("}"),m,h):e()}function E(a){return"<"==T?f(F,E):"of"==T||"for"==T?(Z.marked="keyword",f(H,E)):"name"==a?(Z.marked="def",f(E)):"{"==a?f(g("}"),m,h):e()}function F(){return">"==T?f():","==T?f(F):":"==T?f(H,F):e(H,F)}function G(a){return"name"==a?(Z.marked="def",f(G)):":"==a?f(i,H,j):e()}function H(a){return"name"==a?(Z.marked="variable-3",f(I)):"mutable"==T?(Z.marked="keyword",f(H)):"atom"==a?f(I):"op"==a||"obj"==a?f(H):"fn"==a?f(J):"{"==a?f(g("{"),s(H),h):Q(a,H)}function I(){return"<"==T?f(F):e()}function J(a){return"("==a?f(g("("),k(H,")"),h,J):"->"==a?f(H):e()}function K(a){return"name"==a?(Z.marked="def",f(L)):"atom"==a?f(L):"op"==a?f(K):a.match(/[\]\)\};,]/)?e():Q(a,K)}function L(a){return"op"==a&&"."==T?f():"to"==T?(Z.marked="keyword",f(K)):e()}function M(a){return"{"==a?f(g("}","alt"),N,h):e()}function N(a){return"}"==a?f():"|"==a?f(N):"when"==T?(Z.marked="keyword",f(o,O)):a.match(/[\]\);,]/)?f(N):e(K,O)}function O(a){return"{"==a?f(g("}","alt"),m,h,N):e(N)}function P(a){return a.match(/[\[\(\{]/)?Q(a,o):e()}function Q(a,b){return"["==a?f(g("]"),k(b,"]"),h):"("==a?f(g(")"),k(b,")"),h):"{"==a?f(g("}"),k(b,"}"),h):f()}function R(a,b,c){var d=a.cc;for(Z.state=a,Z.stream=b,Z.marked=null,Z.cc=d;;){var e=d.length?d.pop():m;if(e(S)){for(;d.length&&d[d.length-1].lex;)d.pop()();return Z.marked||c}}}var S,T,U=4,V=2,W={"if":"if-style","while":"if-style",loop:"else-style","else":"else-style","do":"else-style",ret:"else-style",fail:"else-style","break":"atom",cont:"atom","const":"let",resource:"fn",let:"let",fn:"fn","for":"for",alt:"alt",iface:"iface",impl:"impl",type:"type","enum":"enum",mod:"mod",as:"op","true":"atom","false":"atom",assert:"op",check:"op",claim:"op","native":"ignore",unsafe:"ignore","import":"else-style","export":"else-style",copy:"op",log:"op",log_err:"op",use:"op",bind:"op",self:"atom",struct:"enum"},X=function(){for(var a={fn:"fn",block:"fn",obj:"obj"},b="bool uint int i8 i16 i32 i64 u8 u16 u32 u64 float f32 f64 str char".split(" "),c=0,d=b.length;d>c;++c)a[b[c]]="atom";return a}(),Y=/[+\-*&%=<>!?|\.@]/,Z={state:null,stream:null,marked:null,cc:null};return h.lex=i.lex=j.lex=!0,{startState:function(){return{tokenize:b,cc:[],lexical:{indented:-U,column:0,type:"top",align:!1},keywords:W,indented:0}},token:function(a,b){if(a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation()),a.eatSpace())return null;S=T=null;var c=b.tokenize(a,b);return"comment"==c?c:(b.lexical.hasOwnProperty("align")||(b.lexical.align=!0),"prefix"==S?c:(T||(T=a.current()),R(b,a,c)))},indent:function(a,c){if(a.tokenize!=b)return 0;var d=c&&c.charAt(0),e=a.lexical,f=e.type,g=d==f;return"stat"==f?e.indented+U:e.align?e.column+(g?0:1):e.indented+(g?0:"alt"==e.info?V:U)},electricChars:"{}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}}),a.defineMIME("text/x-rustsrc","rust")});