Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
597 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.default = commentParser;
|
---|
7 |
|
---|
8 | function commentParser(input) {
|
---|
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 | next = input.indexOf('*/', pos + 2);
|
---|
21 | tokens.push([1, pos + 2, next]);
|
---|
22 | pos = next + 2;
|
---|
23 | } else {
|
---|
24 | tokens.push([0, pos, length]);
|
---|
25 | pos = length;
|
---|
26 | }
|
---|
27 | }
|
---|
28 |
|
---|
29 | return tokens;
|
---|
30 | }
|
---|
31 |
|
---|
32 | module.exports = exports.default; |
---|
Note:
See
TracBrowser
for help on using the repository browser.