// token.cpp #include "token.h" #include namespace Slang { Name* Token::getName() const { return getNameOrNull(); } Name* Token::getNameOrNull() const { switch (type) { default: return nullptr; case TokenType::Identifier: return (Name*) ptrValue; } } char const* TokenTypeToString(TokenType type) { switch( type ) { default: SLANG_ASSERT(!"unexpected"); return ""; #define TOKEN(NAME, DESC) case TokenType::NAME: return DESC; #include "token-defs.h" } } } // namespace Slang