1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
// token.cpp #include "token.h" #include <assert.h> namespace Slang { namespace Compiler { char const* TokenTypeToString(TokenType type) { switch( type ) { default: assert(!"unexpected"); return "<uknown>"; #define TOKEN(NAME, DESC) case TokenType::NAME: return DESC; #include "token-defs.h" } } }}