mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 01:36:24 +01:00
updated codemirror to 5.57.0
This commit is contained in:
17
libraries/codemirror/mode/sql/sql.js
vendored
17
libraries/codemirror/mode/sql/sql.js
vendored
@@ -65,6 +65,14 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
|
||||
// charset casting: _utf8'str', N'str', n'str'
|
||||
// ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html
|
||||
return "keyword";
|
||||
} else if (support.escapeConstant && (ch == "e" || ch == "E")
|
||||
&& (stream.peek() == "'" || (stream.peek() == '"' && support.doubleQuote))) {
|
||||
// escape constant: E'str', e'str'
|
||||
// ref: https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE
|
||||
state.tokenize = function(stream, state) {
|
||||
return (state.tokenize = tokenLiteral(stream.next(), true))(stream, state);
|
||||
}
|
||||
return "keyword";
|
||||
} else if (support.commentSlashSlash && ch == "/" && stream.eat("/")) {
|
||||
// 1-line comment
|
||||
stream.skipToEnd();
|
||||
@@ -88,7 +96,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
|
||||
return null
|
||||
// .table_name (ODBC)
|
||||
// // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html
|
||||
if (support.ODBCdotTable && stream.match(/^[\w\d_]+/))
|
||||
if (support.ODBCdotTable && stream.match(/^[\w\d_$#]+/))
|
||||
return "variable-2";
|
||||
} else if (operatorChars.test(ch)) {
|
||||
// operators
|
||||
@@ -122,7 +130,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
|
||||
}
|
||||
|
||||
// 'string', with char specified in quote escaped by '\'
|
||||
function tokenLiteral(quote) {
|
||||
function tokenLiteral(quote, backslashEscapes) {
|
||||
return function(stream, state) {
|
||||
var escaped = false, ch;
|
||||
while ((ch = stream.next()) != null) {
|
||||
@@ -130,7 +138,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
escaped = backslashStringEscapes && !escaped && ch == "\\";
|
||||
escaped = (backslashStringEscapes || backslashEscapes) && !escaped && ch == "\\";
|
||||
}
|
||||
return "string";
|
||||
};
|
||||
@@ -413,8 +421,9 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
|
||||
builtin: set("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),
|
||||
atoms: set("false true null unknown"),
|
||||
operatorChars: /^[*\/+\-%<>!=&|^\/#@?~]/,
|
||||
backslashStringEscapes: false,
|
||||
dateSQL: set("date time timestamp"),
|
||||
support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")
|
||||
support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast escapeConstant")
|
||||
});
|
||||
|
||||
// Google's SQL-like query language, GQL
|
||||
|
||||
Reference in New Issue
Block a user