Ok, let's explain some thing about introduce a "state" variable in the Tokenizer.
There are several reasons:
1, Before that, Tokenizer use a bool variable SkipUnWanted to determine where the Tokenizer need to skip some statement like assignment "=" or array subscirpt "[]".
2, Angle Brace is a single token return from the Tokenizer::GetToken or Tokenizer::PeekToken.
But when we want to read the template argument. like the code below:
template < XXXX >
class AAA{
...
}
I would perfer the Tokenizer return the whole string
< XXXX >3,When we are entering some context, we should save the context state.
Before:
bool oldState = m_Tokenizer.IsSkippingUnwantedTokens();
m_Tokenizer.SetSkipUnwantedTokens(false);
m_Tokenizer.SetOperatorState(true);
Do some parsing..
m_Tokenizer.SetSkipUnwantedTokens(oldState);
But I think a
bool variable is not enough to describe all the context, so ,I use a more flexiable enum variable.
The benifit is that Currently, CC is only a partily parser, which means some statements are skiped( currently, the member function body is skiped, the statement in the right side of an assignment is skiped too). But for the long run, I think add a state is convient