Skip to content
Snippets Groups Projects
Commit 83855703 authored by Marijn Haverbeke's avatar Marijn Haverbeke
Browse files

[clike mode] Simplify regexp character escaping

Issue #2594
parent 4a6f4268
No related branches found
No related tags found
No related merge requests found
......@@ -242,17 +242,13 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
// C++11 raw string literal is <prefix>"<delim>( anything )<delim>", where
// <delim> can be a string up to 16 characters long.
function tokenRawString(stream, state) {
var closingSequence = new RegExp(
".*?\\)" +
// Escape characters that have special regex meanings.
state.cpp11RawStringDelim.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') +
'"');
var match = stream.match(closingSequence);
if (match) {
// Escape characters that have special regex meanings.
var delim = state.cpp11RawStringDelim.replace(/[^\w\s]/g, '\\$&');
var match = stream.match(new RegExp(".*?\\)" + delim + '"'));
if (match)
state.tokenize = null;
} else {
else
stream.skipToEnd();
}
return "string";
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment