Skip to content

Commit

Permalink
Fix last comma with newline token
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Mar 1, 2016
1 parent 20e7567 commit 81461f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion preprocess.es6
Expand Up @@ -42,7 +42,13 @@ export default function preprocess(input, lines) {
if ( type === ',' ) {
lastComma = true;
break;
} else if ( type !== 'space' && type !== 'comment' ) {
} else if ( type === 'space' ) {
continue;
} else if ( type === 'comment' ) {
continue;
} else if ( type === 'newline' ) {
continue;
} else {
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/preprocess.js
Expand Up @@ -64,10 +64,10 @@ test('detects at-rules', t => {
});

test('detects last comma', t => {
run(t, [[['word', 'ab'], [',', ',']]], [
run(t, [[['word', 'ab'], [',', ','], ['newline', '\n']]], [
{
...defaults,
tokens: [['word', 'ab'], [',', ',']],
tokens: [['word', 'ab'], [',', ','], ['newline', '\n']],
lastComma: true
}
]);
Expand Down

0 comments on commit 81461f9

Please sign in to comment.