MCPcopy Index your code
hub / github.com/dchester/jsonpath / skipMultiLineComment

Function skipMultiLineComment

jsonpath.js:417–464  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

415 }
416
417 function skipMultiLineComment() {
418 var start, loc, ch, comment;
419
420 if (extra.comments) {
421 start = index - 2;
422 loc = {
423 start: {
424 line: lineNumber,
425 column: index - lineStart - 2
426 }
427 };
428 }
429
430 while (index < length) {
431 ch = source.charCodeAt(index);
432 if (isLineTerminator(ch)) {
433 if (ch === 0x0D && source.charCodeAt(index + 1) === 0x0A) {
434 ++index;
435 }
436 ++lineNumber;
437 ++index;
438 lineStart = index;
439 if (index >= length) {
440 throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
441 }
442 } else if (ch === 0x2A) {
443 // Block comment ends with '*/'.
444 if (source.charCodeAt(index + 1) === 0x2F) {
445 ++index;
446 ++index;
447 if (extra.comments) {
448 comment = source.slice(start + 2, index - 2);
449 loc.end = {
450 line: lineNumber,
451 column: index - lineStart
452 };
453 addComment('Block', comment, start, index, loc);
454 }
455 return;
456 }
457 ++index;
458 } else {
459 ++index;
460 }
461 }
462
463 throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
464 }
465
466 function skipComment() {
467 var ch, start;

Callers 1

skipCommentFunction · 0.85

Calls 3

isLineTerminatorFunction · 0.85
throwErrorFunction · 0.85
addCommentFunction · 0.85

Tested by

no test coverage detected