-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCypher.sublime-syntax
More file actions
147 lines (117 loc) · 4.41 KB
/
Cypher.sublime-syntax
File metadata and controls
147 lines (117 loc) · 4.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
%YAML 1.2
---
# See http://www.sublimetext.com/docs/syntax.html
name: Cypher
file_extensions: [cypher, cyp]
scope: source.cypher
contexts:
main:
- include: keywords
- include: comments
- include: constants
- include: functions
- include: identifiers
- match: '"'
scope: punctuation.definition.string.begin.cypher
push: double_quoted_string
comments:
# Single Line Comments
- match: '//.*$\n?'
scope: comment.line.double-slash.cypher
constants:
- match: '\bTRUE|true|FALSE|false\b'
scope: constant.language.bool.cypher
functions:
# List of Cypher built-in functions
- match: '(?i)\b(NOT)(?=\s*\()'
scope: keyword.control.function.boolean.cypher
- match: '(?i)\b(ALL|ANY|NONE|SINGLE)(?=\s*\()'
scope: support.function.predicate.cypher
- match: '(?i)\b(LENGTH|TYPE|ID|COALESCE|HEAD|LAST)(?=\s*\()'
scope: support.function.scalar.cypher
- match: '(?i)\b(NODES|RELATIONSHIPS|EXTRACT|FILTER|TAIL|RANGE|REDUCE)(?=\s*\()'
scope: support.function.collection.cypher
- match: '(?i)\b(ABS|ROUND|SQRT|SIGN)(?=\s*\()'
scope: support.function.math.cypher
- match: '(?i)\b(count|sum|avg|max|min|percentile_disc|percentile_cont|collect)(?=\s*\()'
scope: support.function.aggregation.cypher
- match: '(?i)\b(STR|REPLACE|SUBSTRING|LEFT|RIGHT|LTRIM|RTRIM|TRIM|LOWER|UPPER)(?=\s*\()'
scope: support.function.string.cypher
identifiers:
- match: '`.+?'
scope: variable.other.quoted-identifier.cypher
- match: '[a-zA-Z_][a-zA-Z0-9_]*'
scope: variable.other.identifier.cypher
keywords:
- match: '(?i)\b(MERGE|START|MATCH|WHERE|RETURN|CREATE|DELETE|SET|FOREACH|WITH|CYPHER|DISTINCT|AS|LIMIT|SKIP|UNIQUE|ORDER\s+BY)\b'
scope: keyword.control.clause.cypher
- match: '(?i)\b(DESC|ASC)\b'
scope: keyword.other.order.cypher
- match: '(?i)\b(node|relationship|rel)((:)([a-zA-Z_-][a-zA-Z0-9_]*))?(?=\s*\()'
scope:
support.class.starting-functions-point.cypher
keyword.control.index-separator
support.class.index.cypher
# Starting Functions
- match: '((?:`.+?`)|(?:[a-zA-Z_][a-zA-Z0-9_]*))'
scope: variable.parameter.relationship-name.cypher
- include: comments
- include: numbers
- include: strings
- match: '(\*)'
scope: keyword.control.starting-function-params.cypher
numbers:
- match: '\b\d+(\.\d+)?\b'
scope: constant.numeric.cypher
operators:
- match: '(\+|\-|\/|\*|\%|\?|!)'
scope: keyword.operator.math.cypher
- match: '(<=|=>|<>|<|>|=~|=)'
scope: keyword.operator.compare.cypher
- match: '(?i)\b(OR|AND)\b'
scope: keyword.operator.logical.cypher
- match: '(?i)\b(IN)\b'
scope: keyword.operator.in.cypher
path-patterns:
- match: '(<--|-->|--)'
scope: support.gunction.relationship-pattern.cypher
- match: '(<-|-)(\[)'
scope:
support.function.relationship-pattern-start.cypher
keyword.operator.relationship-pattern-start.cypher
push:
- match: '(])(->|-)'
scope:
keyword.operator.relationship-pattern-end.cypher
support.function.relationship-pattern-start.cypher
- include: identifiers
- match: '(:)((?:`.+?`)|(?:[a-zA-Z_][a-zA-Z0-9_]*))'
scope: entity.name.class.relationship-type.cypher
push:
- match: '(\|)(\s*)((?:`.+?`)|(?:[a-zA-Z_][a-zA-Z0-9_]*))'
scope: entity.name.class.relationship-type-order.cypher
- match: '(?:\?\*|\?|\*)\s*(?:\d+\s*(?:\.\.\s*\d+)?)?'
scope: support.function.relationship-pattern-quant.cypher
properties-literal:
- match: '{'
scope: keyword.control.properties-literal.cypher
push:
- match: '}'
- match: ':|,'
scope: keyword.control.properties-literal.separator.cypher
- include: comments
- include: constants
- include: functions
- include: identifiers
- include: numbers
- include: strings
double_quoted_string:
- meta_scope: string.quoted.double.cypher
- match: '\\.'
scope: constant.character.escape.cypher
- match: '"'
scope: punctuation.definition.string.end.cypher
pop: true
strings:
- include: double_quoted_string
# ToDo: single quote string