Skip to content

Commit

Permalink
Store the uri ends
Browse files Browse the repository at this point in the history
  • Loading branch information
bgriffith committed Nov 6, 2016
1 parent 6dae643 commit 5d422ae
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/scss/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -4137,6 +4137,8 @@ function checkUriRaw(i) {
else break;
}

tokens[start].uri_raw_end = i;

return i - start;
}

Expand All @@ -4153,7 +4155,7 @@ function getUriRaw() {
let content = [];
let l;

while (pos < tokensLength) {
while (pos < tokens[startPos].uri_raw_end) {
if (checkInterpolation(pos) || checkVariable(pos)) break;
else if (l = checkUriRawCharacters(pos)) pos += l;
else break;
Expand Down Expand Up @@ -4189,6 +4191,8 @@ function checkUri1(i) {
// Check that we are at the end of the uri
if (i < tokens[start - 1].right) return 0;

tokens[start].uri_end = i;

return i - start;
}

Expand All @@ -4211,7 +4215,7 @@ function getUri1() {

if (checkSC(pos)) content = content.concat(getSC());

while (pos < tokens[startPos + 1].right) {
while (pos < tokens[startPos + 2].uri_end) {
if (checkInterpolation(pos)) content.push(getInterpolation());
else if (checkUriRaw(pos)) content.push(getUriRaw());
else break;
Expand Down Expand Up @@ -4252,6 +4256,8 @@ function checkUri2(i) {
else break;
}

tokens[start].uri_end = i;

return i - start;
}

Expand All @@ -4267,10 +4273,10 @@ function getUri2() {
let content = [];
let end;

// Skip url and (
// Skip `url` and `(`
pos += 2;

while (pos < tokensLength) {
while (pos < tokens[startPos + 2].uri_end) {
if (checkSC(pos)) content = content.concat(getSC());
else if (checkUnary(pos)) content.push(getUnary());
else if (_checkValue(pos)) content.push(_getValue());
Expand All @@ -4279,7 +4285,7 @@ function getUri2() {

end = getLastPosition(content, line, column, 1);

// Skip )
// Skip `)`
pos++;

return newNode(NodeType.UriType, content, line, column, end);
Expand Down

0 comments on commit 5d422ae

Please sign in to comment.