mirror of
https://github.com/owncast/owncast.git
synced 2025-01-05 08:07:58 +03:00
1 line
No EOL
8.8 KiB
JavaScript
Vendored
1 line
No EOL
8.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 h}});var n=["-type","-spec","-export_type","-opaque"],o=["after","begin","catch","case","cond","end","fun","if","let","of","query","receive","try","when"],i=/[\->,;]/,a=["->",";",","],u=["and","andalso","band","bnot","bor","bsl","bsr","bxor","div","not","or","orelse","rem","xor"],s=/[\+\-\*\/<>=\|:!]/,c=["=","+","-","*","/",">",">=","<","=<","=:=","==","=/=","/=","||","<-","!"],l=/[<\(\[\{]/,_=["<<","(","[","{"],f=/[>\)\]\}]/,m=["}","]",")",">>"],p=["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"],k=["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@Ø-ÞÀ-Öß-öø-ÿ]/,g=/[0-7]{1,3}|[bdefnrstv\\"']|\^[a-zA-Z]|x[0-9a-zA-Z]{2}|x{[0-9a-zA-Z]+}/;function tokenizer(e,t){if(t.in_string)return t.in_string=!doubleQuote(e),rval(t,e,"string");if(t.in_atom)return t.in_atom=!singleQuote(e),rval(t,e,"atom");if(e.eatSpace())return rval(t,e,"whitespace");if(!peekToken(t)&&e.match(/-\s*[a-zß-öø-ÿ][\wØ-ÞÀ-Öß-öø-ÿ]*/))return is_member(e.current(),n)?rval(t,e,"type"):rval(t,e,"attribute");var r=e.next();if("%"==r)return e.skipToEnd(),rval(t,e,"comment");if(":"==r)return rval(t,e,"colon");if("?"==r)return e.eatSpace(),e.eatWhile(b),rval(t,e,"macro");if("#"==r)return e.eatSpace(),e.eatWhile(b),rval(t,e,"record");if("$"==r)return"\\"!=e.next()||e.match(g)?rval(t,e,"number"):rval(t,e,"error");if("."==r)return rval(t,e,"dot");if("'"==r){if(!(t.in_atom=!singleQuote(e))){if(e.match(/\s*\/\s*[0-9]/,!1))return e.match(/\s*\/\s*[0-9]/,!0),rval(t,e,"fun");if(e.match(/\s*\(/,!1)||e.match(/\s*:/,!1))return rval(t,e,"function")}return rval(t,e,"atom")}if('"'==r)return t.in_string=!doubleQuote(e),rval(t,e,"string");if(/[A-Z_Ø-ÞÀ-Ö]/.test(r))return e.eatWhile(b),rval(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),rval(t,e,"fun");var h=e.current();if(is_member(h,o))return rval(t,e,"keyword");if(is_member(h,u))return rval(t,e,"operator");if(e.match(/\s*\(/,!1))return is_member(h,k)&&(":"!=peekToken(t).token||"erlang"==peekToken(t,2).token)?rval(t,e,"builtin"):is_member(h,p)?rval(t,e,"guard"):rval(t,e,"function");if(":"==lookahead(e))return"erlang"==h?rval(t,e,"builtin"):rval(t,e,"function");else if(is_member(h,["true","false"]))return rval(t,e,"boolean");else return rval(t,e,"atom")}var v=/[0-9]/;return v.test(r)?(e.eatWhile(v),e.eat("#")?e.eatWhile(/[0-9a-zA-Z]/)||e.backUp(1):e.eat(".")&&(e.eatWhile(v)?!e.eat(/[eE]/)||(e.eat(/[-+]/)?e.eatWhile(v)||e.backUp(2):e.eatWhile(v)||e.backUp(1)):e.backUp(1)),rval(t,e,"number")):nongreedy(e,l,_)?rval(t,e,"open_paren"):nongreedy(e,f,m)?rval(t,e,"close_paren"):greedy(e,i,a)?rval(t,e,"separator"):greedy(e,s,c)?rval(t,e,"operator"):rval(t,e,null)}function nongreedy(e,t,r){if(1==e.current().length&&t.test(e.current())){for(e.backUp(1);t.test(e.peek());)if(e.next(),is_member(e.current(),r))return!0;e.backUp(e.current().length-1)}return!1}function greedy(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(is_member(e.current(),r))return!0;e.backUp(1)}e.next()}return!1}function doubleQuote(e){return quote(e,'"',"\\")}function singleQuote(e){return quote(e,"'","\\")}function quote(e,t,r){for(;!e.eol();){var n=e.next();if(n==t)return!0;n==r&&e.next()}return!1}function lookahead(e){var t=e.match(/^\s*([^\s%])/,!1);return t?t[1]:""}function is_member(e,t){return -1<t.indexOf(e)}function rval(e,t,r){switch(pushToken(e,realToken(r,t)),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 aToken(e,t,r,n){return{token:e,column:t,indent:r,type:n}}function realToken(e,t){return aToken(t.current(),t.column(),t.indentation(),e)}function fakeToken(e){return aToken(e,0,0,e)}function peekToken(e,t){var r=e.tokenStack.length,n=t||1;return!(r<n)&&e.tokenStack[r-n]}function pushToken(e,t){"comment"==t.type||"whitespace"==t.type||(e.tokenStack=maybe_drop_pre(e.tokenStack,t),e.tokenStack=maybe_drop_post(e.tokenStack))}function maybe_drop_pre(e,t){var r=e.length-1;return 0<r&&"record"===e[r].type&&"dot"===t.type?e.pop():(0<r&&"group"===e[r].type&&e.pop(),e.push(t)),e}function maybe_drop_post(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 d(e,{g:["{"]});case"]":return d(e,{i:["["]});case")":return d(e,{i:["("]});case">>":return d(e,{i:["<<"]});case"end":return d(e,{i:["begin","case","fun","if","receive","try"]});case",":return d(e,{e:["begin","try","when","->",",","(","[","{","<<"]});case"->":return d(e,{r:["when"],m:["try","if","case","receive"]});case";":return d(e,{E:["case","fun","if","receive","try","when"]});case"catch":return d(e,{e:["try"]});case"of":return d(e,{e:["case"]});case"after":return d(e,{e:["receive","try"]});default:return e}}function d(e,t){for(var r in t)for(var n=e.length-1,o=t[r],i=n-1;-1<i;i--)if(is_member(e[i].token,o)){var a=e.slice(0,i);switch(r){case"m":return a.concat(e[i]).concat(e[n]);case"r":return a.concat(e[n]);case"i":return a;case"g":return a.concat(fakeToken("group"));case"E":case"e":return a.concat(e[i])}}return"E"==r?[]:e}function indenter(e,t,r){var n,o=wordafter(t),i=peekToken(e,1),a=peekToken(e,2);if(e.in_string||e.in_atom)return null;if(!a)return 0;if("when"==i.token)return i.column+r.unit;if("when"===o&&"function"===a.type)return a.indent+r.unit;if("("===o&&"fun"===i.token)return i.column+3;if("catch"===o&&(n=getToken(e,["try"])))return n.column;if(is_member(o,["end","after","of"]))return(n=getToken(e,["begin","case","fun","if","receive","try"]))?n.column:null;else if(is_member(o,m))return(n=getToken(e,_))?n.column:null;else if(is_member(i.token,[",","|","||"])||is_member(o,[",","|","||"]))return(n=postcommaToken(e))?n.column+n.token.length:r.unit;else if("->"==i.token)return is_member(a.token,["receive","case","if","try"])?a.column+r.unit+r.unit:a.column+r.unit;else if(is_member(i.token,_))return i.column+i.token.length;else return truthy(n=defaultToken(e))?n.column+r.unit:0}function wordafter(e){var t=e.match(/,|[a-z]+|\}|\]|\)|>>|\|+|\(/);return truthy(t)&&0===t.index?t[0]:""}function postcommaToken(e){var t=e.tokenStack.slice(0,-1),r=getTokenIndex(t,"type",["open_paren"]);return!!truthy(t[r])&&t[r]}function defaultToken(e){var t=e.tokenStack,r=getTokenIndex(t,"type",["open_paren","separator","keyword"]),n=getTokenIndex(t,"type",["operator"]);return truthy(r)&&truthy(n)&&r<n?t[r+1]:!!truthy(r)&&t[r]}function getToken(e,t){var r=e.tokenStack,n=getTokenIndex(r,"token",t);return!!truthy(r[n])&&r[n]}function getTokenIndex(e,t,r){for(var n=e.length-1;-1<n;n--)if(is_member(e[n][t],r))return n;return!1}function truthy(e){return!1!==e&&null!=e}let h={name:"erlang",startState:()=>({tokenStack:[],in_string:!1,in_atom:!1}),token:tokenizer,indent:indenter,languageData:{commentTokens:{line:"%"}}}}}]); |