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

User defined function in custom namespace parsed as property lookup if function name is a keyword #552

Open
jonaskello opened this issue Feb 1, 2023 · 3 comments

Comments

@jonaskello
Copy link

jonaskello commented Feb 1, 2023

We've encountered an issue where we name a user defined function to a keyword.

For example

myns.all()

Is parsed as a property lookup of property all on object myns. It seems this is related to ALL being a keyword. It parses correctly for all function names except when using keywords as function names.

Just wanted to check if there is a rule that you cannot name any functions within user defined namespaces to keywords or if there is a bug somewhere?

We are using antlr4 for JavaScript to do the parsing.

@jonaskello
Copy link
Author

jonaskello commented Feb 1, 2023

I think it is related to this part of the grammar:

oC_Atom
    :  oC_Literal
        | oC_Parameter
        | oC_CaseExpression
        | ( COUNT SP? '(' SP? '*' SP? ')' )
        | oC_ListComprehension
        | oC_PatternComprehension
        | oC_Quantifier
        | oC_PatternPredicate
        | oC_ParenthesizedExpression
        | oC_FunctionInvocation
        | oC_ExistentialSubquery
        | oC_Variable
        ;

For myns.all() it will select oC_Variable but for myns.notAKeyword() it will select oC_FunctionInvocation.

@rvrooman-codelogic
Copy link

I am also seeing a flavor of this issue for

RETURN apoc.create.uuid()

with 'CREATE' being a reserved word.

@rvrooman-codelogic
Copy link

From what I can see in the 'User-defined functions' section of the specification v9, there is no restriction on function names or namespaces containing reserved words.

This does seem like an issue with the grammar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants