mirror of
https://github.com/owncast/owncast.git
synced 2025-01-04 15:47:41 +03:00
1 line
No EOL
3.7 KiB
JavaScript
Vendored
1 line
No EOL
3.7 KiB
JavaScript
Vendored
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[673],{20673:function(e,t,n){n.r(t),n.d(t,{cypher:function(){return c}});var r,wordRegexp=function(e){return RegExp("^(?:"+e.join("|")+")$","i")},tokenBase=function(e){r=null;var t=e.next();if('"'===t)return e.match(/^.*?"/),"string";if("'"===t)return e.match(/^.*?'/),"string";if(/[{}\(\),\.;\[\]]/.test(t))return r=t,"punctuation";if("/"===t&&e.eat("/"))return e.skipToEnd(),"comment";if(l.test(t))return e.eatWhile(l),null;if(e.eatWhile(/[_\w\d]/),e.eat(":"))return e.eatWhile(/[\w\d_\-]/),"atom";var n=e.current();return o.test(n)?"builtin":a.test(n)?"def":s.test(n)||i.test(n)?"keyword":"variable"},pushContext=function(e,t,n){return e.context={prev:e.context,indent:e.indent,col:n,type:t}},popContext=function(e){return e.indent=e.context.indent,e.context=e.context.prev},o=wordRegexp(["abs","acos","allShortestPaths","asin","atan","atan2","avg","ceil","coalesce","collect","cos","cot","count","degrees","e","endnode","exp","extract","filter","floor","haversin","head","id","keys","labels","last","left","length","log","log10","lower","ltrim","max","min","node","nodes","percentileCont","percentileDisc","pi","radians","rand","range","reduce","rel","relationship","relationships","replace","reverse","right","round","rtrim","shortestPath","sign","sin","size","split","sqrt","startnode","stdev","stdevp","str","substring","sum","tail","tan","timestamp","toFloat","toInt","toString","trim","type","upper"]),a=wordRegexp(["all","and","any","contains","exists","has","in","none","not","or","single","xor"]),s=wordRegexp(["as","asc","ascending","assert","by","case","commit","constraint","create","csv","cypher","delete","desc","descending","detach","distinct","drop","else","end","ends","explain","false","fieldterminator","foreach","from","headers","in","index","is","join","limit","load","match","merge","null","on","optional","order","periodic","profile","remove","return","scan","set","skip","start","starts","then","true","union","unique","unwind","using","when","where","with","call","yield"]),i=wordRegexp(["access","active","assign","all","alter","as","catalog","change","copy","create","constraint","constraints","current","database","databases","dbms","default","deny","drop","element","elements","exists","from","grant","graph","graphs","if","index","indexes","label","labels","management","match","name","names","new","node","nodes","not","of","on","or","password","populated","privileges","property","read","relationship","relationships","remove","replace","required","revoke","role","roles","set","show","start","status","stop","suspended","to","traverse","type","types","user","users","with","write"]),l=/[*+\-<>=&|~%^]/;let c={name:"cypher",startState:function(){return{tokenize:tokenBase,context:null,indent:0,col:0}},token:function(e,t){if(e.sol()&&(t.context&&null==t.context.align&&(t.context.align=!1),t.indent=e.indentation()),e.eatSpace())return null;var n=t.tokenize(e,t);if("comment"!==n&&t.context&&null==t.context.align&&"pattern"!==t.context.type&&(t.context.align=!0),"("===r)pushContext(t,")",e.column());else if("["===r)pushContext(t,"]",e.column());else if("{"===r)pushContext(t,"}",e.column());else if(/[\]\}\)]/.test(r)){for(;t.context&&"pattern"===t.context.type;)popContext(t);t.context&&r===t.context.type&&popContext(t)}else"."===r&&t.context&&"pattern"===t.context.type?popContext(t):/atom|string|variable/.test(n)&&t.context&&(/[\}\]]/.test(t.context.type)?pushContext(t,"pattern",e.column()):"pattern"!==t.context.type||t.context.align||(t.context.align=!0,t.context.col=e.column()));return n},indent:function(e,t,n){var r=t&&t.charAt(0),o=e.context;if(/[\]\}]/.test(r))for(;o&&"pattern"===o.type;)o=o.prev;var a=o&&r===o.type;return o?"keywords"===o.type?null:o.align?o.col+(a?0:1):o.indent+(a?0:n.unit):0}}}}]); |