1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = findEndOfExpression;
|
7 |
|
8 | var _globals = require('./globals');
|
9 |
|
10 | function findEndOfExpression(css, length, i) {
|
11 | var openedParenthesisBlocks = 0,
|
12 | openedCurlyBlocks = 0;
|
13 |
|
14 | for (; i < length; ++i) {
|
15 | var symbolCode = css[i].charCodeAt(0);
|
16 |
|
17 |
|
18 | if (!openedParenthesisBlocks && !openedCurlyBlocks && (symbolCode === _globals.semicolon || symbolCode === _globals.closedCurlyBracket)) {
|
19 | return i - 1;
|
20 | }
|
21 |
|
22 | switch (symbolCode) {
|
23 | case _globals.openedCurlyBracket:
|
24 | openedCurlyBlocks++;
|
25 | break;
|
26 |
|
27 | case _globals.closedCurlyBracket:
|
28 | openedCurlyBlocks--;
|
29 | break;
|
30 |
|
31 | case _globals.openedParenthesis:
|
32 | openedParenthesisBlocks++;
|
33 | break;
|
34 |
|
35 | case _globals.closedParenthesis:
|
36 | openedParenthesisBlocks--;
|
37 | break;
|
38 |
|
39 | default:
|
40 | break;
|
41 | }
|
42 | }
|
43 |
|
44 | return -1;
|
45 | }
|
46 | module.exports = exports['default']; |
\ | No newline at end of file |