The language I am working on supports optional parameters. For example, the function call statement below is valid:
myFunction(arg1, ,arg3, arg4);
Note that the 2nd argument is not specified.
If I use the following production rule for functionArgumentList, I can get 3 elements in the AST, but I lose the information about which argument is not specified.
functionArgumentList.Production
= expression["exp"]
+ (@comma + expression["exp"].OnErrorContinue() > AstFrom("exp")).ZeroOrMore().SetLabel("moreexps")
> Ast("FunctionArgumentList", AstFrom("exp"), AstChildrenFrom("moreexps"));
What is the proper way to handle this case?
Thanks,
Xuesong