Permalink
Browse files

Fix newline and spaces tokenizing

  • Loading branch information...
1 parent c77d6c0 commit 283ad4a2b701287a3374465c487ee378594a70a1 @ai ai committed Mar 5, 2016
Showing with 6 additions and 10 deletions.
  1. +5 −1 test/tokenize.js
  2. +1 −9 tokenize.es6
View
@@ -13,7 +13,11 @@ test('tokenizes inine comments', t => {
test('tokenizes inine comments and new lines', t => {
run(t, '// a\r\n', [ ['comment', '// a', 1, 1, 1, 4, 'inline'],
- ['newline', '\r\n', 1] ]);
+ ['newline', '\r\n', 1] ]);
+});
+
+test('tokenizes new lines arround spaces', t => {
+ run(t, ' \n ', [ ['space', ' '], ['newline', '\n', 1], ['space', ' '] ]);
});
test('tokenizes Windows new lines', t => {
View
@@ -71,15 +71,7 @@ export default function tokenize(input) {
do {
next += 1;
code = css.charCodeAt(next);
- if ( code === NEWLINE ) {
- offset = next;
- line += 1;
- }
- } while ( code === SPACE ||
- code === NEWLINE ||
- code === TAB ||
- code === CR ||
- code === FEED );
+ } while ( code === SPACE || code === TAB );
tokens.push(['space', css.slice(pos, next)]);
pos = next - 1;

0 comments on commit 283ad4a

Please sign in to comment.