[cfe-dev] More thoughts on user defined literals

AlisdairM(public) public at alisdairm.net
Wed Jul 8 16:51:24 PDT 2009

Still trying to wrap my head around the C++0x explosion of literals.

I'm thinking of taking yet another step back from the complex_string_literal idea, and storing the ud-suffix of a user defined literal in its own token.  That way, the same mechanism can work for user-defined string literals, character literals, integer literals and floating point literals.  The ud-suffix has to be an identifier, and we already have logic for that.

My inexperienced question is - when we move from lex to parse, is it easy to identify there is no whitespace between the literal component and the ud-suffix, or should I be trying to take care of this in the lexing phase?

User-defined suffices aside, the remaining work for 9 of the 10 possible string literals seems to fall naturally for a single prefixed_string_literal token.


More information about the cfe-dev mailing list