MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / tokenComment

Function tokenComment

static/js/codemirror/mode/xquery/xquery.js:229–248  ·  view source on GitHub ↗
(stream, state)

Source from the content-addressed store, hash-verified

227
228 // handle comments, including nested
229 function tokenComment(stream, state) {
230 var maybeEnd = false, maybeNested = false, nestedCount = 0, ch;
231 while (ch = stream.next()) {
232 if (ch == ")" && maybeEnd) {
233 if(nestedCount > 0)
234 nestedCount--;
235 else {
236 popStateStack(state);
237 break;
238 }
239 }
240 else if(ch == ":" && maybeNested) {
241 nestedCount++;
242 }
243 maybeEnd = (ch == ":");
244 maybeNested = (ch == "(");
245 }
246
247 return ret("comment", "comment");
248 }
249
250 // tokenizer for string literals
251 // optionally pass a tokenizer function to set state.tokenize back to when finished

Callers

nothing calls this directly

Calls 3

popStateStackFunction · 0.85
retFunction · 0.70
nextMethod · 0.45

Tested by

no test coverage detected