|
@@ -102,6 +102,7 @@ public:
|
|
|
i64val = 0;
|
|
i64val = 0;
|
|
|
loc.init();
|
|
loc.init();
|
|
|
name[0] = 0;
|
|
name[0] = 0;
|
|
|
|
|
+ fullyExpanded = false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Used for comparing macro definitions, so checks what is relevant for that.
|
|
// Used for comparing macro definitions, so checks what is relevant for that.
|
|
@@ -117,6 +118,8 @@ public:
|
|
|
// True if a space (for white space or a removed comment) should also be
|
|
// True if a space (for white space or a removed comment) should also be
|
|
|
// recognized, in front of the token returned:
|
|
// recognized, in front of the token returned:
|
|
|
bool space;
|
|
bool space;
|
|
|
|
|
+
|
|
|
|
|
+ bool fullyExpanded;
|
|
|
// Numeric value of the token:
|
|
// Numeric value of the token:
|
|
|
union {
|
|
union {
|
|
|
int ival;
|
|
int ival;
|
|
@@ -475,16 +478,27 @@ protected:
|
|
|
//
|
|
//
|
|
|
// From PpTokens.cpp
|
|
// From PpTokens.cpp
|
|
|
//
|
|
//
|
|
|
- void pushTokenStreamInput(TokenStream&, bool pasting = false);
|
|
|
|
|
|
|
+ void pushTokenStreamInput(TokenStream&, bool pasting = false, bool expanded = false);
|
|
|
void UngetToken(int token, TPpToken*);
|
|
void UngetToken(int token, TPpToken*);
|
|
|
|
|
|
|
|
class tTokenInput : public tInput {
|
|
class tTokenInput : public tInput {
|
|
|
public:
|
|
public:
|
|
|
- tTokenInput(TPpContext* pp, TokenStream* t, bool prepasting) :
|
|
|
|
|
|
|
+ tTokenInput(TPpContext* pp, TokenStream* t, bool prepasting, bool expanded) :
|
|
|
tInput(pp),
|
|
tInput(pp),
|
|
|
tokens(t),
|
|
tokens(t),
|
|
|
- lastTokenPastes(prepasting) { }
|
|
|
|
|
- virtual int scan(TPpToken *ppToken) override { return tokens->getToken(pp->parseContext, ppToken); }
|
|
|
|
|
|
|
+ lastTokenPastes(prepasting),
|
|
|
|
|
+ preExpanded(expanded) { }
|
|
|
|
|
+ virtual int scan(TPpToken *ppToken) override {
|
|
|
|
|
+ int token = tokens->getToken(pp->parseContext, ppToken);
|
|
|
|
|
+ ppToken->fullyExpanded = preExpanded;
|
|
|
|
|
+ if (tokens->atEnd() && token == PpAtomIdentifier) {
|
|
|
|
|
+ int macroAtom = pp->atomStrings.getAtom(ppToken->name);
|
|
|
|
|
+ MacroSymbol* macro = macroAtom == 0 ? nullptr : pp->lookupMacroDef(macroAtom);
|
|
|
|
|
+ if (macro && macro->functionLike)
|
|
|
|
|
+ ppToken->fullyExpanded = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return token;
|
|
|
|
|
+ }
|
|
|
virtual int getch() override { assert(0); return EndOfInput; }
|
|
virtual int getch() override { assert(0); return EndOfInput; }
|
|
|
virtual void ungetch() override { assert(0); }
|
|
virtual void ungetch() override { assert(0); }
|
|
|
virtual bool peekPasting() override { return tokens->peekTokenizedPasting(lastTokenPastes); }
|
|
virtual bool peekPasting() override { return tokens->peekTokenizedPasting(lastTokenPastes); }
|
|
@@ -492,6 +506,7 @@ protected:
|
|
|
protected:
|
|
protected:
|
|
|
TokenStream* tokens;
|
|
TokenStream* tokens;
|
|
|
bool lastTokenPastes; // true if the last token in the input is to be pasted, rather than consumed as a token
|
|
bool lastTokenPastes; // true if the last token in the input is to be pasted, rather than consumed as a token
|
|
|
|
|
+ bool preExpanded;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
class tUngotTokenInput : public tInput {
|
|
class tUngotTokenInput : public tInput {
|