ParserCommon.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
  4. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  5. //-------------------------------------------------------------------------------------------------------
  6. // Common definitions used outside parser so that we don't have to include the whole Parser.h.
  7. #pragma once
  8. namespace Js
  9. {
  10. typedef int32 ByteCodeLabel; // Size of this match the offset size in layouts
  11. typedef uint32 RegSlot;
  12. typedef uint8 RegSlot_OneByte;
  13. typedef int8 RegSlot_OneSByte;
  14. typedef int16 RegSlot_TwoSByte;
  15. typedef uint16 RegSlot_TwoByte;
  16. }
  17. enum ErrorTypeEnum
  18. {
  19. kjstError,
  20. kjstEvalError,
  21. kjstRangeError,
  22. kjstReferenceError,
  23. kjstSyntaxError,
  24. kjstTypeError,
  25. kjstURIError,
  26. kjstAggregateError,
  27. kjstWebAssemblyCompileError,
  28. kjstWebAssemblyRuntimeError,
  29. kjstWebAssemblyLinkError,
  30. kjstCustomError,
  31. };
  32. class ParseNode;
  33. class ParseNodeFnc;
  34. typedef ParseNode *ParseNodePtr;
  35. struct Ident;
  36. struct PidRefStack;
  37. typedef Ident *IdentPtr;
  38. struct ModuleImportOrExportEntry
  39. {
  40. IdentPtr moduleRequest;
  41. IdentPtr importName;
  42. IdentPtr localName;
  43. IdentPtr exportName;
  44. PidRefStack* pidRefStack;
  45. charcount_t offset;
  46. };
  47. typedef SList<ModuleImportOrExportEntry, ArenaAllocator> ModuleImportOrExportEntryList;
  48. typedef SList<IdentPtr, ArenaAllocator> IdentPtrList;
  49. typedef JsUtil::BaseHashSet<IdentPtr, ArenaAllocator, PowerOf2SizePolicy> IdentPtrSet;
  50. //
  51. // Below was moved from scrutil.h to share with chakradiag.
  52. //
  53. #define HR(sc) ((HRESULT)(sc))