go.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. "use strict";
  2. /*!-----------------------------------------------------------------------------
  3. * Copyright (c) Microsoft Corporation. All rights reserved.
  4. * Version: 0.38.0(0e330ae453813de4e6cf272460fb79c7117073d0)
  5. * Released under the MIT license
  6. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  7. *-----------------------------------------------------------------------------*/
  8. define("vs/basic-languages/go/go", ["require"],(require)=>{
  9. var moduleExports = (() => {
  10. var __defProp = Object.defineProperty;
  11. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  12. var __getOwnPropNames = Object.getOwnPropertyNames;
  13. var __hasOwnProp = Object.prototype.hasOwnProperty;
  14. var __export = (target, all) => {
  15. for (var name in all)
  16. __defProp(target, name, { get: all[name], enumerable: true });
  17. };
  18. var __copyProps = (to, from, except, desc) => {
  19. if (from && typeof from === "object" || typeof from === "function") {
  20. for (let key of __getOwnPropNames(from))
  21. if (!__hasOwnProp.call(to, key) && key !== except)
  22. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  23. }
  24. return to;
  25. };
  26. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  27. // src/basic-languages/go/go.ts
  28. var go_exports = {};
  29. __export(go_exports, {
  30. conf: () => conf,
  31. language: () => language
  32. });
  33. var conf = {
  34. comments: {
  35. lineComment: "//",
  36. blockComment: ["/*", "*/"]
  37. },
  38. brackets: [
  39. ["{", "}"],
  40. ["[", "]"],
  41. ["(", ")"]
  42. ],
  43. autoClosingPairs: [
  44. { open: "{", close: "}" },
  45. { open: "[", close: "]" },
  46. { open: "(", close: ")" },
  47. { open: "`", close: "`", notIn: ["string"] },
  48. { open: '"', close: '"', notIn: ["string"] },
  49. { open: "'", close: "'", notIn: ["string", "comment"] }
  50. ],
  51. surroundingPairs: [
  52. { open: "{", close: "}" },
  53. { open: "[", close: "]" },
  54. { open: "(", close: ")" },
  55. { open: "`", close: "`" },
  56. { open: '"', close: '"' },
  57. { open: "'", close: "'" }
  58. ]
  59. };
  60. var language = {
  61. defaultToken: "",
  62. tokenPostfix: ".go",
  63. keywords: [
  64. "break",
  65. "case",
  66. "chan",
  67. "const",
  68. "continue",
  69. "default",
  70. "defer",
  71. "else",
  72. "fallthrough",
  73. "for",
  74. "func",
  75. "go",
  76. "goto",
  77. "if",
  78. "import",
  79. "interface",
  80. "map",
  81. "package",
  82. "range",
  83. "return",
  84. "select",
  85. "struct",
  86. "switch",
  87. "type",
  88. "var",
  89. "bool",
  90. "true",
  91. "false",
  92. "uint8",
  93. "uint16",
  94. "uint32",
  95. "uint64",
  96. "int8",
  97. "int16",
  98. "int32",
  99. "int64",
  100. "float32",
  101. "float64",
  102. "complex64",
  103. "complex128",
  104. "byte",
  105. "rune",
  106. "uint",
  107. "int",
  108. "uintptr",
  109. "string",
  110. "nil"
  111. ],
  112. operators: [
  113. "+",
  114. "-",
  115. "*",
  116. "/",
  117. "%",
  118. "&",
  119. "|",
  120. "^",
  121. "<<",
  122. ">>",
  123. "&^",
  124. "+=",
  125. "-=",
  126. "*=",
  127. "/=",
  128. "%=",
  129. "&=",
  130. "|=",
  131. "^=",
  132. "<<=",
  133. ">>=",
  134. "&^=",
  135. "&&",
  136. "||",
  137. "<-",
  138. "++",
  139. "--",
  140. "==",
  141. "<",
  142. ">",
  143. "=",
  144. "!",
  145. "!=",
  146. "<=",
  147. ">=",
  148. ":=",
  149. "...",
  150. "(",
  151. ")",
  152. "",
  153. "]",
  154. "{",
  155. "}",
  156. ",",
  157. ";",
  158. ".",
  159. ":"
  160. ],
  161. symbols: /[=><!~?:&|+\-*\/\^%]+/,
  162. escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  163. tokenizer: {
  164. root: [
  165. [
  166. /[a-zA-Z_]\w*/,
  167. {
  168. cases: {
  169. "@keywords": { token: "keyword.$0" },
  170. "@default": "identifier"
  171. }
  172. }
  173. ],
  174. { include: "@whitespace" },
  175. [/\[\[.*\]\]/, "annotation"],
  176. [/^\s*#\w+/, "keyword"],
  177. [/[{}()\[\]]/, "@brackets"],
  178. [/[<>](?!@symbols)/, "@brackets"],
  179. [
  180. /@symbols/,
  181. {
  182. cases: {
  183. "@operators": "delimiter",
  184. "@default": ""
  185. }
  186. }
  187. ],
  188. [/\d*\d+[eE]([\-+]?\d+)?/, "number.float"],
  189. [/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"],
  190. [/0[xX][0-9a-fA-F']*[0-9a-fA-F]/, "number.hex"],
  191. [/0[0-7']*[0-7]/, "number.octal"],
  192. [/0[bB][0-1']*[0-1]/, "number.binary"],
  193. [/\d[\d']*/, "number"],
  194. [/\d/, "number"],
  195. [/[;,.]/, "delimiter"],
  196. [/"([^"\\]|\\.)*$/, "string.invalid"],
  197. [/"/, "string", "@string"],
  198. [/`/, "string", "@rawstring"],
  199. [/'[^\\']'/, "string"],
  200. [/(')(@escapes)(')/, ["string", "string.escape", "string"]],
  201. [/'/, "string.invalid"]
  202. ],
  203. whitespace: [
  204. [/[ \t\r\n]+/, ""],
  205. [/\/\*\*(?!\/)/, "comment.doc", "@doccomment"],
  206. [/\/\*/, "comment", "@comment"],
  207. [/\/\/.*$/, "comment"]
  208. ],
  209. comment: [
  210. [/[^\/*]+/, "comment"],
  211. [/\*\//, "comment", "@pop"],
  212. [/[\/*]/, "comment"]
  213. ],
  214. doccomment: [
  215. [/[^\/*]+/, "comment.doc"],
  216. [/\/\*/, "comment.doc.invalid"],
  217. [/\*\//, "comment.doc", "@pop"],
  218. [/[\/*]/, "comment.doc"]
  219. ],
  220. string: [
  221. [/[^\\"]+/, "string"],
  222. [/@escapes/, "string.escape"],
  223. [/\\./, "string.escape.invalid"],
  224. [/"/, "string", "@pop"]
  225. ],
  226. rawstring: [
  227. [/[^\`]/, "string"],
  228. [/`/, "string", "@pop"]
  229. ]
  230. }
  231. };
  232. return __toCommonJS(go_exports);
  233. })();
  234. return moduleExports;
  235. });