1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-01 02:27:20 -04:00
notes/node_modules/postcss-less/dist/tokenizer/find-end-of-expression.js
Patrick Marsceill b7b0d0d7bf
Initial commit
2017-03-09 13:16:08 -05:00

46 lines
1.1 KiB
JavaScript

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = findEndOfExpression;
var _globals = require('./globals');
function findEndOfExpression(css, length, i) {
var openedParenthesisBlocks = 0;
var openedCurlyBlocks = 0;
for (; i < length; ++i) {
var symbolCode = css[i].charCodeAt(0);
// find the on of escaped expression
if (!openedParenthesisBlocks && !openedCurlyBlocks && (symbolCode === _globals.semicolon || symbolCode === _globals.closedCurlyBracket)) {
return i - 1;
}
switch (symbolCode) {
case _globals.openedCurlyBracket:
openedCurlyBlocks++;
break;
case _globals.closedCurlyBracket:
openedCurlyBlocks--;
break;
case _globals.openedParenthesis:
openedParenthesisBlocks++;
break;
case _globals.closedParenthesis:
openedParenthesisBlocks--;
break;
default:
break;
}
}
return -1;
}
module.exports = exports['default'];