[loose parser] Fetch token before comment when tokenizer raises unterminated comment error

Closes #197
This commit is contained in:
Marijn Haverbeke 2015-01-13 22:18:55 +01:00
parent cee56dab67
commit 0f55a53a7d
2 changed files with 3 additions and 0 deletions

View File

@ -242,6 +242,7 @@
tokExprAllowed = !!exprAllowed;
skipSpace();
};
getToken.current = function() { return new Token(); };
getToken.options = options;
return getToken;
};

View File

@ -105,6 +105,8 @@
replace = {start: e.pos, end: pos,
type: input.charAt(e.pos) == "`" ? tt.template : tt.templateContinued,
value: input.slice(e.pos + 1, pos)};
} else if (/comment/.test(msg)) {
replace = fetchToken.current();
} else {
replace = false;
}