source: node_modules/refractor/lang/cypher.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1'use strict'
2
3module.exports = cypher
4cypher.displayName = 'cypher'
5cypher.aliases = []
6function cypher(Prism) {
7 Prism.languages.cypher = {
8 // https://neo4j.com/docs/cypher-manual/current/syntax/comments/
9 comment: /\/\/.*/,
10 string: {
11 pattern: /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/,
12 greedy: true
13 },
14 'class-name': {
15 pattern: /(:\s*)(?:\w+|`(?:[^`\\\r\n])*`)(?=\s*[{):])/,
16 lookbehind: true,
17 greedy: true
18 },
19 relationship: {
20 pattern:
21 /(-\[\s*(?:\w+\s*|`(?:[^`\\\r\n])*`\s*)?:\s*|\|\s*:\s*)(?:\w+|`(?:[^`\\\r\n])*`)/,
22 lookbehind: true,
23 greedy: true,
24 alias: 'property'
25 },
26 identifier: {
27 pattern: /`(?:[^`\\\r\n])*`/,
28 greedy: true
29 },
30 variable: /\$\w+/,
31 // https://neo4j.com/docs/cypher-manual/current/syntax/reserved/
32 keyword:
33 /\b(?:ADD|ALL|AND|AS|ASC|ASCENDING|ASSERT|BY|CALL|CASE|COMMIT|CONSTRAINT|CONTAINS|CREATE|CSV|DELETE|DESC|DESCENDING|DETACH|DISTINCT|DO|DROP|ELSE|END|ENDS|EXISTS|FOR|FOREACH|IN|INDEX|IS|JOIN|KEY|LIMIT|LOAD|MANDATORY|MATCH|MERGE|NODE|NOT|OF|ON|OPTIONAL|OR|ORDER(?=\s+BY)|PERIODIC|REMOVE|REQUIRE|RETURN|SCALAR|SCAN|SET|SKIP|START|STARTS|THEN|UNION|UNIQUE|UNWIND|USING|WHEN|WHERE|WITH|XOR|YIELD)\b/i,
34 function: /\b\w+\b(?=\s*\()/,
35 boolean: /\b(?:false|null|true)\b/i,
36 number: /\b(?:0x[\da-fA-F]+|\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b/,
37 // https://neo4j.com/docs/cypher-manual/current/syntax/operators/
38 operator: /:|<--?|--?>?|<>|=~?|[<>]=?|[+*/%^|]|\.\.\.?/,
39 punctuation: /[()[\]{},;.]/
40 }
41}
Note: See TracBrowser for help on using the repository browser.