T(UnexpectedTokenIdentifier, "Unexpected identifier") \
T(UnexpectedTokenNumber, "Unexpected number") \
T(UnexpectedTokenString, "Unexpected string") \
+ T(UnexpectedTokenRegExp, "Unexpected regular expression") \
T(UnknownLabel, "Undefined label '%'") \
T(UnterminatedArgList, "missing ) after argument list") \
T(UnterminatedRegExp, "Invalid regular expression: missing /") \
case Token::SMI:
case Token::NUMBER:
classifier->RecordBindingPatternError(
- scanner()->location(), MessageTemplate::kUnexpectedTokenNumber);
+ scanner()->peek_location(), MessageTemplate::kUnexpectedTokenNumber);
Next();
result =
this->ExpressionFromLiteral(token, beg_pos, scanner(), factory());
case Token::STRING: {
classifier->RecordBindingPatternError(
- scanner()->location(), MessageTemplate::kUnexpectedTokenString);
+ scanner()->peek_location(), MessageTemplate::kUnexpectedTokenString);
Consume(Token::STRING);
result = this->ExpressionFromString(beg_pos, scanner(), factory());
break;
}
case Token::ASSIGN_DIV:
+ classifier->RecordBindingPatternError(
+ scanner()->peek_location(), MessageTemplate::kUnexpectedTokenRegExp);
result = this->ParseRegExpLiteral(true, classifier, CHECK_OK);
break;
case Token::DIV:
+ classifier->RecordBindingPatternError(
+ scanner()->peek_location(), MessageTemplate::kUnexpectedTokenRegExp);
result = this->ParseRegExpLiteral(false, classifier, CHECK_OK);
break;
case Token::TEMPLATE_SPAN:
case Token::TEMPLATE_TAIL:
+ classifier->RecordBindingPatternError(
+ scanner()->peek_location(),
+ MessageTemplate::kUnexpectedTemplateString);
result = this->ParseTemplateLiteral(Traits::NoTemplateTag(), beg_pos,
classifier, CHECK_OK);
break;
"false",
"1",
"'abc'",
+ "/abc/",
+ "`abc`",
"class {}",
"{+2 : x}",
"{-2 : x}",
"[...rest,...rest1]",
"[a,b,...rest,...rest1]",
"[a,,..rest,...rest1]",
+ "{ x : 3 }",
+ "{ x : 'foo' }",
+ "{ x : /foo/ }",
+ "{ x : `foo` }",
NULL};
// clang-format on
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,