Repository: jerryscript-project/jerryscript
File: jerry-core/parser/js/js-parser-util.c (C)

Code before:
      return "Unexpected '}' token";
    }
    case PARSER_ERR_DUPLICATED_LABEL:
    {
      return "Duplicated label";
    }
    case PARSER_ERR_OBJECT_PROPERTY_REDEFINED:
    {
      return "Property of object literal redefined";
    }
    case PARSER_ERR_NON_STRICT_ARG_DEFINITION:
    {
      return "Non-strict argument definition";
    }
#if JERRY_ESNEXT
    case PARSER_ERR_VARIABLE_REDECLARED:
    {
      return ecma_error_local_variable_is_redeclared;
    }
    case PARSER_ERR_LEXICAL_SINGLE_STATEMENT:
    {
      return "Lexical declaration cannot appear in a single-statement context";
    }
    case PARSER_ERR_GENERATOR_IN_SINGLE_STATEMENT_POS:
    {
      return "Generator function is not allowed in single statement position";
    }
    case PARSER_ERR_LABELLED_FUNC_NOT_IN_BLOCK:
    {
      return "Labelled functions are only allowed inside blocks";
    }
    case PARSER_ERR_LEXICAL_LET_BINDING:
    {
      return "Let binding cannot appear in let/const declarations";
    }
    case PARSER_ERR_MISSING_ASSIGN_AFTER_CONST:
    {
      return "Value assignment is expected after a const declaration";
    }
    case PARSER_ERR_MULTIPLE_CLASS_CONSTRUCTORS:
    {
      return "Multiple constructors are not allowed";
    }
    case PARSER_ERR_CLASS_CONSTRUCTOR_AS_ACCESSOR:
    {
      return "Class constructor may not be an accessor";
    }
    case PARSER_ERR_INVALID_CLASS_CONSTRUCTOR:
    {
      return "Class constructor may not be a generator or async function";
    }

Review comment (suggestion):
Generator function cannot appear in a single-statement context
(similar error message above).
Or check v8 (node/chrome) and make a similar error message

Code after:
      return "Unexpected '}' token";
    }
    case PARSER_ERR_DUPLICATED_LABEL:
    {
      return "Duplicated label";
    }
    case PARSER_ERR_OBJECT_PROPERTY_REDEFINED:
    {
      return "Property of object literal redefined";
    }
    case PARSER_ERR_NON_STRICT_ARG_DEFINITION:
    {
      return "Non-strict argument definition";
    }
#if JERRY_ESNEXT
    case PARSER_ERR_VARIABLE_REDECLARED:
    {
      return ecma_error_local_variable_is_redeclared;
    }
    case PARSER_ERR_LEXICAL_SINGLE_STATEMENT:
    {
      return "Lexical declaration cannot appear in a single-statement context";
    }
    case PARSER_ERR_GENERATOR_IN_SINGLE_STATEMENT_POS:
    {
      return "Generator function cannot appear in a single-statement context";
    }
    case PARSER_ERR_LABELLED_FUNC_NOT_IN_BLOCK:
    {
      return "Labelled functions are only allowed inside blocks";
    }
    case PARSER_ERR_LEXICAL_LET_BINDING:
    {
      return "Let binding cannot appear in let/const declarations";
    }
    case PARSER_ERR_MISSING_ASSIGN_AFTER_CONST:
    {
      return "Value assignment is expected after a const declaration";
    }
    case PARSER_ERR_MULTIPLE_CLASS_CONSTRUCTORS:
    {
      return "Multiple constructors are not allowed";
    }
    case PARSER_ERR_CLASS_CONSTRUCTOR_AS_ACCESSOR:
    {
      return "Class constructor may not be an accessor";
    }
    case PARSER_ERR_INVALID_CLASS_CONSTRUCTOR:
    {
      return "Class constructor may not be a generator or async function";
    }