CONST.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /**
  2. * This file contains some constants that are shared between
  3. * the transpiler and the runtime js library.
  4. * These contants are defined here, synchronized with the runtime
  5. * through the `bundle.py` script.
  6. */
  7. package transpiler
  8. /**
  9. * Names of runtime module and its properties
  10. */
  11. const (
  12. RUNTIME = "KumaChan"
  13. R_VOID = "Void"
  14. R_EVAL_SCOPE = "Eval"
  15. R_NEW_SCOPE = "new_scope"
  16. R_GET_HELPERS = "get_helpers"
  17. R_REG_MODULE = "register_module"
  18. )
  19. /**
  20. * Names of intermediate objects
  21. */
  22. const (
  23. SCOPE = "_scope"
  24. ERROR_DUMP = "_e"
  25. DUMP_TYPE = "type"
  26. DUMP_NAME = "name"
  27. DUMP_ARGS = "args"
  28. DUMP_ENSURE = "ee"
  29. DUMP_TRY = "et"
  30. TRY_ERROR = "_t_err"
  31. H_HOOK_ERROR = "_h_err"
  32. H_HOOK_SCOPE = "_h_scope"
  33. MATCH_TARGET = "_m_target"
  34. )
  35. /**
  36. * Names of local helper functions
  37. */
  38. const (
  39. L_METHOD_CALL = "_m"
  40. L_STATIC_SCOPE = "_s"
  41. L_WRAP = "_w"
  42. L_VAR_LOOKUP = "_id"
  43. L_VAR_DECL = "_dl"
  44. L_VAR_RESET = "_rt"
  45. L_ADD_FUN = "_df"
  46. L_OP_MOUNT = "_mt"
  47. L_OP_PUSH = "_ph"
  48. L_IMPORT_VAR = "_in"
  49. L_IMPORT_MOD = "_im"
  50. L_IMPORT_ALL = "_ia"
  51. L_MATCH = "_mp"
  52. L_GLOBAL_HELPERS = "__"
  53. )
  54. /**
  55. * Names of global helper functions
  56. */
  57. const (
  58. CALL = "c"
  59. OPERATOR = "o"
  60. FOR_LOOP_ITER = "fi"
  61. FOR_LOOP_ENUM = "fe"
  62. FOR_LOOP_VALUE = "fv"
  63. FOR_LOOP_ASYNC = "fa"
  64. GET = "g"
  65. SET = "s"
  66. SLICE = "sl"
  67. ITER_COMP = "ic"
  68. LIST_COMP = "lc"
  69. C_SINGLETON = "cv"
  70. C_CLASS = "cc"
  71. C_INTERFACE = "ci"
  72. C_SCHEMA = "csh"
  73. C_STRUCT = "cst"
  74. C_TYPE = "ct"
  75. C_TEMPLATE = "ctt"
  76. C_FINITE = "cft"
  77. C_ENUM = "ce"
  78. C_FUN_SIG = "cfs"
  79. C_TREE_NODE = "ctn"
  80. C_OBSERVER = "co"
  81. REQ_BOOL = "rb"
  82. REQ_TYPE = "rt"
  83. REQ_PROMISE = "rp"
  84. WHEN_FAILED = "wf"
  85. MATCH_FAILED = "mf"
  86. SWITCH_FAILED = "sf"
  87. INJECT_E_ARGS = "ie"
  88. ENSURE_FAILED = "ef"
  89. TRY_FAILED = "tf"
  90. ENTER_H_HOOK = "enh"
  91. EXIT_H_HOOK = "exh"
  92. PANIC = "pa"
  93. ASSERT = "as"
  94. THROW = "th"
  95. T_ANY = "a"
  96. T_BOOL = "b"
  97. T_VOID = "v"
  98. T_TYPE = "t"
  99. T_HASH = "h"
  100. T_PROMISE = "pm"
  101. T_INSTANCE = "i"
  102. T_ITERATOR = "it"
  103. T_ASYNC_ITERATOR = "ait"
  104. T_SLICE_INDEX_DEF = "sid"
  105. T_PLACEHOLDER = "tp"
  106. )
  107. func G (x string) string {
  108. return L_GLOBAL_HELPERS + "." + x
  109. }