MCPcopy Index your code
hub / github.com/BloombergGraphics/whatiscode / skipSingleLineComment

Function skipSingleLineComment

scripts/libs/esprima.js:368–409  ·  view source on GitHub ↗
(offset)

Source from the content-addressed store, hash-verified

366 }
367
368 function skipSingleLineComment(offset) {
369 var start, loc, ch, comment;
370
371 start = index - offset;
372 loc = {
373 start: {
374 line: lineNumber,
375 column: index - lineStart - offset
376 }
377 };
378
379 while (index < length) {
380 ch = source.charCodeAt(index);
381 ++index;
382 if (isLineTerminator(ch)) {
383 hasLineTerminator = true;
384 if (extra.comments) {
385 comment = source.slice(start + offset, index - 1);
386 loc.end = {
387 line: lineNumber,
388 column: index - lineStart - 1
389 };
390 addComment('Line', comment, start, index - 1, loc);
391 }
392 if (ch === 13 && source.charCodeAt(index) === 10) {
393 ++index;
394 }
395 ++lineNumber;
396 lineStart = index;
397 return;
398 }
399 }
400
401 if (extra.comments) {
402 comment = source.slice(start + offset, index);
403 loc.end = {
404 line: lineNumber,
405 column: index - lineStart
406 };
407 addComment('Line', comment, start, index, loc);
408 }
409 }
410
411 function skipMultiLineComment() {
412 var start, loc, ch, comment;

Callers 1

skipCommentFunction · 0.85

Calls 2

isLineTerminatorFunction · 0.85
addCommentFunction · 0.85

Tested by

no test coverage detected