source: imaps-frontend/node_modules/webpack-sources/lib/helpers/splitIntoPotentialTokens.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 739 bytes
Line 
1// \n = 10
2// ; = 59
3// { = 123
4// } = 125
5// <space> = 32
6// \r = 13
7// \t = 9
8
9const splitIntoPotentialTokens = str => {
10 const len = str.length;
11 if (len === 0) return null;
12 const results = [];
13 let i = 0;
14 for (; i < len; ) {
15 const s = i;
16 block: {
17 let cc = str.charCodeAt(i);
18 while (cc !== 10 && cc !== 59 && cc !== 123 && cc !== 125) {
19 if (++i >= len) break block;
20 cc = str.charCodeAt(i);
21 }
22 while (
23 cc === 59 ||
24 cc === 32 ||
25 cc === 123 ||
26 cc === 125 ||
27 cc === 13 ||
28 cc === 9
29 ) {
30 if (++i >= len) break block;
31 cc = str.charCodeAt(i);
32 }
33 if (cc === 10) {
34 i++;
35 }
36 }
37 results.push(str.slice(s, i));
38 }
39 return results;
40};
41module.exports = splitIntoPotentialTokens;
Note: See TracBrowser for help on using the repository browser.