[antlr-interest] The match rule c++ grammar define preproc directives
Serge Bakkal
serge.bakkal at wanadoo.fr
Tue Aug 5 10:34:27 PDT 2003
Hi , Im investigating c++ grammar enhancements to handle preprocessor
#define directives
everything works well when the define directive has no parameter (tricky but
works smooth )
Now the next thing is handling define arguments :
It appears that arguments can be can be of almost any kind , say :
#define TEST(a,b) a \
b
int s(int a,int b){return a+b;}
void theTest()
{
TEST(\
int s = \
\
::s(0,1);,
const char *_1 = "we have to handle it";
)
TEST( int (*S)(int,int) = ::s; , const char *_2 = "we have to handle it
too"; )
}
must both (amo ) be handled coreectly .
The most straightforward solution seems the is to use in that case
a second lexer : it has to handle any character until the next COMMA
or RPAREN is encountered provided that COMMA is not within a LPRAREN RPAREN
statement
and the RPAREN is not a LPAREN match :
How should the rule be written ?
TIA
Serge Bakkal
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list