- fbx: add binary reading draft. Started from scratch after my first attempt had design flaws. The binary reader now sits on the lexer stage (really) and generates a (fake) token sequence similar to the text lexer's output - this means most parsing code can go unaffected.

This commit is contained in:
Alexander Gessler
2012-08-09 02:08:12 +02:00
parent 3899fc5257
commit 24ce9495fd
8 changed files with 1738 additions and 1304 deletions

View File

@@ -79,6 +79,12 @@ const char* TokenTypeString(TokenType t)
}
// ------------------------------------------------------------------------------------------------
std::string AddOffset(const std::string& prefix, const std::string& text, unsigned int offset)
{
return static_cast<std::string>( (Formatter::format(),prefix," (offset 0x",std::hex,offset,") ",text) );
}
// ------------------------------------------------------------------------------------------------
std::string AddLineAndColumn(const std::string& prefix, const std::string& text, unsigned int line, unsigned int column)
{
@@ -88,6 +94,13 @@ std::string AddLineAndColumn(const std::string& prefix, const std::string& text,
// ------------------------------------------------------------------------------------------------
std::string AddTokenText(const std::string& prefix, const std::string& text, const Token* tok)
{
if(tok->IsBinary()) {
return static_cast<std::string>( (Formatter::format(),prefix,
" (",TokenTypeString(tok->Type()),
", offset 0x", std::hex, tok->Offset(),") ",
text) );
}
return static_cast<std::string>( (Formatter::format(),prefix,
" (",TokenTypeString(tok->Type()),
", line ",tok->Line(),