protobuf-GOG2TY64.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. import "./chunk-2LSFTFF7.js";
  2. // node_modules/.pnpm/monaco-editor@0.38.0/node_modules/monaco-editor/esm/vs/basic-languages/protobuf/protobuf.js
  3. var namedLiterals = ["true", "false"];
  4. var conf = {
  5. comments: {
  6. lineComment: "//",
  7. blockComment: ["/*", "*/"]
  8. },
  9. brackets: [
  10. ["{", "}"],
  11. ["[", "]"],
  12. ["(", ")"],
  13. ["<", ">"]
  14. ],
  15. surroundingPairs: [
  16. { open: "{", close: "}" },
  17. { open: "[", close: "]" },
  18. { open: "(", close: ")" },
  19. { open: "<", close: ">" },
  20. { open: '"', close: '"' },
  21. { open: "'", close: "'" }
  22. ],
  23. autoClosingPairs: [
  24. { open: "{", close: "}" },
  25. { open: "[", close: "]" },
  26. { open: "(", close: ")" },
  27. { open: "<", close: ">" },
  28. { open: '"', close: '"', notIn: ["string"] },
  29. { open: "'", close: "'", notIn: ["string"] }
  30. ],
  31. autoCloseBefore: ".,=}])>' \n ",
  32. indentationRules: {
  33. increaseIndentPattern: new RegExp("^((?!\\/\\/).)*(\\{[^}\"'`]*|\\([^)\"'`]*|\\[[^\\]\"'`]*)$"),
  34. decreaseIndentPattern: new RegExp("^((?!.*?\\/\\*).*\\*/)?\\s*[\\}\\]].*$")
  35. }
  36. };
  37. var language = {
  38. defaultToken: "",
  39. tokenPostfix: ".proto",
  40. brackets: [
  41. { open: "{", close: "}", token: "delimiter.curly" },
  42. { open: "[", close: "]", token: "delimiter.square" },
  43. { open: "(", close: ")", token: "delimiter.parenthesis" },
  44. { open: "<", close: ">", token: "delimiter.angle" }
  45. ],
  46. symbols: /[=><!~?:&|+\-*/^%]+/,
  47. keywords: [
  48. "syntax",
  49. "import",
  50. "weak",
  51. "public",
  52. "package",
  53. "option",
  54. "repeated",
  55. "oneof",
  56. "map",
  57. "reserved",
  58. "to",
  59. "max",
  60. "enum",
  61. "message",
  62. "service",
  63. "rpc",
  64. "stream",
  65. "returns",
  66. "package",
  67. "optional",
  68. "true",
  69. "false"
  70. ],
  71. builtinTypes: [
  72. "double",
  73. "float",
  74. "int32",
  75. "int64",
  76. "uint32",
  77. "uint64",
  78. "sint32",
  79. "sint64",
  80. "fixed32",
  81. "fixed64",
  82. "sfixed32",
  83. "sfixed64",
  84. "bool",
  85. "string",
  86. "bytes"
  87. ],
  88. operators: ["=", "+", "-"],
  89. namedLiterals,
  90. escapes: `\\\\(u{[0-9A-Fa-f]+}|n|r|t|\\\\|'|\\\${)`,
  91. identifier: /[a-zA-Z]\w*/,
  92. fullIdentifier: /@identifier(?:\s*\.\s*@identifier)*/,
  93. optionName: /(?:@identifier|\(\s*@fullIdentifier\s*\))(?:\s*\.\s*@identifier)*/,
  94. messageName: /@identifier/,
  95. enumName: /@identifier/,
  96. messageType: /\.?\s*(?:@identifier\s*\.\s*)*@messageName/,
  97. enumType: /\.?\s*(?:@identifier\s*\.\s*)*@enumName/,
  98. floatLit: /[0-9]+\s*\.\s*[0-9]*(?:@exponent)?|[0-9]+@exponent|\.[0-9]+(?:@exponent)?/,
  99. exponent: /[eE]\s*[+-]?\s*[0-9]+/,
  100. boolLit: /true\b|false\b/,
  101. decimalLit: /[1-9][0-9]*/,
  102. octalLit: /0[0-7]*/,
  103. hexLit: /0[xX][0-9a-fA-F]+/,
  104. type: /double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes|@messageType|@enumType/,
  105. keyType: /int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string/,
  106. tokenizer: {
  107. root: [
  108. { include: "@whitespace" },
  109. [/syntax/, "keyword"],
  110. [/=/, "operators"],
  111. [/;/, "delimiter"],
  112. [
  113. /(")(proto3)(")/,
  114. ["string.quote", "string", { token: "string.quote", switchTo: "@topLevel.proto3" }]
  115. ],
  116. [
  117. /(")(proto2)(")/,
  118. ["string.quote", "string", { token: "string.quote", switchTo: "@topLevel.proto2" }]
  119. ],
  120. [
  121. /.*?/,
  122. { token: "", switchTo: "@topLevel.proto2" }
  123. ]
  124. ],
  125. topLevel: [
  126. { include: "@whitespace" },
  127. { include: "@constant" },
  128. [/=/, "operators"],
  129. [/[;.]/, "delimiter"],
  130. [
  131. /@fullIdentifier/,
  132. {
  133. cases: {
  134. option: { token: "keyword", next: "@option.$S2" },
  135. enum: { token: "keyword", next: "@enumDecl.$S2" },
  136. message: { token: "keyword", next: "@messageDecl.$S2" },
  137. service: { token: "keyword", next: "@serviceDecl.$S2" },
  138. extend: {
  139. cases: {
  140. "$S2==proto2": { token: "keyword", next: "@extendDecl.$S2" }
  141. }
  142. },
  143. "@keywords": "keyword",
  144. "@default": "identifier"
  145. }
  146. }
  147. ]
  148. ],
  149. enumDecl: [
  150. { include: "@whitespace" },
  151. [/@identifier/, "type.identifier"],
  152. [/{/, { token: "@brackets", bracket: "@open", switchTo: "@enumBody.$S2" }]
  153. ],
  154. enumBody: [
  155. { include: "@whitespace" },
  156. { include: "@constant" },
  157. [/=/, "operators"],
  158. [/;/, "delimiter"],
  159. [/option\b/, "keyword", "@option.$S2"],
  160. [/@identifier/, "identifier"],
  161. [/\[/, { token: "@brackets", bracket: "@open", next: "@options.$S2" }],
  162. [/}/, { token: "@brackets", bracket: "@close", next: "@pop" }]
  163. ],
  164. messageDecl: [
  165. { include: "@whitespace" },
  166. [/@identifier/, "type.identifier"],
  167. [/{/, { token: "@brackets", bracket: "@open", switchTo: "@messageBody.$S2" }]
  168. ],
  169. messageBody: [
  170. { include: "@whitespace" },
  171. { include: "@constant" },
  172. [/=/, "operators"],
  173. [/;/, "delimiter"],
  174. [
  175. "(map)(s*)(<)",
  176. ["keyword", "white", { token: "@brackets", bracket: "@open", next: "@map.$S2" }]
  177. ],
  178. [
  179. /@identifier/,
  180. {
  181. cases: {
  182. option: { token: "keyword", next: "@option.$S2" },
  183. enum: { token: "keyword", next: "@enumDecl.$S2" },
  184. message: { token: "keyword", next: "@messageDecl.$S2" },
  185. oneof: { token: "keyword", next: "@oneofDecl.$S2" },
  186. extensions: {
  187. cases: {
  188. "$S2==proto2": { token: "keyword", next: "@reserved.$S2" }
  189. }
  190. },
  191. reserved: { token: "keyword", next: "@reserved.$S2" },
  192. "(?:repeated|optional)": { token: "keyword", next: "@field.$S2" },
  193. required: {
  194. cases: {
  195. "$S2==proto2": { token: "keyword", next: "@field.$S2" }
  196. }
  197. },
  198. "$S2==proto3": { token: "@rematch", next: "@field.$S2" }
  199. }
  200. }
  201. ],
  202. [/\[/, { token: "@brackets", bracket: "@open", next: "@options.$S2" }],
  203. [/}/, { token: "@brackets", bracket: "@close", next: "@pop" }]
  204. ],
  205. extendDecl: [
  206. { include: "@whitespace" },
  207. [/@identifier/, "type.identifier"],
  208. [/{/, { token: "@brackets", bracket: "@open", switchTo: "@extendBody.$S2" }]
  209. ],
  210. extendBody: [
  211. { include: "@whitespace" },
  212. { include: "@constant" },
  213. [/;/, "delimiter"],
  214. [/(?:repeated|optional|required)/, "keyword", "@field.$S2"],
  215. [/\[/, { token: "@brackets", bracket: "@open", next: "@options.$S2" }],
  216. [/}/, { token: "@brackets", bracket: "@close", next: "@pop" }]
  217. ],
  218. options: [
  219. { include: "@whitespace" },
  220. { include: "@constant" },
  221. [/;/, "delimiter"],
  222. [/@optionName/, "annotation"],
  223. [/[()]/, "annotation.brackets"],
  224. [/=/, "operator"],
  225. [/\]/, { token: "@brackets", bracket: "@close", next: "@pop" }]
  226. ],
  227. option: [
  228. { include: "@whitespace" },
  229. [/@optionName/, "annotation"],
  230. [/[()]/, "annotation.brackets"],
  231. [/=/, "operator", "@pop"]
  232. ],
  233. oneofDecl: [
  234. { include: "@whitespace" },
  235. [/@identifier/, "identifier"],
  236. [/{/, { token: "@brackets", bracket: "@open", switchTo: "@oneofBody.$S2" }]
  237. ],
  238. oneofBody: [
  239. { include: "@whitespace" },
  240. { include: "@constant" },
  241. [/;/, "delimiter"],
  242. [/(@identifier)(\s*)(=)/, ["identifier", "white", "delimiter"]],
  243. [
  244. /@fullIdentifier|\./,
  245. {
  246. cases: {
  247. "@builtinTypes": "keyword",
  248. "@default": "type.identifier"
  249. }
  250. }
  251. ],
  252. [/\[/, { token: "@brackets", bracket: "@open", next: "@options.$S2" }],
  253. [/}/, { token: "@brackets", bracket: "@close", next: "@pop" }]
  254. ],
  255. reserved: [
  256. { include: "@whitespace" },
  257. [/,/, "delimiter"],
  258. [/;/, "delimiter", "@pop"],
  259. { include: "@constant" },
  260. [/to\b|max\b/, "keyword"]
  261. ],
  262. map: [
  263. { include: "@whitespace" },
  264. [
  265. /@fullIdentifier|\./,
  266. {
  267. cases: {
  268. "@builtinTypes": "keyword",
  269. "@default": "type.identifier"
  270. }
  271. }
  272. ],
  273. [/,/, "delimiter"],
  274. [/>/, { token: "@brackets", bracket: "@close", switchTo: "identifier" }]
  275. ],
  276. field: [
  277. { include: "@whitespace" },
  278. [
  279. "group",
  280. {
  281. cases: {
  282. "$S2==proto2": { token: "keyword", switchTo: "@groupDecl.$S2" }
  283. }
  284. }
  285. ],
  286. [/(@identifier)(\s*)(=)/, ["identifier", "white", { token: "delimiter", next: "@pop" }]],
  287. [
  288. /@fullIdentifier|\./,
  289. {
  290. cases: {
  291. "@builtinTypes": "keyword",
  292. "@default": "type.identifier"
  293. }
  294. }
  295. ]
  296. ],
  297. groupDecl: [
  298. { include: "@whitespace" },
  299. [/@identifier/, "identifier"],
  300. ["=", "operator"],
  301. [/{/, { token: "@brackets", bracket: "@open", switchTo: "@messageBody.$S2" }],
  302. { include: "@constant" }
  303. ],
  304. type: [
  305. { include: "@whitespace" },
  306. [/@identifier/, "type.identifier", "@pop"],
  307. [/./, "delimiter"]
  308. ],
  309. identifier: [{ include: "@whitespace" }, [/@identifier/, "identifier", "@pop"]],
  310. serviceDecl: [
  311. { include: "@whitespace" },
  312. [/@identifier/, "identifier"],
  313. [/{/, { token: "@brackets", bracket: "@open", switchTo: "@serviceBody.$S2" }]
  314. ],
  315. serviceBody: [
  316. { include: "@whitespace" },
  317. { include: "@constant" },
  318. [/;/, "delimiter"],
  319. [/option\b/, "keyword", "@option.$S2"],
  320. [/rpc\b/, "keyword", "@rpc.$S2"],
  321. [/\[/, { token: "@brackets", bracket: "@open", next: "@options.$S2" }],
  322. [/}/, { token: "@brackets", bracket: "@close", next: "@pop" }]
  323. ],
  324. rpc: [
  325. { include: "@whitespace" },
  326. [/@identifier/, "identifier"],
  327. [/\(/, { token: "@brackets", bracket: "@open", switchTo: "@request.$S2" }],
  328. [/{/, { token: "@brackets", bracket: "@open", next: "@methodOptions.$S2" }],
  329. [/;/, "delimiter", "@pop"]
  330. ],
  331. request: [
  332. { include: "@whitespace" },
  333. [
  334. /@messageType/,
  335. {
  336. cases: {
  337. stream: { token: "keyword", next: "@type.$S2" },
  338. "@default": "type.identifier"
  339. }
  340. }
  341. ],
  342. [/\)/, { token: "@brackets", bracket: "@close", switchTo: "@returns.$S2" }]
  343. ],
  344. returns: [
  345. { include: "@whitespace" },
  346. [/returns\b/, "keyword"],
  347. [/\(/, { token: "@brackets", bracket: "@open", switchTo: "@response.$S2" }]
  348. ],
  349. response: [
  350. { include: "@whitespace" },
  351. [
  352. /@messageType/,
  353. {
  354. cases: {
  355. stream: { token: "keyword", next: "@type.$S2" },
  356. "@default": "type.identifier"
  357. }
  358. }
  359. ],
  360. [/\)/, { token: "@brackets", bracket: "@close", switchTo: "@rpc.$S2" }]
  361. ],
  362. methodOptions: [
  363. { include: "@whitespace" },
  364. { include: "@constant" },
  365. [/;/, "delimiter"],
  366. ["option", "keyword"],
  367. [/@optionName/, "annotation"],
  368. [/[()]/, "annotation.brackets"],
  369. [/=/, "operator"],
  370. [/}/, { token: "@brackets", bracket: "@close", next: "@pop" }]
  371. ],
  372. comment: [
  373. [/[^\/*]+/, "comment"],
  374. [/\/\*/, "comment", "@push"],
  375. ["\\*/", "comment", "@pop"],
  376. [/[\/*]/, "comment"]
  377. ],
  378. string: [
  379. [/[^\\"]+/, "string"],
  380. [/@escapes/, "string.escape"],
  381. [/\\./, "string.escape.invalid"],
  382. [/"/, { token: "string.quote", bracket: "@close", next: "@pop" }]
  383. ],
  384. stringSingle: [
  385. [/[^\\']+/, "string"],
  386. [/@escapes/, "string.escape"],
  387. [/\\./, "string.escape.invalid"],
  388. [/'/, { token: "string.quote", bracket: "@close", next: "@pop" }]
  389. ],
  390. constant: [
  391. ["@boolLit", "keyword.constant"],
  392. ["@hexLit", "number.hex"],
  393. ["@octalLit", "number.octal"],
  394. ["@decimalLit", "number"],
  395. ["@floatLit", "number.float"],
  396. [/("([^"\\]|\\.)*|'([^'\\]|\\.)*)$/, "string.invalid"],
  397. [/"/, { token: "string.quote", bracket: "@open", next: "@string" }],
  398. [/'/, { token: "string.quote", bracket: "@open", next: "@stringSingle" }],
  399. [/{/, { token: "@brackets", bracket: "@open", next: "@prototext" }],
  400. [/identifier/, "identifier"]
  401. ],
  402. whitespace: [
  403. [/[ \t\r\n]+/, "white"],
  404. [/\/\*/, "comment", "@comment"],
  405. [/\/\/.*$/, "comment"]
  406. ],
  407. prototext: [
  408. { include: "@whitespace" },
  409. { include: "@constant" },
  410. [/@identifier/, "identifier"],
  411. [/[:;]/, "delimiter"],
  412. [/}/, { token: "@brackets", bracket: "@close", next: "@pop" }]
  413. ]
  414. }
  415. };
  416. export {
  417. conf,
  418. language
  419. };
  420. /*! Bundled license information:
  421. monaco-editor/esm/vs/basic-languages/protobuf/protobuf.js:
  422. (*!-----------------------------------------------------------------------------
  423. * Copyright (c) Microsoft Corporation. All rights reserved.
  424. * Version: 0.38.0(0e330ae453813de4e6cf272460fb79c7117073d0)
  425. * Released under the MIT license
  426. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  427. *-----------------------------------------------------------------------------*)
  428. */
  429. //# sourceMappingURL=protobuf-GOG2TY64.js.map