Open jamesosaurus opened 4 years ago
Maybe the example C grammar is following the language standards only. Iirc, attribute is a gcc specific language extension. I have a version of the C++ grammar that can parse at least some GCC/GLIBC STL headers with GCC extensions. That's not primarily what I'm experimenting with; so I haven't done a lot of testing beyond some code using STL headers. (I'm experimenting writing my own C/C++ preprocessor based on Antlr4 nextToken overloads. Making progress, but the BOOST C++ library header files REALLY! push the boundaries of what you'd expect from documentation).
Thanks, Mycroft. The C grammar has the rule
gccAttributeSpecifier : '__attribute__' '(' '(' gccAttributeList ')' ')' ;
which leads me to suspect that it is supposed to support the attribute extension but there may be different contexts in which it can be used and only a subset are supported.
Thanks. That wasn't in the C++ antlr grammar, and the current maintainer leans towards keeping that grammar "language standard" only.
Dave
On Thu, Oct 29, 2020 at 7:45 AM James Riordan notifications@github.com wrote:
Thanks, Mycroft. The C grammar has the rule which leads me to suspect that it is supposed to support the attribute extension but there may be different contexts in which it can be used and only a subset are supported.
gccAttributeSpecifier : 'attribute' '(' '(' gccAttributeList ')' ')' ;
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/antlr/grammars-v4/issues/1906#issuecomment-718801057, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOJRIIEK36OAWKOYJFJ6S5DSNF5Y5ANCNFSM4TBO6OPQ .
Fails to parse:
long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));