UNPKG

1.16 kBJavaScriptView Raw
1Prism.languages.aql = {
2 'comment': /\/\/.*|\/\*[\s\S]*?\*\//,
3 'property': {
4 pattern: /([{,]\s*)(?:(?!\d)\w+|(["'´`])(?:(?!\2)[^\\\r\n]|\\.)*\2)(?=\s*:)/,
5 lookbehind: true,
6 greedy: true
7 },
8 'string': {
9 pattern: /(["'´`])(?:(?!\1)[^\\\r\n]|\\.)*\1/,
10 greedy: true
11 },
12 'variable': /@@?\w+/,
13 'keyword': [
14 {
15 pattern: /(\bWITH\s+)COUNT(?=\s+INTO\b)/i,
16 lookbehind: true
17 },
18 /\b(?:AGGREGATE|ALL|AND|ANY|ASC|COLLECT|DESC|DISTINCT|FILTER|FOR|GRAPH|IN|INBOUND|INSERT|INTO|K_SHORTEST_PATHS|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WITH)\b/i,
19 // pseudo keywords get a lookbehind to avoid false positives
20 {
21 pattern: /(^|[^\w.[])(?:KEEP|PRUNE|SEARCH|TO)\b/i,
22 lookbehind: true
23 },
24 {
25 pattern: /(^|[^\w.[])(?:CURRENT|NEW|OLD)\b/,
26 lookbehind: true
27 },
28 {
29 pattern: /\bOPTIONS(?=\s*{)/i
30 }
31 ],
32 'function': /(?!\d)\w+(?=\s*\()/,
33 'boolean': /(?:true|false)/i,
34 'range': {
35 pattern: /\.\./,
36 alias: 'operator'
37 },
38 'number': /(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i,
39 'operator': /\*{2,}|[=!]~|[!=<>]=?|&&|\|\||[-+*/%]/,
40 'punctuation': /::|[?.:,;()[\]{}]/
41};