-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds support for the AQL language. https://www.arangodb.com/docs/stable/aql/
- Loading branch information
1 parent
8ccd258
commit 3fdb7d5
Showing
13 changed files
with
261 additions
and
2 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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 | ||
}, | ||
'variable': /@@?\w+/, | ||
'keyword': /\b(?:AGGREGATE|ALL|AND|ANY|ASC|COLLECT|DESC|DISTINCT|FILTER|FOR|GRAPH|IN|INBOUND|INSERT|INTO|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WITH)\b/i, | ||
'function': /(?!\d)\w+(?=\s*\()/, | ||
'boolean': /(?:true|false)/i, | ||
'range': { | ||
pattern: /\.\./, | ||
alias: 'operator' | ||
}, | ||
'number': /(?:\B\.\d+|\b\d+(?:\.\d+)?)(?:e[+-]?\d+)?/i, | ||
'operator': /\*\*|[=!]~|[!=<>]=?|&&|\|\||[-+*/%]/, | ||
'punctuation': /::|[?.:,;()[\]{}]/ | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<h2>Full example</h2> | ||
<pre><code>FOR u IN users | ||
FOR f IN friends | ||
FILTER u.active == @active && f.active == true && u.id == f.userId | ||
RETURN { "name" : u.name, "friends" : friends } | ||
|
||
LET name = "Peter" | ||
LET age = 42 | ||
RETURN { name, age } | ||
|
||
FOR u IN users | ||
FILTER u.status == "not active" | ||
UPDATE u WITH { status: "inactive" } IN users | ||
|
||
FOR i IN 1..100 | ||
INSERT { value: i } IN test | ||
RETURN NEW</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// single line | ||
/* | ||
multi | ||
line | ||
*/ | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["comment", "// single line"], | ||
["comment", "/*\r\n multi\r\n line\r\n */"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for comments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
1 | ||
42 | ||
1.23 | ||
99.99 | ||
0.5 | ||
.5 | ||
4.87e103 | ||
4.87E103 | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["number", "1"], | ||
["number", "42"], | ||
["number", "1.23"], | ||
["number", "99.99"], | ||
["number", "0.5"], | ||
["number", ".5"], | ||
["number", "4.87e103"], | ||
["number", "4.87E103"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for numbers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
+ - * / % | ||
> >= <= < == != = | ||
!~ =~ | ||
|
||
! && || | ||
|
||
[**] | ||
|
||
.. | ||
1..100 | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["operator", "+"], | ||
["operator", "-"], | ||
["operator", "*"], | ||
["operator", "/"], | ||
["operator", "%"], | ||
|
||
["operator", ">"], | ||
["operator", ">="], | ||
["operator", "<="], | ||
["operator", "<"], | ||
["operator", "=="], | ||
["operator", "!="], | ||
["operator", "="], | ||
|
||
["operator", "!~"], | ||
["operator", "=~"], | ||
|
||
["operator", "!"], | ||
["operator", "&&"], | ||
["operator", "||"], | ||
|
||
["punctuation", "["], | ||
["operator", "**"], | ||
["punctuation", "]"], | ||
|
||
["range", ".."], | ||
|
||
["number", "1"], | ||
["range", ".."], | ||
["number", "100"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for operators. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ foo: … } | ||
{ 'foo': … } | ||
{ "foo": … } | ||
{ `foo`: … } | ||
{ ´foo´: … } | ||
|
||
// not a property | ||
LET opType = IS_NULL(OLD) ? "insert" : "update" | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["punctuation", "{"], | ||
["property", "foo"], | ||
["punctuation", ":"], | ||
" … ", | ||
["punctuation", "}"], | ||
|
||
["punctuation", "{"], | ||
["property", "'foo'"], | ||
["punctuation", ":"], | ||
" … ", | ||
["punctuation", "}"], | ||
|
||
["punctuation", "{"], | ||
["property", "\"foo\""], | ||
["punctuation", ":"], | ||
" … ", | ||
["punctuation", "}"], | ||
|
||
["punctuation", "{"], | ||
["property", "`foo`"], | ||
["punctuation", ":"], | ||
" … ", | ||
["punctuation", "}"], | ||
|
||
["punctuation", "{"], | ||
["property", "´foo´"], | ||
["punctuation", ":"], | ||
" … ", | ||
["punctuation", "}"], | ||
|
||
["comment", "// not a property"], | ||
|
||
["keyword", "LET"], | ||
" opType ", | ||
["operator", "="], | ||
["function", "IS_NULL"], | ||
["punctuation", "("], | ||
"OLD", | ||
["punctuation", ")"], | ||
["punctuation", "?"], | ||
["string", "\"insert\""], | ||
["punctuation", ":"], | ||
["string", "\"update\""] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for properties. (beware of ternary operators) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"yikes!" | ||
"don't know" | ||
"this is a \"quoted\" word" | ||
"this is a longer string." | ||
"the path separator on Windows is \\" | ||
|
||
'yikes!' | ||
'don\'t know' | ||
'this is a "quoted" word' | ||
'this is a longer string.' | ||
'the path separator on Windows is \\' | ||
|
||
´filter´ | ||
`sort` | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["string", "\"yikes!\""], | ||
["string", "\"don't know\""], | ||
["string", "\"this is a \\\"quoted\\\" word\""], | ||
["string", "\"this is a longer string.\""], | ||
["string", "\"the path separator on Windows is \\\\\""], | ||
["string", "'yikes!'"], | ||
["string", "'don\\'t know'"], | ||
["string", "'this is a \"quoted\" word'"], | ||
["string", "'this is a longer string.'"], | ||
["string", "'the path separator on Windows is \\\\'"], | ||
["string", "´filter´"], | ||
["string", "`sort`"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for strings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FILTER u.id == @id && u.name == @name | ||
FOR u IN @@collection | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "FILTER"], | ||
" u", | ||
["punctuation", "."], | ||
"id ", | ||
["operator", "=="], | ||
["variable", "@id"], | ||
["operator", "&&"], | ||
" u", | ||
["punctuation", "."], | ||
"name ", | ||
["operator", "=="], | ||
["variable", "@name"], | ||
|
||
["keyword", "FOR"], | ||
" u ", | ||
["keyword", "IN"], | ||
["variable", "@@collection"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for variable binds. |