Open gjcoram opened 2 months ago
I have a way to fix this, but it's inefficient, because it clones the AHashMap for the macros, in order to be able to look up the number of arguments for the macro, to know if the macro call should have any.
I found a better way to fix this and have added it to my fork.
If I have `define myexp exp and then call it with y = `myexp(5.0); OpenVAF complains error: argument mismatch expected 0 but found 1!
If I do y = `myexp (5.0); then it works fine -- note the space before the open-parenthesis.
The parser properly looks for an open-parenthesis when parsing the define: if it finds a parenthesis before any whitespace, then there are arguments for that macro. But when parsing the call, this is not the proper way to determine whether there are arguments.
Interestingly, it seems that the parser can support a macro call in the formal arguments: `define myadd(
arg1,
arg2) (arg1) + (
arg2) which seems a little weird. parse_define calls parse_macro_token, which can get macros.