| 1 |
{ |
| 2 |
"fileTypes": ["cql", "cyp", "cypher"], |
| 3 |
"name": "cypher", |
| 4 |
"patterns": [ |
| 5 |
{ |
| 6 |
"include": "#comments" |
| 7 |
}, |
| 8 |
{ |
| 9 |
"include": "#constants" |
| 10 |
}, |
| 11 |
{ |
| 12 |
"include": "#keywords" |
| 13 |
}, |
| 14 |
{ |
| 15 |
"include": "#functions" |
| 16 |
}, |
| 17 |
{ |
| 18 |
"include": "#path-patterns" |
| 19 |
}, |
| 20 |
{ |
| 21 |
"include": "#operators" |
| 22 |
}, |
| 23 |
{ |
| 24 |
"include": "#identifiers" |
| 25 |
}, |
| 26 |
{ |
| 27 |
"include": "#properties_literal" |
| 28 |
}, |
| 29 |
{ |
| 30 |
"include": "#numbers" |
| 31 |
}, |
| 32 |
{ |
| 33 |
"include": "#strings" |
| 34 |
} |
| 35 |
], |
| 36 |
"repository": { |
| 37 |
"comments": { |
| 38 |
"patterns": [ |
| 39 |
{ |
| 40 |
"match": "//.*$\\n?", |
| 41 |
"name": "comment.line.double-slash.cypher" |
| 42 |
} |
| 43 |
] |
| 44 |
}, |
| 45 |
"constants": { |
| 46 |
"patterns": [ |
| 47 |
{ |
| 48 |
"match": "(?i)\\bTRUE|FALSE\\b", |
| 49 |
"name": "constant.language.bool.cypher" |
| 50 |
}, |
| 51 |
{ |
| 52 |
"match": "(?i)\\bNULL\\b", |
| 53 |
"name": "constant.language.missing.cypher" |
| 54 |
} |
| 55 |
] |
| 56 |
}, |
| 57 |
"functions": { |
| 58 |
"patterns": [ |
| 59 |
{ |
| 60 |
"comment": "List of Cypher built-in functions from http://docs.neo4j.org/chunked/milestone/query-function.html", |
| 61 |
"match": "(?i)\\b((NOT)(?=\\s*\\()|IS\\s+NULL|IS\\s+NOT\\s+NULL)", |
| 62 |
"name": "keyword.control.function.boolean.cypher" |
| 63 |
}, |
| 64 |
{ |
| 65 |
"comment": "List of Cypher built-in functions from http://docs.neo4j.org/chunked/milestone/query-function.html", |
| 66 |
"match": "(?i)\\b(ALL|ANY|NONE|SINGLE)(?=\\s*\\()", |
| 67 |
"name": "support.function.predicate.cypher" |
| 68 |
}, |
| 69 |
{ |
| 70 |
"comment": "List of Cypher built-in functions from http://docs.neo4j.org/chunked/milestone/query-function.html", |
| 71 |
"match": "(?i)\\b(LENGTH|TYPE|ID|COALESCE|HEAD|LAST|TIMESTAMP|STARTNODE|ENDNODE|TOINT|TOFLOAT)(?=\\s*\\()", |
| 72 |
"name": "support.function.scalar.cypher" |
| 73 |
}, |
| 74 |
{ |
| 75 |
"comment": "List of Cypher built-in functions from http://docs.neo4j.org/chunked/milestone/query-function.html", |
| 76 |
"match": "(?i)\\b(NODES|RELATIONSHIPS|LABELS|EXTRACT|FILTER|TAIL|RANGE|REDUCE)(?=\\s*\\()", |
| 77 |
"name": "support.function.collection.cypher" |
| 78 |
}, |
| 79 |
{ |
| 80 |
"comment": "List of Cypher built-in functions from http://docs.neo4j.org/chunked/milestone/query-function.html", |
| 81 |
"match": "(?i)\\b(ABS|ACOS|ASIN|ATAN|ATAN2|COS|COT|DEGREES|E|EXP|FLOOR|HAVERSIN|LOG|LOG10|PI|RADIANS|RAND|ROUND|SIGN|SIN|SQRT|TAN)(?=\\s*\\()", |
| 82 |
"name": "support.function.math.cypher" |
| 83 |
}, |
| 84 |
{ |
| 85 |
"comment": "List of Cypher built-in functions from http://docs.neo4j.org/chunked/milestone/query-function.html", |
| 86 |
"match": "(?i)\\b(COUNT|sum|avg|max|min|stdev|stdevp|percentileDisc|percentileCont|collect)(?=\\s*\\()", |
| 87 |
"name": "support.function.aggregation.cypher" |
| 88 |
}, |
| 89 |
{ |
| 90 |
"comment": "List of Cypher built-in functions from http://docs.neo4j.org/chunked/milestone/query-function.html", |
| 91 |
"match": "(?i)\\b(STR|REPLACE|SUBSTRING|LEFT|RIGHT|LTRIM|RTRIM|TRIM|LOWER|UPPER|SPLIT)(?=\\s*\\()", |
| 92 |
"name": "support.function.string.cypher" |
| 93 |
} |
| 94 |
] |
| 95 |
}, |
| 96 |
"identifiers": { |
| 97 |
"patterns": [ |
| 98 |
{ |
| 99 |
"match": "`.+?`", |
| 100 |
"name": "variable.other.quoted-identifier.cypher" |
| 101 |
}, |
| 102 |
{ |
| 103 |
"match": "[\\p{L}_][\\p{L}0-9_]*", |
| 104 |
"name": "variable.other.identifier.cypher" |
| 105 |
} |
| 106 |
] |
| 107 |
}, |
| 108 |
"keywords": { |
| 109 |
"patterns": [ |
| 110 |
{ |
| 111 |
"match": "(?i)\\b(START|MATCH|WHERE|RETURN|UNION|FOREACH|WITH|AS|LIMIT|SKIP|UNWIND|HAS|DISTINCT|OPTIONAL\\\\s+MATCH|ORDER\\s+BY|CALL|YIELD)\\b", |
| 112 |
"name": "keyword.control.clause.cypher" |
| 113 |
}, |
| 114 |
{ |
| 115 |
"match": "(?i)\\b(ELSE|END|THEN|CASE|WHEN)\\b", |
| 116 |
"name": "keyword.control.case.cypher" |
| 117 |
}, |
| 118 |
{ |
| 119 |
"match": "(?i)\\b(FIELDTERMINATOR|USING\\s+PERIODIC\\s+COMMIT|HEADERS|LOAD\\s+CSV|FROM)\\b", |
| 120 |
"name": "keyword.data.import.cypher" |
| 121 |
}, |
| 122 |
{ |
| 123 |
"match": "(?i)\\b(USING\\s+INDEX|CREATE\\s+INDEX\\s+ON|DROP\\s+INDEX\\s+ON|CREATE\\s+CONSTRAINT\\s+ON|DROP\\s+CONSTRAINT\\s+ON)\\b", |
| 124 |
"name": "keyword.other.indexes.cypher" |
| 125 |
}, |
| 126 |
{ |
| 127 |
"match": "(?i)\\b(MERGE|DELETE|SET|REMOVE|ON\\s+CREATE|ON\\s+MATCH|CREATE\\s+UNIQUE|CREATE)\\b", |
| 128 |
"name": "keyword.data.definition.cypher" |
| 129 |
}, |
| 130 |
{ |
| 131 |
"match": "(?i)\\b(DESC|ASC)\\b", |
| 132 |
"name": "keyword.other.order.cypher" |
| 133 |
}, |
| 134 |
{ |
| 135 |
"begin": "(?i)\\b(node|relationship|rel)((:)([\\p{L}_-][\\p{L}0-9_]*))?(?=\\s*\\()", |
| 136 |
"beginCaptures": { |
| 137 |
"1": { |
| 138 |
"name": "support.class.starting-functions-point.cypher" |
| 139 |
}, |
| 140 |
"2": { |
| 141 |
"name": "keyword.control.index-seperator.cypher" |
| 142 |
}, |
| 143 |
"3": { |
| 144 |
"name": "keyword.control.index-seperator.cypher" |
| 145 |
}, |
| 146 |
"4": { |
| 147 |
"name": "support.class.index.cypher" |
| 148 |
} |
| 149 |
}, |
| 150 |
"end": "\\)", |
| 151 |
"name": "source.starting-functions.cypher", |
| 152 |
"patterns": [ |
| 153 |
{ |
| 154 |
"match": "((?:`.+?`)|(?:[\\p{L}_][\\p{L}0-9_]*))", |
| 155 |
"name": "variable.parameter.relationship-name.cypher" |
| 156 |
}, |
| 157 |
{ |
| 158 |
"match": "(\\*)", |
| 159 |
"name": "keyword.control.starting-function-params.cypher" |
| 160 |
}, |
| 161 |
{ |
| 162 |
"include": "#comments" |
| 163 |
}, |
| 164 |
{ |
| 165 |
"include": "#numbers" |
| 166 |
}, |
| 167 |
{ |
| 168 |
"include": "#strings" |
| 169 |
} |
| 170 |
] |
| 171 |
} |
| 172 |
] |
| 173 |
}, |
| 174 |
"numbers": { |
| 175 |
"patterns": [ |
| 176 |
{ |
| 177 |
"match": "\\b\\d+(\\.\\d+)?\\b", |
| 178 |
"name": "constant.numeric.cypher" |
| 179 |
} |
| 180 |
] |
| 181 |
}, |
| 182 |
"operators": { |
| 183 |
"patterns": [ |
| 184 |
{ |
| 185 |
"match": "(\\+|\\-|\\/|\\*|\\%|\\?|!)", |
| 186 |
"name": "keyword.operator.math.cypher" |
| 187 |
}, |
| 188 |
{ |
| 189 |
"match": "(<=|=>|<>|<|>|=~|=)", |
| 190 |
"name": "keyword.operator.compare.cypher" |
| 191 |
}, |
| 192 |
{ |
| 193 |
"match": "(?i)\\b(OR|AND|XOR|IS)\\b", |
| 194 |
"name": "keyword.operator.logical.cypher" |
| 195 |
}, |
| 196 |
{ |
| 197 |
"match": "(?i)\\b(IN)\\b", |
| 198 |
"name": "keyword.operator.in.cypher" |
| 199 |
} |
| 200 |
] |
| 201 |
}, |
| 202 |
"path-patterns": { |
| 203 |
"patterns": [ |
| 204 |
{ |
| 205 |
"match": "(<--|-->|--)", |
| 206 |
"name": "support.function.relationship-pattern.cypher" |
| 207 |
}, |
| 208 |
{ |
| 209 |
"begin": "(<-|-)(\\[)", |
| 210 |
"beginCaptures": { |
| 211 |
"1": { |
| 212 |
"name": "support.function.relationship-pattern-start.cypher" |
| 213 |
}, |
| 214 |
"2": { |
| 215 |
"name": "keyword.operator.relationship-pattern-start.cypher" |
| 216 |
} |
| 217 |
}, |
| 218 |
"end": "(])(->|-)", |
| 219 |
"endCaptures": { |
| 220 |
"1": { |
| 221 |
"name": "keyword.operator.relationship-pattern-end.cypher" |
| 222 |
}, |
| 223 |
"2": { |
| 224 |
"name": "support.function.relationship-pattern-end.cypher" |
| 225 |
} |
| 226 |
}, |
| 227 |
"name": "path-pattern.cypher", |
| 228 |
"patterns": [ |
| 229 |
{ |
| 230 |
"include": "#identifiers" |
| 231 |
}, |
| 232 |
{ |
| 233 |
"captures": { |
| 234 |
"1": { |
| 235 |
"name": "keyword.operator.relationship-type-start.cypher" |
| 236 |
}, |
| 237 |
"2": { |
| 238 |
"name": "entity.name.class.relationship.type.cypher" |
| 239 |
} |
| 240 |
}, |
| 241 |
"match": "(:)((?:`.+?`)|(?:[\\p{L}_][\\p{L}0-9_]*))", |
| 242 |
"name": "entity.name.class.relationship-type.cypher" |
| 243 |
}, |
| 244 |
{ |
| 245 |
"captures": { |
| 246 |
"1": { |
| 247 |
"name": "support.type.operator.relationship-type-or.cypher" |
| 248 |
}, |
| 249 |
"2": { |
| 250 |
"name": "entity.name.class.relationship.type-or.cypher" |
| 251 |
} |
| 252 |
}, |
| 253 |
"match": "(\\|)(\\s*)((?:`.+?`)|(?:[\\p{L}_][\\p{L}0-9_]*))", |
| 254 |
"name": "entity.name.class.relationship-type-ored.cypher" |
| 255 |
}, |
| 256 |
{ |
| 257 |
"match": "(?:\\?\\*|\\?|\\*)\\s*(?:\\d+\\s*(?:\\.\\.\\s*\\d+)?)?", |
| 258 |
"name": "support.function.relationship-pattern.quant.cypher" |
| 259 |
}, |
| 260 |
{ |
| 261 |
"include": "#properties_literal" |
| 262 |
} |
| 263 |
] |
| 264 |
} |
| 265 |
] |
| 266 |
}, |
| 267 |
"properties_literal": { |
| 268 |
"patterns": [ |
| 269 |
{ |
| 270 |
"begin": "{", |
| 271 |
"beginCaptures": { |
| 272 |
"0": { |
| 273 |
"name": "keyword.control.properties_literal.cypher" |
| 274 |
} |
| 275 |
}, |
| 276 |
"end": "}", |
| 277 |
"endCaptures": { |
| 278 |
"0": { |
| 279 |
"name": "keyword.control.properties_literal.cypher" |
| 280 |
} |
| 281 |
}, |
| 282 |
"name": "source.cypher", |
| 283 |
"patterns": [ |
| 284 |
{ |
| 285 |
"match": ":|,", |
| 286 |
"name": "keyword.control.properties_literal.seperator.cypher" |
| 287 |
}, |
| 288 |
{ |
| 289 |
"include": "#comments" |
| 290 |
}, |
| 291 |
{ |
| 292 |
"include": "#constants" |
| 293 |
}, |
| 294 |
{ |
| 295 |
"include": "#functions" |
| 296 |
}, |
| 297 |
{ |
| 298 |
"include": "#operators" |
| 299 |
}, |
| 300 |
{ |
| 301 |
"include": "#identifiers" |
| 302 |
}, |
| 303 |
{ |
| 304 |
"include": "#numbers" |
| 305 |
}, |
| 306 |
{ |
| 307 |
"include": "#strings" |
| 308 |
} |
| 309 |
] |
| 310 |
} |
| 311 |
] |
| 312 |
}, |
| 313 |
"string_escape": { |
| 314 |
"captures": { |
| 315 |
"2": { |
| 316 |
"name": "string.quoted.double.cypher" |
| 317 |
} |
| 318 |
}, |
| 319 |
"match": "(\\\\\\\\|\\\\[tbnrf])|(\\\\'|\\\\\")", |
| 320 |
"name": "constant.character.escape.cypher" |
| 321 |
}, |
| 322 |
"strings": { |
| 323 |
"patterns": [ |
| 324 |
{ |
| 325 |
"begin": "'", |
| 326 |
"end": "'", |
| 327 |
"name": "string.quoted.single.cypher", |
| 328 |
"patterns": [ |
| 329 |
{ |
| 330 |
"include": "#string_escape" |
| 331 |
} |
| 332 |
] |
| 333 |
}, |
| 334 |
{ |
| 335 |
"begin": "\"", |
| 336 |
"end": "\"", |
| 337 |
"name": "string.quoted.double.cypher", |
| 338 |
"patterns": [ |
| 339 |
{ |
| 340 |
"include": "#string_escape" |
| 341 |
} |
| 342 |
] |
| 343 |
} |
| 344 |
] |
| 345 |
} |
| 346 |
}, |
| 347 |
"scopeName": "source.cypher", |
| 348 |
"uuid": "698F4D06-BAE8-40A8-8AA4-3307ABC03B31" |
| 349 |
} |
| 350 |
|