graphql.js 4.2 KB

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