4 * Created on: Aug 26, 2012
8 #ifndef LOADER_TOKENIZER_H_
9 #define LOADER_TOKENIZER_H_
20 Tokenizer(std::istream &in) : in(in), isPutback(false) { }
23 Tokenizer(const Tokenizer &);
24 Tokenizer &operator =(const Tokenizer &);
31 ANGLE_BRACKET_OPEN = '{',
32 ANGLE_BRACKET_CLOSE = '}',
49 Token() : type(UNKNOWN), number(0) { }
50 Token(Type t) : type(t), number(0) { }
60 void Putback(const Token &);
67 Token ReadIdentifier();
69 bool CheckKeyword(Token &);
79 std::ostream &operator <<(std::ostream &out, Tokenizer::Token::Type t) {
81 case Tokenizer::Token::ANGLE_BRACKET_OPEN:
82 out << "ANGLE_BRACKET_OPEN";
84 case Tokenizer::Token::ANGLE_BRACKET_CLOSE:
85 out << "ANGLE_BRACKET_CLOSE";
87 case Tokenizer::Token::CHEVRON_OPEN:
88 out << "CHEVRON_OPEN";
90 case Tokenizer::Token::CHEVRON_CLOSE:
91 out << "CHEVRON_CLOSE";
93 case Tokenizer::Token::COLON:
96 case Tokenizer::Token::COMMA:
99 case Tokenizer::Token::BRACKET_OPEN:
100 out << "BRACKET_OPEN";
102 case Tokenizer::Token::BRACKET_CLOSE:
103 out << "BRACKET_CLOSE";
105 case Tokenizer::Token::NUMBER:
108 case Tokenizer::Token::STRING:
111 case Tokenizer::Token::KEYWORD_EXPORT:
112 out << "KEYWORD_EXPORT";
114 case Tokenizer::Token::KEYWORD_FALSE:
115 out << "KEYWORD_FALSE";
117 case Tokenizer::Token::KEYWORD_INCLUDE:
118 out << "KEYWORD_INCLUDE";
120 case Tokenizer::Token::KEYWORD_TRUE:
121 out << "KEYWORD_TRUE";
123 case Tokenizer::Token::IDENTIFIER:
126 case Tokenizer::Token::TYPE_NAME:
138 #endif /* LOADER_TOKENIZER_H_ */