MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / docCommentLine

Function docCommentLine

src/cm/modes/luau/index.ts:320–369  ·  view source on GitHub ↗
(stream, state)

Source from the content-addressed store, hash-verified

318};
319
320const docCommentLine: Tokenizer = (stream, state) => {
321 if (stream.sol()) {
322 popTokenizer(state);
323 return normal(stream, state);
324 }
325
326 if (stream.eatSpace()) return null;
327
328 const peek = stream.peek();
329 if (!peek) {
330 state.docCommentExpectParamName = false;
331 state.docCommentExpectType = false;
332 return null;
333 }
334
335 if (stream.match(/(?:\\|@)[A-Za-z_][A-Za-z0-9_]*/)) {
336 const tag = stream.current();
337 state.docCommentExpectParamName = /(?:\\|@)param$/.test(tag);
338 state.docCommentExpectType = false;
339 return "attributeName";
340 }
341
342 if (state.docCommentExpectParamName && isWordStart(peek)) {
343 stream.next();
344 stream.eatWhile(isWord);
345 state.docCommentExpectParamName = false;
346 state.docCommentExpectType = true;
347 return "variableName";
348 }
349
350 if (
351 state.docCommentExpectType &&
352 (isWordStart(peek) ||
353 peek === "{" ||
354 peek === "(" ||
355 peek === "[" ||
356 peek === "?" ||
357 peek === "." ||
358 peek === "|")
359 ) {
360 stream.next();
361 stream.eatWhile(/[^\s,;]+/);
362 state.docCommentExpectType = false;
363 return "typeName";
364 }
365
366 stream.next();
367 stream.eatWhile((char) => !/\s/.test(char));
368 return "comment";
369};
370
371function readNumber(stream: StringStream, firstChar: string) {
372 const next = stream.peek();

Callers

nothing calls this directly

Calls 3

popTokenizerFunction · 0.85
normalFunction · 0.85
isWordStartFunction · 0.85

Tested by

no test coverage detected