Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AQL: Update for ArangoDB 3.8 #2842

Merged
merged 1 commit into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions components/prism-aql.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Prism.languages.aql = {
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_SHORTEST_PATHS|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WITH)\b/i,
/\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,
Expand All @@ -35,7 +35,11 @@ Prism.languages.aql = {
pattern: /\.\./,
alias: 'operator'
},
'number': /(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i,
'number': [
/\b0b[01]+/i,
/\b0x[0-9a-f]+/i,
/(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i
],
'operator': /\*{2,}|[=!]~|[!=<>]=?|&&|\|\||[-+*/%]/,
'punctuation': /::|[?.:,;()[\]{}]/
};
2 changes: 1 addition & 1 deletion components/prism-aql.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tests/languages/aql/keyword_feature.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ IN
INBOUND
INSERT
INTO
K_PATHS
K_SHORTEST_PATHS
LET
LIKE
Expand All @@ -32,6 +33,7 @@ SHORTEST_PATH
SORT
UPDATE
UPSERT
WINDOW
WITH

KEEP
Expand Down Expand Up @@ -69,6 +71,7 @@ OPTIONS
["keyword", "INBOUND"],
["keyword", "INSERT"],
["keyword", "INTO"],
["keyword", "K_PATHS"],
["keyword", "K_SHORTEST_PATHS"],
["keyword", "LET"],
["keyword", "LIKE"],
Expand All @@ -85,6 +88,7 @@ OPTIONS
["keyword", "SORT"],
["keyword", "UPDATE"],
["keyword", "UPSERT"],
["keyword", "WINDOW"],
["keyword", "WITH"],

["keyword", "KEEP"],
Expand Down
6 changes: 5 additions & 1 deletion tests/languages/aql/number_feature.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
.5
4.87e103
4.87E103
0b10101110
0xabcdef02

----------------------------------------------------

Expand All @@ -17,7 +19,9 @@
["number", "0.5"],
["number", ".5"],
["number", "4.87e103"],
["number", "4.87E103"]
["number", "4.87E103"],
["number", "0b10101110"],
["number", "0xabcdef02"]
]

----------------------------------------------------
Expand Down