// BufferedCPreParser.cpp: Subclass of CPreParserImp that supports output
// of tokens to a specialized token buffer
#include "BufferedCPreParser.h"
#include "CPreToCPPBuffer.h"
BufferedCPreParser::BufferedCPreParser(
ANTLRTokenStream *cPreInput,
CPreToCPPBuffer* buffer_
) :
CPreParserImp(cPreInput),
buffer(buffer_)
{
}
// This method is like CPreParser's method, except that it doesn't
// output a newline, since this is not for human consumption
void
BufferedCPreParser::ExpandAndOutputTokenList(
TokenList *tokenList
)
{
ExpandTokenList(tokenList, tokenList->begin());
OutputTokenList(tokenList);
}
// Output a token to the token buffer.
void
BufferedCPreParser::OutputToken(
const ANTLRTokenPtr& token
) const
{
assert(buffer != 0);
buffer->AddToken(token);
}