[cfe-dev] More thoughts on user defined literals
Sebastian Redl
sebastian.redl at getdesigned.at
Thu Jul 9 00:50:19 PDT 2009
On Wed, 8 Jul 2009 16:59:30 -0700, Eli Friedman <eli.friedman at gmail.com>
wrote:
> On Wed, Jul 8, 2009 at 4:51 PM, AlisdairM(public)<public at alisdairm.net>
> wrote:
>> 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?
>
> You can check in the parser with hasLeadingSpace(), but it's probably
> better to handle it in the lexer; it would massively complicate the
> parser to check for a string in every single place that expects an
> identifier.
Why would that be necessary? I think only ParseStringLiteral would have to
check if the string literal is immediately followed by an identifier
without space in-between.
The check for strings where an identifier is expected is only necessary if
you want to use the same technique for prefixes.
Sebastian
More information about the cfe-dev
mailing list