cypher.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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/cypher/cypher", ["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/cypher/cypher.ts
  28. var cypher_exports = {};
  29. __export(cypher_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: '"' },
  48. { open: "'", close: "'" },
  49. { open: "`", close: "`" }
  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: `.cypher`,
  63. ignoreCase: true,
  64. brackets: [
  65. { open: "{", close: "}", token: "delimiter.curly" },
  66. { open: "[", close: "]", token: "delimiter.bracket" },
  67. { open: "(", close: ")", token: "delimiter.parenthesis" }
  68. ],
  69. keywords: [
  70. "ALL",
  71. "AND",
  72. "AS",
  73. "ASC",
  74. "ASCENDING",
  75. "BY",
  76. "CALL",
  77. "CASE",
  78. "CONTAINS",
  79. "CREATE",
  80. "DELETE",
  81. "DESC",
  82. "DESCENDING",
  83. "DETACH",
  84. "DISTINCT",
  85. "ELSE",
  86. "END",
  87. "ENDS",
  88. "EXISTS",
  89. "IN",
  90. "IS",
  91. "LIMIT",
  92. "MANDATORY",
  93. "MATCH",
  94. "MERGE",
  95. "NOT",
  96. "ON",
  97. "ON",
  98. "OPTIONAL",
  99. "OR",
  100. "ORDER",
  101. "REMOVE",
  102. "RETURN",
  103. "SET",
  104. "SKIP",
  105. "STARTS",
  106. "THEN",
  107. "UNION",
  108. "UNWIND",
  109. "WHEN",
  110. "WHERE",
  111. "WITH",
  112. "XOR",
  113. "YIELD"
  114. ],
  115. builtinLiterals: ["true", "TRUE", "false", "FALSE", "null", "NULL"],
  116. builtinFunctions: [
  117. "abs",
  118. "acos",
  119. "asin",
  120. "atan",
  121. "atan2",
  122. "avg",
  123. "ceil",
  124. "coalesce",
  125. "collect",
  126. "cos",
  127. "cot",
  128. "count",
  129. "degrees",
  130. "e",
  131. "endNode",
  132. "exists",
  133. "exp",
  134. "floor",
  135. "head",
  136. "id",
  137. "keys",
  138. "labels",
  139. "last",
  140. "left",
  141. "length",
  142. "log",
  143. "log10",
  144. "lTrim",
  145. "max",
  146. "min",
  147. "nodes",
  148. "percentileCont",
  149. "percentileDisc",
  150. "pi",
  151. "properties",
  152. "radians",
  153. "rand",
  154. "range",
  155. "relationships",
  156. "replace",
  157. "reverse",
  158. "right",
  159. "round",
  160. "rTrim",
  161. "sign",
  162. "sin",
  163. "size",
  164. "split",
  165. "sqrt",
  166. "startNode",
  167. "stDev",
  168. "stDevP",
  169. "substring",
  170. "sum",
  171. "tail",
  172. "tan",
  173. "timestamp",
  174. "toBoolean",
  175. "toFloat",
  176. "toInteger",
  177. "toLower",
  178. "toString",
  179. "toUpper",
  180. "trim",
  181. "type"
  182. ],
  183. operators: [
  184. "+",
  185. "-",
  186. "*",
  187. "/",
  188. "%",
  189. "^",
  190. "=",
  191. "<>",
  192. "<",
  193. ">",
  194. "<=",
  195. ">=",
  196. "->",
  197. "<-",
  198. "-->",
  199. "<--"
  200. ],
  201. escapes: /\\(?:[tbnrf\\"'`]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  202. digits: /\d+/,
  203. octaldigits: /[0-7]+/,
  204. hexdigits: /[0-9a-fA-F]+/,
  205. tokenizer: {
  206. root: [[/[{}[\]()]/, "@brackets"], { include: "common" }],
  207. common: [
  208. { include: "@whitespace" },
  209. { include: "@numbers" },
  210. { include: "@strings" },
  211. [/:[a-zA-Z_][\w]*/, "type.identifier"],
  212. [
  213. /[a-zA-Z_][\w]*(?=\()/,
  214. {
  215. cases: {
  216. "@builtinFunctions": "predefined.function"
  217. }
  218. }
  219. ],
  220. [
  221. /[a-zA-Z_$][\w$]*/,
  222. {
  223. cases: {
  224. "@keywords": "keyword",
  225. "@builtinLiterals": "predefined.literal",
  226. "@default": "identifier"
  227. }
  228. }
  229. ],
  230. [/`/, "identifier.escape", "@identifierBacktick"],
  231. [/[;,.:|]/, "delimiter"],
  232. [
  233. /[<>=%+\-*/^]+/,
  234. {
  235. cases: {
  236. "@operators": "delimiter",
  237. "@default": ""
  238. }
  239. }
  240. ]
  241. ],
  242. numbers: [
  243. [/-?(@digits)[eE](-?(@digits))?/, "number.float"],
  244. [/-?(@digits)?\.(@digits)([eE]-?(@digits))?/, "number.float"],
  245. [/-?0x(@hexdigits)/, "number.hex"],
  246. [/-?0(@octaldigits)/, "number.octal"],
  247. [/-?(@digits)/, "number"]
  248. ],
  249. strings: [
  250. [/"([^"\\]|\\.)*$/, "string.invalid"],
  251. [/'([^'\\]|\\.)*$/, "string.invalid"],
  252. [/"/, "string", "@stringDouble"],
  253. [/'/, "string", "@stringSingle"]
  254. ],
  255. whitespace: [
  256. [/[ \t\r\n]+/, "white"],
  257. [/\/\*/, "comment", "@comment"],
  258. [/\/\/.*$/, "comment"]
  259. ],
  260. comment: [
  261. [/\/\/.*/, "comment"],
  262. [/[^/*]+/, "comment"],
  263. [/\*\//, "comment", "@pop"],
  264. [/[/*]/, "comment"]
  265. ],
  266. stringDouble: [
  267. [/[^\\"]+/, "string"],
  268. [/@escapes/, "string"],
  269. [/\\./, "string.invalid"],
  270. [/"/, "string", "@pop"]
  271. ],
  272. stringSingle: [
  273. [/[^\\']+/, "string"],
  274. [/@escapes/, "string"],
  275. [/\\./, "string.invalid"],
  276. [/'/, "string", "@pop"]
  277. ],
  278. identifierBacktick: [
  279. [/[^\\`]+/, "identifier.escape"],
  280. [/@escapes/, "identifier.escape"],
  281. [/\\./, "identifier.escape.invalid"],
  282. [/`/, "identifier.escape", "@pop"]
  283. ]
  284. }
  285. };
  286. return __toCommonJS(cypher_exports);
  287. })();
  288. return moduleExports;
  289. });