go.js 5.0 KB

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