diff --git a/lib/scss-tokenize.js b/lib/scss-tokenize.js index 4c19ffd..f3e4ef5 100644 --- a/lib/scss-tokenize.js +++ b/lib/scss-tokenize.js @@ -76,7 +76,7 @@ module.exports = function scssTokenize (input, options = {}) { stringQuote = false stringEscaped = false } else if (code === BACKSLASH) { - stringEscaped = !escaped + stringEscaped = !stringEscaped } else if (stringEscaped) { stringEscaped = false } diff --git a/test/tokenize.test.js b/test/tokenize.test.js index e8db202..f6ceb9c 100644 --- a/test/tokenize.test.js +++ b/test/tokenize.test.js @@ -37,6 +37,18 @@ it('tokenizes interpolation', () => { run('#{a\nb}', [['word', '#{a\nb}', 0, 5]]) }) +it('tokenizes interpolation with escaped brace', () => { + run('#{"\\}"}', [['word', '#{"\\}"}', 0, 6]]) +}) + +it('tokenizes interpolation with escaped quote', () => { + run('#{"\\""}', [['word', '#{"\\""}', 0, 6]]) +}) + +it('tokenizes interpolation with escaped backslash', () => { + run('#{"\\\\"}', [['word', '#{"\\\\"}', 0, 6]]) +}) + it('tokenizes recursively interpolations', () => { run('#{#{#{}}}', [['word', '#{#{#{}}}', 0, 8]]) })