#ifndef __TRACYSOURCETOKENIZER_HPP__ #define __TRACYSOURCETOKENIZER_HPP__ #include #include namespace tracy { class Tokenizer { public: enum class TokenColor : uint8_t { Default, Comment, Preprocessor, String, CharacterLiteral, Keyword, Number, Punctuation, Type, Special }; struct Token { const char* begin; const char* end; TokenColor color; }; struct Line { const char* begin; const char* end; std::vector tokens; }; enum class AsmTokenColor : uint8_t { Label, // no-op, padding Default, // '+', '[', '*', etc SizeDirective, // byte, word, dword, etc Register, // rax, rip, etc Literal, // 0x04, etc }; Tokenizer(); std::vector Tokenize( const char* begin, const char* end ); private: TokenColor IdentifyToken( const char*& begin, const char* end ); bool m_isInComment; bool m_isInPreprocessor; }; } #endif