I am parsing C with the current C grammar in Java language and try to make sense of the parse tree.
I believe to have found a bug similar to #1979, in which a typedef appears instead of a directDeclarator.
As illustration, first a good parse:
typedef unsigned const int* x;
parses as:
Note the clear distinction between declarationSpecifiers and initDeclaratorList.
Whereas the following
typedef unsigned const int x;
parses as
The initDeclaratorList is missing, instead of being a directDeclarator the x is treated as yet another typeSpecifier.
The same erratic behaviour can be observed with
extern int* x;
extern int x;
The former being parsed properly, the latter not.
I am currently trying to write some post-processing logic to detect this, but it is not easy to distinguish the cases and it definitely messes with the situation at the wrong place (in the visitor) instead of in the grammar.
Any help is appreciated, this is currently a major blocker for proceeding with ANTLR (and this grammar).