perrors.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. // parser error messages
  6. // NOTE: the error numbers should not change from version to version.
  7. // Error numbers MUST be sorted.
  8. LSC_ERROR_MSG(1001, ERRnoMemory , "Out of memory")
  9. LSC_ERROR_MSG(1002, ERRsyntax , "Syntax error")
  10. LSC_ERROR_MSG(1003, ERRnoColon , "Expected ':'")
  11. LSC_ERROR_MSG(1004, ERRnoSemic , "Expected ';'")
  12. LSC_ERROR_MSG(1005, ERRnoLparen , "Expected '('")
  13. LSC_ERROR_MSG(1006, ERRnoRparen , "Expected ')'")
  14. LSC_ERROR_MSG(1007, ERRnoRbrack , "Expected ']'")
  15. LSC_ERROR_MSG(1008, ERRnoLcurly , "Expected '{'")
  16. LSC_ERROR_MSG(1009, ERRnoRcurly , "Expected '}'")
  17. LSC_ERROR_MSG(1010, ERRnoIdent , "Expected identifier")
  18. LSC_ERROR_MSG(1011, ERRnoEq , "Expected '='")
  19. LSC_ERROR_MSG(1012, ERRnoSlash , "Expected '/'")
  20. LSC_ERROR_MSG(1013, ERRbadNumber , "Invalid number")
  21. LSC_ERROR_MSG(1014, ERRillegalChar , "Invalid character")
  22. LSC_ERROR_MSG(1015, ERRnoStrEnd , "Unterminated string constant")
  23. LSC_ERROR_MSG(1016, ERRnoCmtEnd , "Unterminated comment")
  24. LSC_ERROR_MSG(1017, ERRIdAfterLit , "Unexpected identifier after numeric literal")
  25. LSC_ERROR_MSG(1018, ERRbadReturn , "'return' statement outside of function")
  26. LSC_ERROR_MSG(1019, ERRbadBreak , "Can't have 'break' outside of loop")
  27. LSC_ERROR_MSG(1020, ERRbadContinue , "Can't have 'continue' outside of loop")
  28. LSC_ERROR_MSG(1023, ERRbadHexDigit , "Expected hexadecimal digit")
  29. LSC_ERROR_MSG(1024, ERRnoWhile , "Expected 'while'")
  30. LSC_ERROR_MSG(1025, ERRbadLabel , "Label redefined")
  31. LSC_ERROR_MSG(1026, ERRnoLabel , "Label not found")
  32. LSC_ERROR_MSG(1027, ERRdupDefault , "'default' can only appear once in a 'switch' statement")
  33. LSC_ERROR_MSG(1028, ERRnoMemberIdent , "Expected identifier, string or number")
  34. LSC_ERROR_MSG(1029, ERRTooManyArgs , "Too many arguments")
  35. // RETIRED Cc no longer supported ;; LSC_ERROR_MSG( 1030, ERRccOff , "Conditional compilation is turned off")
  36. LSC_ERROR_MSG(1031, ERRnotConst , "Expected constant")
  37. // RETIRED Cc no longer supported ;; LSC_ERROR_MSG( 1032, ERRnoAt , "Expected '@'")
  38. LSC_ERROR_MSG(1033, ERRnoCatch , "Expected 'catch'")
  39. LSC_ERROR_MSG(1034, ERRnoVar , "Expected 'var'")
  40. LSC_ERROR_MSG(1035, ERRdanglingThrow , "'throw' must be followed by an expression on the same source line")
  41. // RETIRED ECMACP removed ;; LSC_ERROR_MSG( 1036, ERRWithNotInCP , "'with' not available in the ECMA 327 Compact Profile")
  42. LSC_ERROR_MSG(1037, ERRES5NoWith , "'with' statements are not allowed in strict mode") // string 8
  43. LSC_ERROR_MSG(1038, ERRES5ArgSame , "Duplicate formal parameter names not allowed in strict mode") // string 9
  44. LSC_ERROR_MSG(1039, ERRES5NoOctal , "Octal numeric literals and escape characters not allowed in strict mode") // string 1
  45. LSC_ERROR_MSG(1041, ERREvalUsage , "Invalid usage of 'eval' in strict mode") // string 3
  46. LSC_ERROR_MSG(1042, ERRArgsUsage , "Invalid usage of 'arguments' in strict mode") // string 3
  47. LSC_ERROR_MSG(1045, ERRInvalidDelete , "Calling delete on expression not allowed in strict mode") //string 4
  48. LSC_ERROR_MSG(1046, ERRDupeObjLit , "Multiple definitions of a property not allowed in strict mode") //string 7
  49. LSC_ERROR_MSG(1047, ERRFncDeclNotSourceElement, "In strict mode, function declarations cannot be nested inside a statement or block. They may only appear at the top level or directly inside a function body.")
  50. LSC_ERROR_MSG(1048, ERRKeywordNotId , "The use of a keyword for an identifier is invalid")
  51. LSC_ERROR_MSG(1049, ERRFutureReservedWordNotId, "The use of a future reserved word for an identifier is invalid")
  52. LSC_ERROR_MSG(1050, ERRFutureReservedWordInStrictModeNotId, "The use of a future reserved word for an identifier is invalid. The identifier name is reserved in strict mode.")
  53. LSC_ERROR_MSG(1051, ERRSetterMustHaveOneParameter, "Setter functions must have exactly one parameter")
  54. LSC_ERROR_MSG(1052, ERRRedeclaration , "Let/Const redeclaration") // "var x; let x;" is also a redeclaration
  55. LSC_ERROR_MSG(1053, ERRUninitializedConst , "Const must be initialized")
  56. LSC_ERROR_MSG(1054, ERRDeclOutOfStmt , "Declaration outside statement context")
  57. LSC_ERROR_MSG(1055, ERRAssignmentToConst , "Assignment to const")
  58. LSC_ERROR_MSG(1056, ERRUnicodeOutOfRange , "Unicode escape sequence value is higher than 0x10FFFF")
  59. LSC_ERROR_MSG(1057, ERRInvalidSpreadUse , "Invalid use of the ... operator. Spread can only be used in call arguments or an array literal.")
  60. LSC_ERROR_MSG(1058, ERRInvalidSuper , "Invalid use of the 'super' keyword")
  61. LSC_ERROR_MSG(1059, ERRInvalidSuperScope , "The 'super' keyword cannot be used at global scope")
  62. LSC_ERROR_MSG(1060, ERRSuperInIndirectEval , "The 'super' keyword cannot be used in an indirect eval() call")
  63. LSC_ERROR_MSG(1061, ERRSuperInGlobalEval , "The 'super' keyword cannot be used in a globally scoped eval() call")
  64. LSC_ERROR_MSG(1062, ERRnoDArrow , "Expected '=>'")
  65. LSC_ERROR_MSG(1063, ERRInvalidCodePoint , "Invalid codepoint value in the escape sequence.")
  66. LSC_ERROR_MSG(1064, ERRMissingCurlyBrace , "Closing curly brace ('}') expected.")
  67. LSC_ERROR_MSG(1065, ERRRestLastArg, "The rest parameter must be the last parameter in a formals list.")
  68. LSC_ERROR_MSG(1066, ERRRestWithDefault, "The rest parameter cannot have a default initializer.")
  69. LSC_ERROR_MSG(1067, ERRUnexpectedEllipsis, "Unexpected ... operator")
  70. LSC_ERROR_MSG(1068, ERRDestructInit, "Destructuring declarations must have an initializer")
  71. LSC_ERROR_MSG(1069, ERRDestructRestLast, "Destructuring rest variables must be in the last position of the expression")
  72. LSC_ERROR_MSG(1070, ERRUnexpectedDefault, "Unexpected default initializer")
  73. LSC_ERROR_MSG(1071, ERRDestructNoOper, "Unexpected operator in destructuring expression")
  74. LSC_ERROR_MSG(1072, ERRDestructIDRef, "Destructuring expressions can only have identifier references")
  75. LSC_ERROR_MSG(1073, ERRYieldInTryCatchOrFinally, "'yield' expressions are not allowed in 'try', 'catch', or 'finally' blocks")
  76. LSC_ERROR_MSG(1074, ERRConstructorCannotBeGenerator, "Class constructor may not be a generator")
  77. LSC_ERROR_MSG(1075, ERRInvalidAssignmentTarget, "Invalid destructuring assignment target")
  78. LSC_ERROR_MSG(1076, ERRFormalSame, "Duplicate formal parameter names not allowed in this context")
  79. LSC_ERROR_MSG(1077, ERRDestructNotInit, "Destructuring declarations cannot have an initializer")
  80. LSC_ERROR_MSG(1078, ERRCoalesce, "Coalescing operator '\?\?' not permitted unparenthesized inside '||' or '&&' expressions")
  81. LSC_ERROR_MSG(1079, ERRInvalidNewTarget, "Invalid use of the 'new.target' keyword")
  82. LSC_ERROR_MSG(1080, ERRForInNoInitAllowed, "for-in loop head declarations cannot have an initializer")
  83. LSC_ERROR_MSG(1081, ERRForOfNoInitAllowed, "for-of loop head declarations cannot have an initializer")
  84. LSC_ERROR_MSG(1082, ERRNonSimpleParamListInStrictMode, "Illegal 'use strict' directive in function with non-simple parameter list")
  85. LSC_ERROR_MSG(1083, ERRBadAwait, "'await' expression not allowed in this context")
  86. LSC_ERROR_MSG(1084, ERRGetterMustHaveNoParameters, "Getter functions must have no parameters")
  87. LSC_ERROR_MSG(1085, ERRInvalidUseofExponentiationOperator, "Invalid unary operator on the left hand side of exponentiation (**) operator")
  88. LSC_ERROR_MSG(1086, ERRInvalidModuleImportOrExport, "'import' or 'export' can only occur at top level.")
  89. LSC_ERROR_MSG(1087, ERRInvalidExportName, "Unable to resolve module export name")
  90. LSC_ERROR_MSG(1088, ERRLetIDInLexicalDecl, "'let' is not an allowed identifier in lexical declarations")
  91. LSC_ERROR_MSG(1089, ERRInvalidLHSInFor, "Invalid left-hand side in for loop")
  92. LSC_ERROR_MSG(1090, ERRLabelBeforeLexicalDeclaration, "Labels not allowed before lexical declaration")
  93. LSC_ERROR_MSG(1091, ERRLabelBeforeGeneratorDeclaration, "Labels not allowed before generator declaration")
  94. LSC_ERROR_MSG(1092, ERRLabelBeforeAsyncFncDeclaration, "Labels not allowed before async function declaration")
  95. LSC_ERROR_MSG(1093, ERRLabelBeforeClassDeclaration, "Labels not allowed before class declaration")
  96. LSC_ERROR_MSG(1094, ERRLabelFollowedByEOF, "Unexpected end of script after a label.")
  97. LSC_ERROR_MSG(1095, ERRFunctionAfterLabelInStrict, "Function declarations not allowed after a label in strict mode.")
  98. LSC_ERROR_MSG(1096, ERRAwaitAsLabelInAsync, "Use of 'await' as label in async function is not allowed.")
  99. LSC_ERROR_MSG(1097, ERRExperimental, "Use of disabled experimental feature")
  100. LSC_ERROR_MSG(1098, ERRDuplicateExport, "Duplicate export of name '%s'")
  101. LSC_ERROR_MSG(1099, ERRStmtOfWithIsLabelledFunc, "The statement of a 'with' statement cannot be a labelled function.")
  102. LSC_ERROR_MSG(1100, ERRUndeclaredExportName, "Export of name '%s' which has no local definition.")
  103. LSC_ERROR_MSG(1101, ERRModuleImportOrExportInScript, "'import' or 'export' can only be used in module code.")
  104. LSC_ERROR_MSG(1102, ERRInvalidAsgTarget, "Invalid left-hand side in assignment.")
  105. LSC_ERROR_MSG(1103, ERRMissingFrom, "Expected 'from' after import or export clause.")
  106. //1104-1199 available for future use
  107. // Generic errors intended to be re-usable
  108. LSC_ERROR_MSG(1200, ERRKeywordAfter, "Unexpected keyword '%s' after '%s'")
  109. LSC_ERROR_MSG(1201, ERRTokenAfter, "Unexpected token '%s' after '%s'")
  110. LSC_ERROR_MSG(1202, ERRIdentifierAfter, "Unexpected identifier '%s' after '%s'")
  111. LSC_ERROR_MSG(1203, ERRInvalidIdentifier, "Unexpected invalid identifier '%s' after '%s'")
  112. LSC_ERROR_MSG(1205, ERRValidIfFollowedBy, "%s is only valid if followed by %s")