[cfe-dev] changing the lexer or parser

b.j.burgers at student.utwente.nl b.j.burgers at student.utwente.nl
Tue Sep 9 14:27:52 PDT 2008



I'm working on a tool that allows time construct in C. I implemented
this tool by adapting Clang.

In these time constructs I like to allow arguments like "1000s", "1000
s", "1000  s", "100ms", "100 ms", etc.

The lexer creates 1 token called numerical_token if the argument is
"1000s" even if 's' is added as keyword or token in TokenKinds.def. I
hoped the lexer would have generated two tokens, 1 numerical_constant
and an identifier (or self defined token).

What is the best way to allow these kind of arguments ? Do I have to
create a new token that allows some digits followed by an 's'?


Thanks for any help,


Bas Burgers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080909/1bdc70d2/attachment.html>

More information about the cfe-dev mailing list