MCPcopy Create free account
hub / github.com/nwutils/nw-sample-apps / startString

Function startString

mini-code-edit/cm/mode/groovy/groovy.js:66–90  ·  view source on GitHub ↗
(quote, stream, state)

Source from the content-addressed store, hash-verified

64 tokenBase.isBase = true;
65
66 function startString(quote, stream, state) {
67 var tripleQuoted = false;
68 if (quote != "/" && stream.eat(quote)) {
69 if (stream.eat(quote)) tripleQuoted = true;
70 else return "string";
71 }
72 function t(stream, state) {
73 var escaped = false, next, end = !tripleQuoted;
74 while ((next = stream.next()) != null) {
75 if (next == quote && !escaped) {
76 if (!tripleQuoted) { break; }
77 if (stream.match(quote + quote)) { end = true; break; }
78 }
79 if (quote == '"' && next == "$" && !escaped && stream.eat("{")) {
80 state.tokenize.push(tokenBaseUntilBrace());
81 return "string";
82 }
83 escaped = !escaped && next == "\\";
84 }
85 if (end) state.tokenize.pop();
86 return "string";
87 }
88 state.tokenize.push(t);
89 return t(stream, state);
90 }
91
92 function tokenBaseUntilBrace() {
93 var depth = 1;

Callers 1

tokenBaseFunction · 0.85

Calls 1

tFunction · 0.70

Tested by

no test coverage detected