MCPcopy Create free account
hub / github.com/TruthHun/BookStack / startString

Function startString

static/editor.md/lib/codemirror/mode/kotlin/kotlin.js:96–135  ·  view source on GitHub ↗
(quote, stream, state)

Source from the content-addressed store, hash-verified

94 tokenBase.isBase = true;
95
96 function startString(quote, stream, state) {
97 var tripleQuoted = false;
98 if (quote != "/" && stream.eat(quote)) {
99 if (stream.eat(quote)) tripleQuoted = true;
100 else return "string";
101 }
102 function t(stream, state) {
103 var escaped = false, next, end = !tripleQuoted;
104
105 while ((next = stream.next()) != null) {
106 if (next == quote && !escaped) {
107 if (!tripleQuoted) {
108 break;
109 }
110 if (stream.match(quote + quote)) {
111 end = true;
112 break;
113 }
114 }
115
116 if (quote == '"' && next == "$" && !escaped && stream.eat("{")) {
117 state.tokenize.push(tokenBaseUntilBrace());
118 return "string";
119 }
120
121 if (next == "$" && !escaped && !stream.eat(" ")) {
122 state.tokenize.push(tokenBaseUntilSpace());
123 return "string";
124 }
125 escaped = !escaped && next == "\\";
126 }
127 if (multiLineStrings)
128 state.tokenize.push(t);
129 if (end) state.tokenize.pop();
130 return "string";
131 }
132
133 state.tokenize.push(t);
134 return t(stream, state);
135 }
136
137 function tokenBaseUntilBrace() {
138 var depth = 1;

Callers 1

tokenBaseFunction · 0.70

Calls 1

tFunction · 0.70

Tested by

no test coverage detected