Skip to content

Commit 0704416

Browse files
committed
[sql mode] Add backslashStringEscapes option
Turn it off for mssql Closes codemirror#5229
1 parent ab8bf8e commit 0704416

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mode/sql/sql.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
2121
operatorChars = parserConfig.operatorChars || /^[*+\-%<>!=&|~^]/,
2222
support = parserConfig.support || {},
2323
hooks = parserConfig.hooks || {},
24-
dateSQL = parserConfig.dateSQL || {"date" : true, "time" : true, "timestamp" : true};
24+
dateSQL = parserConfig.dateSQL || {"date" : true, "time" : true, "timestamp" : true},
25+
backslashStringEscapes = parserConfig.backslashStringEscapes !== false
2526

2627
function tokenBase(stream, state) {
2728
var ch = stream.next();
@@ -125,7 +126,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
125126
state.tokenize = tokenBase;
126127
break;
127128
}
128-
escaped = !escaped && ch == "\\";
129+
escaped = backslashStringEscapes && !escaped && ch == "\\";
129130
}
130131
return "string";
131132
};
@@ -292,6 +293,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
292293
builtin: set("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),
293294
atoms: set("false true null unknown"),
294295
operatorChars: /^[*+\-%<>!=]/,
296+
backslashStringEscapes: false,
295297
dateSQL: set("date datetimeoffset datetime2 smalldatetime datetime time"),
296298
hooks: {
297299
"@": hookVar

0 commit comments

Comments
 (0)