|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
598 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | /**
|
|---|
| 4 | * @param {string} input
|
|---|
| 5 | * @return {[number, number, number][]}
|
|---|
| 6 | */
|
|---|
| 7 | module.exports = function commentParser(input) {
|
|---|
| 8 | /** @type [number, number, number][] */
|
|---|
| 9 | const tokens = [];
|
|---|
| 10 | const length = input.length;
|
|---|
| 11 | let pos = 0;
|
|---|
| 12 | let next;
|
|---|
| 13 |
|
|---|
| 14 | while (pos < length) {
|
|---|
| 15 | next = input.indexOf('/*', pos);
|
|---|
| 16 |
|
|---|
| 17 | if (~next) {
|
|---|
| 18 | tokens.push([0, pos, next]);
|
|---|
| 19 | pos = next;
|
|---|
| 20 |
|
|---|
| 21 | next = input.indexOf('*/', pos + 2);
|
|---|
| 22 | tokens.push([1, pos + 2, next]);
|
|---|
| 23 | pos = next + 2;
|
|---|
| 24 | } else {
|
|---|
| 25 | tokens.push([0, pos, length]);
|
|---|
| 26 | pos = length;
|
|---|
| 27 | }
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | return tokens;
|
|---|
| 31 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.