diff options
| author | Armand Philippot <git@armandphilippot.com> | 2021-12-30 19:47:21 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2021-12-30 19:47:21 +0100 |
| commit | a98b5ea6fe8e8cc98a55e0fd793e6e8660ea31c1 (patch) | |
| tree | 542810ab5aef99150db228bb54fd58303dcb31c7 /public/prism/prism-aql.js | |
| parent | ab355897a12b7bda1089a44de326d41455a0f7a3 (diff) | |
chore: add prismjs for syntax highlighting
Diffstat (limited to 'public/prism/prism-aql.js')
| -rw-r--r-- | public/prism/prism-aql.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/public/prism/prism-aql.js b/public/prism/prism-aql.js new file mode 100644 index 0000000..7634007 --- /dev/null +++ b/public/prism/prism-aql.js @@ -0,0 +1,50 @@ +Prism.languages.aql = { + comment: /\/\/.*|\/\*[\s\S]*?\*\//, + property: { + pattern: + /([{,]\s*)(?:(?!\d)\w+|(["'´`])(?:(?!\2)[^\\\r\n]|\\.)*\2)(?=\s*:)/, + lookbehind: true, + greedy: true, + }, + string: { + pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\.)*\1/, + greedy: true, + }, + identifier: { + pattern: /([´`])(?:(?!\1)[^\\\r\n]|\\.)*\1/, + greedy: true, + }, + variable: /@@?\w+/, + keyword: [ + { + pattern: /(\bWITH\s+)COUNT(?=\s+INTO\b)/i, + lookbehind: true, + }, + /\b(?:AGGREGATE|ALL|AND|ANY|ASC|COLLECT|DESC|DISTINCT|FILTER|FOR|GRAPH|IN|INBOUND|INSERT|INTO|K_PATHS|K_SHORTEST_PATHS|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WINDOW|WITH)\b/i, + // pseudo keywords get a lookbehind to avoid false positives + { + pattern: /(^|[^\w.[])(?:KEEP|PRUNE|SEARCH|TO)\b/i, + lookbehind: true, + }, + { + pattern: /(^|[^\w.[])(?:CURRENT|NEW|OLD)\b/, + lookbehind: true, + }, + { + pattern: /\bOPTIONS(?=\s*\{)/i, + }, + ], + function: /\b(?!\d)\w+(?=\s*\()/, + boolean: /\b(?:false|true)\b/i, + range: { + pattern: /\.\./, + alias: 'operator', + }, + number: [ + /\b0b[01]+/i, + /\b0x[0-9a-f]+/i, + /(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i, + ], + operator: /\*{2,}|[=!]~|[!=<>]=?|&&|\|\||[-+*/%]/, + punctuation: /::|[?.:,;()[\]{}]/, +}; |
