graphql.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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/graphql/graphql", ["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/graphql/graphql.ts
  28. var graphql_exports = {};
  29. __export(graphql_exports, {
  30. conf: () => conf,
  31. language: () => language
  32. });
  33. var conf = {
  34. comments: {
  35. lineComment: "#"
  36. },
  37. brackets: [
  38. ["{", "}"],
  39. ["[", "]"],
  40. ["(", ")"]
  41. ],
  42. autoClosingPairs: [
  43. { open: "{", close: "}" },
  44. { open: "[", close: "]" },
  45. { open: "(", close: ")" },
  46. { open: '"""', close: '"""', notIn: ["string", "comment"] },
  47. { open: '"', close: '"', notIn: ["string", "comment"] }
  48. ],
  49. surroundingPairs: [
  50. { open: "{", close: "}" },
  51. { open: "[", close: "]" },
  52. { open: "(", close: ")" },
  53. { open: '"""', close: '"""' },
  54. { open: '"', close: '"' }
  55. ],
  56. folding: {
  57. offSide: true
  58. }
  59. };
  60. var language = {
  61. defaultToken: "invalid",
  62. tokenPostfix: ".gql",
  63. keywords: [
  64. "null",
  65. "true",
  66. "false",
  67. "query",
  68. "mutation",
  69. "subscription",
  70. "extend",
  71. "schema",
  72. "directive",
  73. "scalar",
  74. "type",
  75. "interface",
  76. "union",
  77. "enum",
  78. "input",
  79. "implements",
  80. "fragment",
  81. "on"
  82. ],
  83. typeKeywords: ["Int", "Float", "String", "Boolean", "ID"],
  84. directiveLocations: [
  85. "SCHEMA",
  86. "SCALAR",
  87. "OBJECT",
  88. "FIELD_DEFINITION",
  89. "ARGUMENT_DEFINITION",
  90. "INTERFACE",
  91. "UNION",
  92. "ENUM",
  93. "ENUM_VALUE",
  94. "INPUT_OBJECT",
  95. "INPUT_FIELD_DEFINITION",
  96. "QUERY",
  97. "MUTATION",
  98. "SUBSCRIPTION",
  99. "FIELD",
  100. "FRAGMENT_DEFINITION",
  101. "FRAGMENT_SPREAD",
  102. "INLINE_FRAGMENT",
  103. "VARIABLE_DEFINITION"
  104. ],
  105. operators: ["=", "!", "?", ":", "&", "|"],
  106. symbols: /[=!?:&|]+/,
  107. escapes: /\\(?:["\\\/bfnrt]|u[0-9A-Fa-f]{4})/,
  108. tokenizer: {
  109. root: [
  110. [
  111. /[a-z_][\w$]*/,
  112. {
  113. cases: {
  114. "@keywords": "keyword",
  115. "@default": "key.identifier"
  116. }
  117. }
  118. ],
  119. [
  120. /[$][\w$]*/,
  121. {
  122. cases: {
  123. "@keywords": "keyword",
  124. "@default": "argument.identifier"
  125. }
  126. }
  127. ],
  128. [
  129. /[A-Z][\w\$]*/,
  130. {
  131. cases: {
  132. "@typeKeywords": "keyword",
  133. "@default": "type.identifier"
  134. }
  135. }
  136. ],
  137. { include: "@whitespace" },
  138. [/[{}()\[\]]/, "@brackets"],
  139. [/@symbols/, { cases: { "@operators": "operator", "@default": "" } }],
  140. [/@\s*[a-zA-Z_\$][\w\$]*/, { token: "annotation", log: "annotation token: $0" }],
  141. [/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"],
  142. [/0[xX][0-9a-fA-F]+/, "number.hex"],
  143. [/\d+/, "number"],
  144. [/[;,.]/, "delimiter"],
  145. [/"""/, { token: "string", next: "@mlstring", nextEmbedded: "markdown" }],
  146. [/"([^"\\]|\\.)*$/, "string.invalid"],
  147. [/"/, { token: "string.quote", bracket: "@open", next: "@string" }]
  148. ],
  149. mlstring: [
  150. [/[^"]+/, "string"],
  151. ['"""', { token: "string", next: "@pop", nextEmbedded: "@pop" }]
  152. ],
  153. string: [
  154. [/[^\\"]+/, "string"],
  155. [/@escapes/, "string.escape"],
  156. [/\\./, "string.escape.invalid"],
  157. [/"/, { token: "string.quote", bracket: "@close", next: "@pop" }]
  158. ],
  159. whitespace: [
  160. [/[ \t\r\n]+/, ""],
  161. [/#.*$/, "comment"]
  162. ]
  163. }
  164. };
  165. return __toCommonJS(graphql_exports);
  166. })();
  167. return moduleExports;
  168. });