PP: Faithfully track white-space through macro record/use, fixing bugs:

This fixes the comparison in macro body redefinitions, where initial
white-space differences do not matter, but internal white-space differences
do matter.
This commit is contained in:
John Kessenich 2019-02-19 03:12:02 -07:00
parent 5cdf3c5a23
commit 6225dd4ba1
2 changed files with 28 additions and 11 deletions

View file

@ -252,11 +252,13 @@ public:
public:
Token(int atom, const TPpToken& ppToken) :
atom(atom),
space(ppToken.space),
i64val(ppToken.i64val),
name(ppToken.name) { }
int get(TPpToken& ppToken)
{
ppToken.clear();
ppToken.space = space;
ppToken.i64val = i64val;
snprintf(ppToken.name, sizeof(ppToken.name), "%s", name.c_str());
return atom;
@ -265,6 +267,7 @@ public:
protected:
Token() {}
int atom;
bool space; // did a space precede the token?
long long i64val;
TString name;
};