CodeMirror.defineMIME("text/x-erlang","erlang"),CodeMirror.defineMode("erlang",function(e){function t(e,t,r){switch(e.context="record"==r?"record":!1,"whitespace"!=r&&"comment"!=r&&(e.lastToken=t.current()),r){case"atom":return"atom";case"attribute":return"attribute";case"builtin":return"builtin";case"comment":return"comment";case"fun":return"meta";case"function":return"tag";case"guard":return"property";case"keyword":return"keyword";case"macro":return"variable-2";case"number":return"number";case"operator":return"operator";case"record":return"bracket";case"string":return"string";case"type":return"def";case"variable":return"variable";case"error":return"error";case"separator":return null;case"open_paren":return null;case"close_paren":return null;default:return null}}function r(e,t){return-1=n){var i=e.string.slice(r-n,r);return i==t}return!1}function i(e,i){if(e.eatSpace())return t(i,e,"whitespace");if((""==p(i).token||"."==p(i).token)&&"-"==e.peek()){if(e.next(),e.eat(M)&&e.eatWhile(A))return r(e.current(),k)?t(i,e,"type"):t(i,e,"attribute");e.backUp(1)}var c=e.next();if("%"==c)return e.skipToEnd(),t(i,e,"comment");if("?"==c)return e.eatWhile(A),t(i,e,"macro");if("#"==c)return e.eatWhile(A),t(i,e,"record");if("$"==c)return"\\"==e.next()&&(e.eatWhile(T)||e.next()),t(i,e,"string");if("'"==c)return u(e)?t(i,e,"atom"):t(i,e,"error");if('"'==c)return s(e)?t(i,e,"string"):t(i,e,"error");if(q.test(c))return e.eatWhile(A),t(i,e,"variable");if(M.test(c)){if(e.eatWhile(A),"/"==e.peek())return e.next(),e.eatWhile(E)?t(i,e,"fun"):(e.backUp(1),t(i,e,"atom"));var l=e.current();return r(l,h)?(b(i,e),t(i,e,"keyword")):"("==e.peek()?!r(l,S)||n(e,":")&&!n(e,"erlang:")?t(i,e,"function"):t(i,e,"builtin"):r(l,z)?t(i,e,"guard"):r(l,x)?t(i,e,"operator"):":"==e.peek()?"erlang"==l?t(i,e,"builtin"):t(i,e,"function"):t(i,e,"atom")}return E.test(c)?(e.eatWhile(E),e.eat("#")?e.eatWhile(E):(e.eat(".")&&e.eatWhile(E),e.eat(/[eE]/)&&(e.eat(/[-+]/),e.eatWhile(E))),t(i,e,"number")):o(e,Z,w)?(b(i,e),t(i,e,"open_paren")):o(e,I,W)?(b(i,e),t(i,e,"close_paren")):a(e,O,y)?(0==i.context&&b(i,e),t(i,e,"separator")):a(e,C,v)?t(i,e,"operator"):t(i,e,null)}function o(e,t,n){if(1==e.current().length&&t.test(e.current())){for(e.backUp(1);t.test(e.peek());)if(e.next(),r(e.current(),n))return!0;e.backUp(e.current().length-1)}return!1}function a(e,t,n){if(1==e.current().length&&t.test(e.current())){for(;t.test(e.peek());)e.next();for(;0"==a?"end"==s?p(t,2).column:"fun"==p(t,2).token?p(t,2).column+i:p(t).indent+i:r(s,o)?p(t).indent:p(t).column+i}function f(e,t){var r=e.match(t);return r?e.slice(0,r.index):e}function d(e){return e.tokenStack.pop()}function p(e,t){var r=e.tokenStack.length,n=t?t:1;return n>r?new l:e.tokenStack[r-n]}function b(e,t){var n=t.current(),i=p(e).token;return r(n,U)?!1:g(i,n)?(d(e),!1):m(i,n)?(d(e),b(e,t)):(e.tokenStack.push(new l(t)),!0)}function m(e,t){switch(e+" "+t){case"when ->":return!0;case"-> end":return!0;case"-> .":return!0;case". .":return!0;default:return!1}}function g(e,t){switch(e+" "+t){case"( )":return!0;case"[ ]":return!0;case"{ }":return!0;case"<< >>":return!0;case"begin end":return!0;case"case end":return!0;case"fun end":return!0;case"if end":return!0;case"receive end":return!0;case"try end":return!0;case"-> ;":return!0;default:return!1}}var k=["-type","-spec","-export_type","-opaque"],h=["after","begin","catch","case","cond","end","fun","if","let","of","query","receive","try","when"],y=["->",";",":",".",","],x=["and","andalso","band","bnot","bor","bsl","bsr","bxor","div","not","or","orelse","rem","xor"],v=["+","-","*","/",">",">=","<","=<","=:=","==","=/=","/=","||","<-"],w=["<<","(","[","{"],W=["}","]",")",">>"],z=["is_atom","is_binary","is_bitstring","is_boolean","is_float","is_function","is_integer","is_list","is_number","is_pid","is_port","is_record","is_reference","is_tuple","atom","binary","bitstring","boolean","function","integer","list","number","pid","port","record","reference","tuple"],S=["abs","adler32","adler32_combine","alive","apply","atom_to_binary","atom_to_list","binary_to_atom","binary_to_existing_atom","binary_to_list","binary_to_term","bit_size","bitstring_to_list","byte_size","check_process_code","contact_binary","crc32","crc32_combine","date","decode_packet","delete_module","disconnect_node","element","erase","exit","float","float_to_list","garbage_collect","get","get_keys","group_leader","halt","hd","integer_to_list","internal_bif","iolist_size","iolist_to_binary","is_alive","is_atom","is_binary","is_bitstring","is_boolean","is_float","is_function","is_integer","is_list","is_number","is_pid","is_port","is_process_alive","is_record","is_reference","is_tuple","length","link","list_to_atom","list_to_binary","list_to_bitstring","list_to_existing_atom","list_to_float","list_to_integer","list_to_pid","list_to_tuple","load_module","make_ref","module_loaded","monitor_node","node","node_link","node_unlink","nodes","notalive","now","open_port","pid_to_list","port_close","port_command","port_connect","port_control","pre_loaded","process_flag","process_info","processes","purge_module","put","register","registered","round","self","setelement","size","spawn","spawn_link","spawn_monitor","spawn_opt","split_binary","statistics","term_to_binary","time","throw","tl","trunc","tuple_size","tuple_to_list","unlink","unregister","whereis"],U=[",",":","catch","after","of","cond","let","query"],M=/[a-z_]/,q=/[A-Z_]/,E=/[0-9]/,T=/[0-7]/,A=/[a-z_A-Z0-9]/,C=/[\+\-\*\/<>=\|:]/,Z=/[<\(\[\{]/,I=/[>\)\]\}]/,O=/[\->\.,:;]/;return{startState:function(){return{tokenStack:[],context:!1,lastToken:null}},token:function(e,t){return i(e,t)},indent:function(e,t){return _(e,t)}}});