mirror of
https://github.com/owncast/owncast.git
synced 2024-12-23 09:40:49 +03:00
1 line
No EOL
7.8 KiB
JavaScript
Vendored
1 line
No EOL
7.8 KiB
JavaScript
Vendored
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7590],{53482:function(e,t,r){r.r(t),r.d(t,{erlang:function(){return N}});var n=["-type","-spec","-export_type","-opaque"],i=["after","begin","catch","case","cond","end","fun","if","let","of","query","receive","try","when"],a=/[\->,;]/,o=["->",";",","],c=["and","andalso","band","bnot","bor","bsl","bsr","bxor","div","not","or","orelse","rem","xor"],s=/[\+\-\*\/<>=\|:!]/,u=["=","+","-","*","/",">",">=","<","=<","=:=","==","=/=","/=","||","<-","!"],l=/[<\(\[\{]/,_=["<<","(","[","{"],f=/[>\)\]\}]/,p=["}","]",")",">>"],m=["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"],d=["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"],b=/[\w@Ø-ÞÀ-Öß-öø-ÿ]/,k=/[0-7]{1,3}|[bdefnrstv\\"']|\^[a-zA-Z]|x[0-9a-zA-Z]{2}|x{[0-9a-zA-Z]+}/;function g(e,t,r){if(1==e.current().length&&t.test(e.current())){for(e.backUp(1);t.test(e.peek());)if(e.next(),x(e.current(),r))return!0;e.backUp(e.current().length-1)}return!1}function h(e,t,r){if(1==e.current().length&&t.test(e.current())){for(;t.test(e.peek());)e.next();for(;0<e.current().length;){if(x(e.current(),r))return!0;e.backUp(1)}e.next()}return!1}function y(e){return w(e,'"',"\\")}function v(e){return w(e,"'","\\")}function w(e,t,r){for(;!e.eol();){var n=e.next();if(n==t)return!0;n==r&&e.next()}return!1}function x(e,t){return -1<t.indexOf(e)}function S(e,t,r){var n,i,a,o;switch(n=e,"comment"==(i=z(t.current(),t.column(),t.indentation(),r)).type||"whitespace"==i.type||(n.tokenStack=(0<(o=(a=n.tokenStack).length-1)&&"record"===a[o].type&&"dot"===i.type?a.pop():(0<o&&"group"===a[o].type&&a.pop(),a.push(i)),a),n.tokenStack=function(e){if(!e.length)return e;var t=e.length-1;if("dot"===e[t].type)return[];if(t>1&&"fun"===e[t].type&&"fun"===e[t-1].token)return e.slice(0,t-1);switch(e[t].token){case"}":return E(e,{g:["{"]});case"]":return E(e,{i:["["]});case")":return E(e,{i:["("]});case">>":return E(e,{i:["<<"]});case"end":return E(e,{i:["begin","case","fun","if","receive","try"]});case",":return E(e,{e:["begin","try","when","->",",","(","[","{","<<"]});case"->":return E(e,{r:["when"],m:["try","if","case","receive"]});case";":return E(e,{E:["case","fun","if","receive","try","when"]});case"catch":return E(e,{e:["try"]});case"of":return E(e,{e:["case"]});case"after":return E(e,{e:["receive","try"]});default:return e}}(n.tokenStack)),r){case"atom":case"boolean":return"atom";case"attribute":return"attribute";case"builtin":return"builtin";case"close_paren":case"colon":case"dot":case"open_paren":case"separator":default:return null;case"comment":return"comment";case"error":return"error";case"fun":return"meta";case"function":return"tag";case"guard":return"property";case"keyword":return"keyword";case"macro":return"macroName";case"number":return"number";case"operator":return"operator";case"record":return"bracket";case"string":return"string";case"type":return"def";case"variable":return"variable"}}function z(e,t,r,n){return{token:e,column:t,indent:r,type:n}}function W(e,t){var r=e.tokenStack.length,n=t||1;return!(r<n)&&e.tokenStack[r-n]}function E(e,t){for(var r in t)for(var n=e.length-1,i=t[r],a=n-1;-1<a;a--)if(x(e[a].token,i)){var o,c=e.slice(0,a);switch(r){case"m":return c.concat(e[a]).concat(e[n]);case"r":return c.concat(e[n]);case"i":return c;case"g":return c.concat(z(o="group",0,0,o));case"E":case"e":return c.concat(e[a])}}return"E"==r?[]:e}function U(e,t){var r=e.tokenStack,n=A(r,"token",t);return!!Z(r[n])&&r[n]}function A(e,t,r){for(var n=e.length-1;-1<n;n--)if(x(e[n][t],r))return n;return!1}function Z(e){return!1!==e&&null!=e}let N={name:"erlang",startState:()=>({tokenStack:[],in_string:!1,in_atom:!1}),token:function(e,t){if(t.in_string)return t.in_string=!y(e),S(t,e,"string");if(t.in_atom)return t.in_atom=!v(e),S(t,e,"atom");if(e.eatSpace())return S(t,e,"whitespace");if(!W(t)&&e.match(/-\s*[a-zß-öø-ÿ][\wØ-ÞÀ-Öß-öø-ÿ]*/))return x(e.current(),n)?S(t,e,"type"):S(t,e,"attribute");var r=e.next();if("%"==r)return e.skipToEnd(),S(t,e,"comment");if(":"==r)return S(t,e,"colon");if("?"==r)return e.eatSpace(),e.eatWhile(b),S(t,e,"macro");if("#"==r)return e.eatSpace(),e.eatWhile(b),S(t,e,"record");if("$"==r)return"\\"!=e.next()||e.match(k)?S(t,e,"number"):S(t,e,"error");if("."==r)return S(t,e,"dot");if("'"==r){if(!(t.in_atom=!v(e))){if(e.match(/\s*\/\s*[0-9]/,!1))return e.match(/\s*\/\s*[0-9]/,!0),S(t,e,"fun");if(e.match(/\s*\(/,!1)||e.match(/\s*:/,!1))return S(t,e,"function")}return S(t,e,"atom")}if('"'==r)return t.in_string=!y(e),S(t,e,"string");if(/[A-Z_Ø-ÞÀ-Ö]/.test(r))return e.eatWhile(b),S(t,e,"variable");if(/[a-z_ß-öø-ÿ]/.test(r)){if(e.eatWhile(b),e.match(/\s*\/\s*[0-9]/,!1))return e.match(/\s*\/\s*[0-9]/,!0),S(t,e,"fun");var w,z=e.current();return x(z,i)?S(t,e,"keyword"):x(z,c)?S(t,e,"operator"):e.match(/\s*\(/,!1)?x(z,d)&&(":"!=W(t).token||"erlang"==W(t,2).token)?S(t,e,"builtin"):x(z,m)?S(t,e,"guard"):S(t,e,"function"):":"==((w=e.match(/^\s*([^\s%])/,!1))?w[1]:"")?"erlang"==z?S(t,e,"builtin"):S(t,e,"function"):x(z,["true","false"])?S(t,e,"boolean"):S(t,e,"atom")}var E=/[0-9]/;return E.test(r)?(e.eatWhile(E),e.eat("#")?e.eatWhile(/[0-9a-zA-Z]/)||e.backUp(1):e.eat(".")&&(e.eatWhile(E)?!e.eat(/[eE]/)||(e.eat(/[-+]/)?e.eatWhile(E)||e.backUp(2):e.eatWhile(E)||e.backUp(1)):e.backUp(1)),S(t,e,"number")):g(e,l,_)?S(t,e,"open_paren"):g(e,f,p)?S(t,e,"close_paren"):h(e,a,o)?S(t,e,"separator"):h(e,s,u)?S(t,e,"operator"):S(t,e,null)},indent:function(e,t,r){var n,i,a,o,c,s,u,l=Z(s=t.match(/,|[a-z]+|\}|\]|\)|>>|\|+|\(/))&&0===s.index?s[0]:"",f=W(e,1),m=W(e,2);if(e.in_string||e.in_atom)return null;if(!m)return 0;if("when"==f.token)return f.column+r.unit;if("when"===l&&"function"===m.type)return m.indent+r.unit;if("("===l&&"fun"===f.token)return f.column+3;if("catch"===l&&(u=U(e,["try"])))return u.column;if(x(l,["end","after","of"]))return(u=U(e,["begin","case","fun","if","receive","try"]))?u.column:null;else if(x(l,p))return(u=U(e,_))?u.column:null;else if(x(f.token,[",","|","||"])||x(l,[",","|","||"]))return(i=A(n=e.tokenStack.slice(0,-1),"type",["open_paren"]),u=!!Z(n[i])&&n[i])?u.column+u.token.length:r.unit;else return"->"==f.token?x(m.token,["receive","case","if","try"])?m.column+r.unit+r.unit:m.column+r.unit:x(f.token,_)?f.column+f.token.length:Z((o=A(a=e.tokenStack,"type",["open_paren","separator","keyword"]),c=A(a,"type",["operator"]),u=Z(o)&&Z(c)&&o<c?a[o+1]:!!Z(o)&&a[o]))?u.column+r.unit:0},languageData:{commentTokens:{line:"%"}}}}}]); |