-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 keyword list #2047
AQL: Update keyword list #2047
Conversation
Add K_SHORTEST_PATHS, OPTIONS, SEARCH, TO
Thank you for the detailed explanation! I added
This will simply be a false positive. Many other languages also suffer from those (e.g. JS with How common will this be? |
Very nice, thanks!
The most common occurrence will probably be attribute access using the dot notation. It depends on what the user calls his attributes. If the attribute name is any of The bracket notation is largely unaffected (string literal: Overall, it shouldn't be too bad and I doubt that it's worth to go to great length to avoid false-positives. I wonder however if there are some low hanging fruits. For example, to prevent search from being identified as keyword in
Eventhough this should be a function call to an unknown function SEARCH, it is actually interpreted as |
I appreciate your fixes for While it would be nice to not color attribute keys in object literals, it doesn't seem like a big problem to me and is probably hard to detect (there is the short notation BTW. I missed On a different note, should the expression for matching number literals be adjusted to match the current AQL parser?
https://www.arangodb.com/docs/stable/aql/fundamentals-data-types.html The token definition distinguishes between integers and double values:
I think the operator regex needs to be adjusted to account for the array contraction operator:
|
I used a fast method but in turn, I accepted some false positives (see my previous comment). Regarding the short notation (e.g. I fixed the array concat operator and implemented the stricter number pattern. With this, I think we are ready to merge. This PR is already beyond updating the keyword list, so for further suggestion/improvements, please open a new issue. (It's just to keep things simple and organized.) |
Thank you for contributing! |
Thanks for your help! It just occurred to be that there is one more non-reserved word used in language constructs: the COUNT (case-insensitive) in |
Thank you! I'll be looking forward to it! |
Add K_SHORTEST_PATHS, OPTIONS, SEARCH, TO
Technically, some of the words are not keywords / reserved words in AQL (you may use them as attribute names for instance without having to wrap them in backticks). Should they be removed from this list and implemented in a different way? If no, then e.g.
doc.search
will havesearch
colored like a keyword even though ArangoDB processes it like a regular attribute access. If yes, how to do that in prism?NEW and OLD are special variables (non-keyword), but their availability depends on the presence of a modification (sub-)query using the INSERT/UPDATE/REPLACE/REMOVE keywords. Note that they are case-sensitive! Because of that, they can not simply be added to the existing keyword list, which is case-insensitive.
True keywords:
AGGREGATE
(keyword)ALL
(modifier)AND
(operator)ANY
(modifier)ASC
(keyword)COLLECT
(declaration)DESC
(keyword)DISTINCT
(modifier)FILTER
(declaration)FOR
(declaration)GRAPH
(keyword)IN
(keyword)INBOUND
(modifier)INSERT
(command)INTO
(keyword)LET
(declaration)LIKE
(operator)LIMIT
(declaration)NONE
(modifier)NOT
(operator)OR
(operator)OUTBOUND
(modifier)REMOVE
(command)REPLACE
(command)RETURN
(declaration)SHORTEST_PATH
(keyword)SORT
(declaration)UPDATE
(command)UPSERT
(command)WITH
(keyword)Keyword-like:
true
false
null
Not keywords but used in language constructs:
NEW
(case-sensitive!)OLD
(case-sensitive!)OPTIONS
SEARCH
TO