From b591c41513f02dcb9bfb07fcae001658c790d6fc Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Test whether a semicolon can be inserted at the current position.
function canInsertSemicolon() {
- return tokType === _eof || tokType === _braceR ||
- !options.strictSemicolons &&
- newline.test(input.slice(lastEnd, tokStart));
+ return !options.strictSemicolons &&
+ (tokType === _eof || tokType === _braceR || newline.test(input.slice(lastEnd, tokStart)));
}Consume a semicolon, or, failing that, see if we are allowed to pretend that there is a semicolon at this position.
function semicolon() {
if (!eat(_semi) && !canInsertSemicolon()) unexpected();
@@ -1168,7 +1167,7 @@ for array literals). function parseIdent(liberal) {
var node = startNode();
- node.name = tokType === _name ? tokVal : (liberal && tokType.keyword) || unexpected();
+ node.name = tokType === _name ? tokVal : (liberal && !options.forbidReserved && tokType.keyword) || unexpected();
next();
return finishNode(node, "Identifier");
}