//------------------------------------------------------------------------// bool TokenFile::ReadTokens() { // first read in the token type Token::TOKEN_TYPE type; Token tok; while(!m_queBuffer.empty()) { // first read in the token type type = (Token::TOKEN_TYPE)ReadByte(); switch(type) { case Token::KEYWORD: if(m_bWordKeywordIndex) { WORD index = ReadWord(); assert(index < m_vecKeyword.size()); tok.InitKeyword(m_vecKeyword[index].c_str()); } else { BYTE index = ReadByte(); assert(index < m_vecKeyword.size()); tok.InitKeyword(m_vecKeyword[index].c_str()); } break; case Token::OPERATOR: if(m_bWordOperatorIndex) { WORD index = ReadWord(); assert(index < m_vecOperator.size()); tok.InitOperator(m_vecOperator[index].c_str()); } else { BYTE index = ReadByte(); assert(index < m_vecOperator.size()); tok.InitOperator(m_vecOperator[index].c_str()); } break; case Token::VARIABLE: if(m_bWordVariableIndex) { WORD index = ReadWord(); assert(index < m_vecVariable.size()); tok.InitVariable(m_vecVariable[index].c_str()); } else { BYTE index = ReadByte(); assert(index < m_vecVariable.size()); tok.InitVariable(m_vecVariable[index].c_str()); } break; case Token::STRING: tok.InitString(ReadString().c_str()); break; case Token::INTEGER: tok.InitInteger((int)ReadDword()); break; case Token::REAL: tok.InitReal(ReadDouble()); break; case Token::BOOLEAN: tok.InitBoolean((ReadByte() != 0) ? true : false); break; case Token::VECTOR: tok.InitVector(ReadVector()); break; case Token::T_GUID: tok.InitGuid(ReadGuid()); break; default: return Error::Handle("Format error in pre-compiled file."); }; m_pTokenList->push_back(tok); tok.Term(); } return true; }