OSDN Git Service

lexer.cpp -- lexerの実装を開始。
[simplecms/utakata.git] / lexer.cpp
1 #include <iostream>
2
3 #include "lexer.h"
4
5 using namespace utakata;
6
7 smart_ptr<lexer::CLexeme> lexer::CLexer::lex(smart_ptr<utf8::CUTF8InputStream>& stream)
8 {
9     // 渡されたCUTF8InputStreamから、1文字ずつ読んでいき、各構文を解釈
10     // する。
11
12     // 何か一つの非終端記号、終端記号を読みだすたびにそれを返す。
13
14     // まずは何はなくとも1文字読みだす。
15     utf8_string::CUTF8Char ch(stream->read());
16
17     if (utf8_string::is_eof(ch))
18     {
19         // eofを示す値を返す。
20         return smart_ptr<lexer::CLexeme>();
21     }
22 }