Skip to content

How to know what's the position of current argument in function calls? #1710

Answered by msujew
durianwaffle asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @durianwaffle,

If I have a function MAX(a,b), argument a and argument b are recognized to be argument. And MAX() is recognized as functionCall. How do I know what's the position of each argument in functionCall?

You can use the $containerIndex property of the argument AST node.

I found that if I type MAX(,), there will be grammar errors as shown below. How to delete this error msg? Can I delete it by creating a custom ParserErrorMessageProvider?

I would recommend you to adjust the grammar to support adding empty arguments. Everything else is just a hack.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by durianwaffle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants