Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion mode/clike/clike.js
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
if (!tripleString && !escaped && stream.match('"') ) {end = true; break;}
if (tripleString && stream.match('"""')) {end = true; break;}
next = stream.next();
if(!escaped && next == "$" && stream.match('{'))
if(!escaped && next == "$" && stream.match('{')){
stream.skipTo("}");
state.tokenize = tokenBaseUntilBrace(stream, state);
return state.tokenize(stream, state);
}
escaped = !escaped && next == "\\" && !tripleString;
}
if (end || !tripleString)
Expand All @@ -593,6 +596,28 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
}
}

function tokenBaseUntilBrace() {
var depth = 1;
function t(stream, state) {
if (stream.peek() == "}") {
depth--;
if (depth == 0) {
//TODO:
//state.tokenize.pop();
//return state.tokenize[state.tokenize.length-1](stream, state);
return state.tokenize(stream, state);
}
} else if (stream.peek() == "{") {
depth++;
}
//TODO:
//return tokenBase(stream, state);
return state.tokenize(stream, state);
}
t.isBase = true;
return t;
}

def("text/x-kotlin", {
name: "clike",
keywords: words(
Expand Down