bool Tokenizer::Next(Token& aToken) { if (!HasInput()) { mHasFailed = true; return false; } mRollback = mCursor; mCursor = Parse(aToken); aToken.AssignFragment(mRollback, mCursor); mPastEof = aToken.Type() == TOKEN_EOF; mHasFailed = false; return true; }
bool Tokenizer::Check(const TokenType aTokenType, Token& aResult) { if (!HasInput()) { mHasFailed = true; return false; } nsACString::const_char_iterator next = Parse(aResult); if (aTokenType != aResult.Type()) { mHasFailed = true; return false; } mRollback = mCursor; mCursor = next; aResult.AssignFragment(mRollback, mCursor); mPastEof = aResult.Type() == TOKEN_EOF; mHasFailed = false; return true; }