[loose parser] Fetch token before comment when tokenizer raises unterminated comment error
Closes #197
This commit is contained in:
parent
cee56dab67
commit
0f55a53a7d
1
acorn.js
1
acorn.js
@ -242,6 +242,7 @@
|
|||||||
tokExprAllowed = !!exprAllowed;
|
tokExprAllowed = !!exprAllowed;
|
||||||
skipSpace();
|
skipSpace();
|
||||||
};
|
};
|
||||||
|
getToken.current = function() { return new Token(); };
|
||||||
getToken.options = options;
|
getToken.options = options;
|
||||||
return getToken;
|
return getToken;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -105,6 +105,8 @@
|
|||||||
replace = {start: e.pos, end: pos,
|
replace = {start: e.pos, end: pos,
|
||||||
type: input.charAt(e.pos) == "`" ? tt.template : tt.templateContinued,
|
type: input.charAt(e.pos) == "`" ? tt.template : tt.templateContinued,
|
||||||
value: input.slice(e.pos + 1, pos)};
|
value: input.slice(e.pos + 1, pos)};
|
||||||
|
} else if (/comment/.test(msg)) {
|
||||||
|
replace = fetchToken.current();
|
||||||
} else {
|
} else {
|
||||||
replace = false;
|
replace = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user