C++ Logo

sg16

Advanced search

Re: Help request: regex for pp-number with XID_Continue

From: will wray <wjwray_at_[hidden]>
Date: Tue, 13 Dec 2022 10:33:55 -0400
Thanks Jens;
I should've used the terms from the 2nd paragraph linked
https://eel.is/c++draft/lex#ppnumber-2

> A preprocessing number does not have a type or a value;
> it acquires both after a successful conversion to an
> *integer-literal* <https://eel.is/c++draft/lex#nt:integer-literal> token
or a *floating-point-literal*
<https://eel.is/c++draft/lex#nt:floating-point-literal> token.

The final conversion doesn't happen until phase-7, but also
during phase-4 when #if preprocessing directives are executed
https://eel.is/c++draft/cpp

> After all replacements due to macro expansion and evaluations
> ... each preprocessing token is converted into a token.

and I guess that's my answer - only for #if conditional evaluation.


On Mon, Dec 12, 2022 at 6:31 PM Jens Maurer <jens.maurer_at_[hidden]> wrote:

>
>
> On 12/12/2022 23.15, will wray via SG16 wrote:
> >
> > Bonus follow on preprocessing question (not unicode related):
> >
> > For a pure preprocessor, divorced from a C or C++ compiler,
> > is there any need for cpp-integer and cpp-float tokens?
>
> I don't know what you're talking about.
>
> Neither cpp-integer nor cpp-float appear in the C++ standard.
>
> Jens
>
>
> > My PR fix entirely removes their CPP_INTEGER and CPPFLOAT
> > tokens, which appear to be superfluous in a pure preprocessor up to
> > phase 4; all tests pass and the PR fixes my issue and another issue.
> > The evaluator for #if conditional expressions doesn't do cpp-tokens
> > tokenization, which would've been the only place the CPP_ tokens
> > might have been needed, I think...
> >
> >
> >
> >
> >
>

Received on 2022-12-13 14:34:07