};
-
-std::ostream &operator <<(std::ostream &out, Tokenizer::Token::Type t) {
+inline const char *TokenTypeToString(Tokenizer::Token::Type t) {
switch (t) {
case Tokenizer::Token::ANGLE_BRACKET_OPEN:
- out << "ANGLE_BRACKET_OPEN";
- break;
+ return "ANGLE_BRACKET_OPEN";
case Tokenizer::Token::ANGLE_BRACKET_CLOSE:
- out << "ANGLE_BRACKET_CLOSE";
- break;
+ return "ANGLE_BRACKET_CLOSE";
case Tokenizer::Token::CHEVRON_OPEN:
- out << "CHEVRON_OPEN";
- break;
+ return "CHEVRON_OPEN";
case Tokenizer::Token::CHEVRON_CLOSE:
- out << "CHEVRON_CLOSE";
- break;
+ return "CHEVRON_CLOSE";
case Tokenizer::Token::COLON:
- out << "COLON";
- break;
+ return "COLON";
case Tokenizer::Token::COMMA:
- out << "COMMA";
- break;
+ return "COMMA";
case Tokenizer::Token::BRACKET_OPEN:
- out << "BRACKET_OPEN";
- break;
+ return "BRACKET_OPEN";
case Tokenizer::Token::BRACKET_CLOSE:
- out << "BRACKET_CLOSE";
- break;
+ return "BRACKET_CLOSE";
case Tokenizer::Token::NUMBER:
- out << "NUMBER";
- break;
+ return "NUMBER";
case Tokenizer::Token::STRING:
- out << "STRING";
- break;
+ return "STRING";
case Tokenizer::Token::KEYWORD_EXPORT:
- out << "KEYWORD_EXPORT";
- break;
+ return "KEYWORD_EXPORT";
case Tokenizer::Token::KEYWORD_FALSE:
- out << "KEYWORD_FALSE";
- break;
+ return "KEYWORD_FALSE";
case Tokenizer::Token::KEYWORD_INCLUDE:
- out << "KEYWORD_INCLUDE";
- break;
+ return "KEYWORD_INCLUDE";
case Tokenizer::Token::KEYWORD_TRUE:
- out << "KEYWORD_TRUE";
- break;
+ return "KEYWORD_TRUE";
case Tokenizer::Token::IDENTIFIER:
- out << "IDENTIFIER";
- break;
+ return "IDENTIFIER";
case Tokenizer::Token::TYPE_NAME:
- out << "TYPE_NAME";
- break;
+ return "TYPE_NAME";
default:
- out << "UNKNOWN";
- break;
+ return "UNKNOWN";
}
+}
+
+std::ostream &operator <<(std::ostream &out, Tokenizer::Token::Type t) {
+ out << TokenTypeToString(t);
return out;
}