@@ -14,18 +14,6 @@ var openInterpolation = "{".charCodeAt(0);
1414var closeInterpolation = "}" . charCodeAt ( 0 ) ;
1515var isUnicodeRange = / ^ [ a - f 0 - 9 ? - ] + $ / i;
1616
17- function isOpenInterpolation ( code , value , pos , interpolation ) {
18- return (
19- interpolation !== null &&
20- interpolation . charCodeAt ( 0 ) === code &&
21- value . charCodeAt ( pos + 1 ) === openInterpolation
22- ) ;
23- }
24-
25- function isCloseInterpolation ( code ) {
26- return code === closeInterpolation ;
27- }
28-
2917module . exports = function ( input , options ) {
3018 var tokens = [ ] ;
3119 var value = input ;
@@ -70,7 +58,7 @@ module.exports = function(input, options) {
7058
7159 prev = tokens [ tokens . length - 1 ] ;
7260 if (
73- ( code === closeParentheses || isCloseInterpolation ( code ) ) &&
61+ ( code === closeParentheses || code === closeInterpolation ) &&
7462 balanced
7563 ) {
7664 after = token ;
@@ -177,18 +165,15 @@ module.exports = function(input, options) {
177165 code = value . charCodeAt ( pos ) ;
178166
179167 // Open parentheses
180- } else if (
181- openParentheses === code ||
182- isOpenInterpolation ( code , value , pos , interpolationPrefix )
183- ) {
168+ } else if ( openParentheses === code || openInterpolation === code ) {
184169 var isFunction = openParentheses === code ;
185170 // Whitespaces after open parentheses
186- next = isFunction ? pos : pos + 1 ;
171+ next = pos ;
187172 do {
188173 next += 1 ;
189174 code = value . charCodeAt ( next ) ;
190175 } while ( code <= 32 ) ;
191- parenthesesOpenPos = isFunction ? pos : pos + 1 ;
176+ parenthesesOpenPos = pos ;
192177 token = {
193178 type : isFunction ? "function" : "interpolation" ,
194179 sourceIndex : pos - name . length ,
@@ -261,7 +246,7 @@ module.exports = function(input, options) {
261246
262247 // Close parentheses
263248 } else if (
264- ( code === closeParentheses || isCloseInterpolation ( code ) ) &&
249+ ( code === closeParentheses || code === closeInterpolation ) &&
265250 balanced
266251 ) {
267252 pos += 1 ;
@@ -293,24 +278,22 @@ module.exports = function(input, options) {
293278 code === colon ||
294279 code === slash ||
295280 code === openParentheses ||
296- isOpenInterpolation ( code , value , pos , interpolationPrefix ) ||
281+ code === openInterpolation ||
282+ ( interpolationPrefix && code === interpolationPrefix . charCodeAt ( 0 ) ) ||
297283 ( code === star &&
298284 parent &&
299285 parent . type === "function" &&
300286 parent . value === "calc" ) ||
301287 ( code === slash &&
302288 parent . type === "function" &&
303289 parent . value === "calc" ) ||
304- ( ( code === closeParentheses || isCloseInterpolation ( code ) ) &&
290+ ( ( code === closeParentheses || code === closeInterpolation ) &&
305291 balanced )
306292 )
307293 ) ;
308294 token = value . slice ( pos , next ) ;
309295
310- if (
311- openParentheses === code ||
312- isOpenInterpolation ( code , value , pos , interpolationPrefix )
313- ) {
296+ if ( openParentheses === code || openInterpolation === code ) {
314297 name = token ;
315298 } else if (
316299 ( uLower === token . charCodeAt ( 0 ) || uUpper === token . charCodeAt ( 0 ) ) &&
0 commit comments