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

Function tokenComment

static/editor.md/lib/codemirror/mode/xquery/xquery.js:220–239  ·  view source on GitHub ↗
(stream, state)

Source from the content-addressed store, hash-verified

218
219 // handle comments, including nested
220 function tokenComment(stream, state) {
221 var maybeEnd = false, maybeNested = false, nestedCount = 0, ch;
222 while (ch = stream.next()) {
223 if (ch == ")" && maybeEnd) {
224 if(nestedCount > 0)
225 nestedCount--;
226 else {
227 popStateStack(state);
228 break;
229 }
230 }
231 else if(ch == ":" && maybeNested) {
232 nestedCount++;
233 }
234 maybeEnd = (ch == ":");
235 maybeNested = (ch == "(");
236 }
237
238 return ret("comment", "comment");
239 }
240
241 // tokenizer for string literals
242 // optionally pass a tokenizer function to set state.tokenize back to when finished

Callers

nothing calls this directly

Calls 2

popStateStackFunction · 0.85
retFunction · 0.70

Tested by

no test coverage detected