Files

1 line
115 KiB
JavaScript
Raw Permalink Normal View History

2026-04-07 02:04:22 +05:30
(function(b){if(typeof exports=="object"&&typeof module=="object"){b(require("../../lib/codemirror"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],b)}else{b(CodeMirror)}}})(function(b){b.defineMode("sql",function(C,z){var B=z.client||{},w=z.atoms||{"false":true,"true":true,"null":true},s=z.builtin||{},y=z.keywords||{},x=z.operatorChars||/^[*+\-%<>!=&|~^]/,r=z.support||{},a=z.hooks||{},D=z.dateSQL||{date:true,time:true,timestamp:true};function A(c,e){var f=c.next();if(a[f]){var g=a[f](c,e);if(g!==false){return g}}if(r.hexNumber&&((f=="0"&&c.match(/^[xX][0-9a-fA-F]+/))||(f=="x"||f=="X")&&c.match(/^'[0-9a-fA-F]+'/))){return"number"}else{if(r.binaryNumber&&(((f=="b"||f=="B")&&c.match(/^'[01]+'/))||(f=="0"&&c.match(/^b[01]+/)))){return"number"}else{if(f.charCodeAt(0)>47&&f.charCodeAt(0)<58){c.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/);r.decimallessFloat&&c.eat(".");return"number"}else{if(f=="?"&&(c.eatSpace()||c.eol()||c.eat(";"))){return"variable-3"}else{if(f=="'"||(f=='"'&&r.doubleQuote)){e.tokenize=q(f);return e.tokenize(c,e)}else{if((((r.nCharCast&&(f=="n"||f=="N"))||(r.charsetCast&&f=="_"&&c.match(/[a-z][a-z0-9]*/i)))&&(c.peek()=="'"||c.peek()=='"'))){return"keyword"}else{if(/^[\(\),\;\[\]]/.test(f)){return null}else{if(r.commentSlashSlash&&f=="/"&&c.eat("/")){c.skipToEnd();return"comment"}else{if((r.commentHash&&f=="#")||(f=="-"&&c.eat("-")&&(!r.commentSpaceRequired||c.eat(" ")))){c.skipToEnd();return"comment"}else{if(f=="/"&&c.eat("*")){e.tokenize=u;return e.tokenize(c,e)}else{if(f=="."){if(r.zerolessFloat&&c.match(/^(?:\d+(?:e[+-]?\d+)?)/i)){return"number"}if(r.ODBCdotTable&&c.match(/^[a-zA-Z_]+/)){return"variable-2"}}else{if(x.test(f)){c.eatWhile(x);return null}else{if(f=="{"&&(c.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||c.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/))){return"number"}else{c.eatWhile(/^[_\w\d]/);var d=c.current().toLowerCase();if(D.hasOwnProperty(d)&&(c.match(/^( )+'[^']*'/)||c.match(/^( )+"[^"]*"/))){return"number"}if(w.hasOwnProperty(d)){return"atom"}if(s.hasOwnProperty(d)){return"builtin"}if(y.hasOwnProperty(d)){return"keyword"}if(B.hasOwnProperty(d)){return"string-2"}return null}}}}}}}}}}}}}}function q(c){return function(d,f){var e=false,g;while((g=d.next())!=null){if(g==c&&!e){f.tokenize=A;break}e=!e&&g=="\\"}return"string"}}function u(c,d){while(true){if(c.skipTo("*")){c.next();if(c.eat("/")){d.tokenize=A;break}}else{c.skipToEnd();break}}return"comment"}function v(c,d,e){d.context={prev:d.context,indent:c.indentation(),col:c.column(),type:e}}function t(c){c.indent=c.context.indent;c.context=c.context.prev}return{startState:function(){return{tokenize:A,context:null}},token:function(c,d){if(c.sol()){if(d.context&&d.context.align==null){d.context.align=false}}if(c.eatSpace()){return null}var e=d.tokenize(c,d);if(e=="comment"){return e}if(d.context&&d.context.align==null){d.context.align=true}var f=c.current();if(f=="("){v(c,d,")")}else{if(f=="["){v(c,d,"]")}else{if(d.context&&d.context.type==f){t(d)}}}return e},indent:function(c,e){var f=c.context;if(!f){return b.Pass}var d=e.charAt(0)==f.type;if(f.align){return f.col+(d?0:1)}else{return f.indent+(d?0:C.indentUnit)}},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:r.commentSlashSlash?"//":r.commentHash?"#":null}});(function(){function j(c){var d;while((d=c.next())!=null){if(d=="`"&&!c.eat("`")){return"variable-2"}}c.backUp(c.current().length-1);return c.eatWhile(/\w/)?"variable-2":null}function a(c){if(c.eat("@")){c.match(/^session\./);c.match(/^local\./);c.match(/^global\./)}if(c.eat("'")){c.match(/^.*'/);return"variable-2"}else{if(c.eat('"')){c.match(/^.*"/);return"variable-2"}else{if(c.eat("`")){c.match(/^.*`/);return"variable-2"}else{if(c.match(/^[0-9a-zA-Z$\.\_]+/)){return"variable-2"}}}}return null}function i(c){if(c.eat("N")){return"atom"}return c.match(/^[a-zA-Z.#!?]/)?"variable-2":null}var h="alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit ";function g(c){var e={