]> git.localhorst.tv Git - l2e.git/commitdiff
added output function for token types
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Sun, 26 Aug 2012 13:31:49 +0000 (15:31 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Sun, 26 Aug 2012 13:31:49 +0000 (15:31 +0200)
src/loader/Tokenizer.h

index f363af70bd0169684a247c3bb45262b6dbe6542a..f761e5fb725d590cc057b8709a4d94ca8bca091c 100644 (file)
@@ -9,6 +9,7 @@
 #define LOADER_TOKENIZER_H_
 
 #include <iosfwd>
+#include <ostream>
 #include <string>
 
 namespace loader {
@@ -74,6 +75,64 @@ private:
 
 };
 
+
+std::ostream &operator <<(std::ostream &out, Tokenizer::Token::Type t) {
+       switch (t) {
+               case Tokenizer::Token::ANGLE_BRACKET_OPEN:
+                       out << "ANGLE_BRACKET_OPEN";
+                       break;
+               case Tokenizer::Token::ANGLE_BRACKET_CLOSE:
+                       out << "ANGLE_BRACKET_CLOSE";
+                       break;
+               case Tokenizer::Token::CHEVRON_OPEN:
+                       out << "CHEVRON_OPEN";
+                       break;
+               case Tokenizer::Token::CHEVRON_CLOSE:
+                       out << "CHEVRON_CLOSE";
+                       break;
+               case Tokenizer::Token::COLON:
+                       out << "COLON";
+                       break;
+               case Tokenizer::Token::COMMA:
+                       out << "COMMA";
+                       break;
+               case Tokenizer::Token::BRACKET_OPEN:
+                       out << "BRACKET_OPEN";
+                       break;
+               case Tokenizer::Token::BRACKET_CLOSE:
+                       out << "BRACKET_CLOSE";
+                       break;
+               case Tokenizer::Token::NUMBER:
+                       out << "NUMBER";
+                       break;
+               case Tokenizer::Token::STRING:
+                       out << "STRING";
+                       break;
+               case Tokenizer::Token::KEYWORD_EXPORT:
+                       out << "KEYWORD_EXPORT";
+                       break;
+               case Tokenizer::Token::KEYWORD_FALSE:
+                       out << "KEYWORD_FALSE";
+                       break;
+               case Tokenizer::Token::KEYWORD_INCLUDE:
+                       out << "KEYWORD_INCLUDE";
+                       break;
+               case Tokenizer::Token::KEYWORD_TRUE:
+                       out << "KEYWORD_TRUE";
+                       break;
+               case Tokenizer::Token::IDENTIFIER:
+                       out << "IDENTIFIER";
+                       break;
+               case Tokenizer::Token::TYPE_NAME:
+                       out << "TYPE_NAME";
+                       break;
+               default:
+                       out << "UNKNOWN";
+                       break;
+       }
+       return out;
+}
+
 }
 
 #endif /* LOADER_TOKENIZER_H_ */