- 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:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user