Files
funnygame/public/asmrigs/tokenparser.h

56 lines
1008 B
C++

#ifndef ASMRIGS_TOKEN_PARSER
#define ASMRIGS_TOKEN_PARSER
#include "tier2/tokenizer.h"
class CTokenParser
{
public:
bool IsEOF();
const char *PeekToken();
bool IsToken( const char *szString );
const char *PeekStringLiteral();
bool Continue();
Token_t *m_pTokens;
Token_t *m_pTokensEnd;
Token_t *m_pCurrentToken;
};
inline const char *CTokenParser::PeekToken()
{
if ( m_pCurrentToken->m_bIsQuoted )
return NULL;
return m_pCurrentToken->m_szValue;
}
inline bool CTokenParser::IsEOF()
{
if (m_pCurrentToken == m_pTokensEnd)
return true;
return false;
};
inline bool CTokenParser::IsToken( const char *szString )
{
if ( !V_strcmp(szString, m_pCurrentToken->m_szValue))
return true;
return false;
};
inline const char *CTokenParser::PeekStringLiteral()
{
if ( !m_pCurrentToken->m_bIsQuoted )
return NULL;
return m_pCurrentToken->m_szValue;
}
inline bool CTokenParser::Continue()
{
m_pCurrentToken++;
if ( m_pCurrentToken == m_pTokensEnd )
return false;
return true;
}
#endif