[cfe-dev] How difference of implement pragma handler in lexer and parser

Douglas Gregor dgregor at apple.com
Tue Jun 29 07:19:10 PDT 2010


On Jun 28, 2010, at 6:46 PM, Pisit Makpaisit wrote:

> I notice that clang can implement the pragma handler in both lexer (Lex/Pragma.cpp) and parser (Parse/ParsePragma.cpp). How difference of they?
> 
> If my pragma directive has an expression. How can I parse and check expression syntax in pragma? 
> I think I should implement pragma handler in parser for parse the expression but I don't know how can I do.

If you want to parse an expression in your pragma, you'll need to implement your pragma's parsing logic within the parser itself, which knows how to parse an expression.

	- Doug



More information about the cfe-dev mailing list