typedef int x;
void f1(int(x)); // same as void f(int (*)(int))
void f2(int(y)); // same as void f(int)
void f3(int((*))); // same as void f(int *)
void f4(int((*x))); // same as void f(int *)
void f5(int((x))); // same as void f(int (*)(int))
void f6(int(int)); // same as void f(int (*)(int))
It looks like lacc is handling all but f1, f5, and f6.
This is a bit tricky, but I think it can be done by checking the token after the opening (. If it is a *, (, or an identifier that is a typename, it is just a parenthesized declarator or abstract-declarator. Otherwise, it begins the parameter-type-list of an abstract function declarator.
Thanks again for reporting, appreciate the detailed info and test cases. I think your suggestion about checking the next token is correct, and that is what I ended up implementing. Fixed in dcc700fe.
Some interesting examples
It looks like lacc is handling all but
f1
,f5
, andf6
.This is a bit tricky, but I think it can be done by checking the token after the opening
(
. If it is a*
,(
, or an identifier that is a typename, it is just a parenthesized declarator or abstract-declarator. Otherwise, it begins the parameter-type-list of an abstract function declarator.