Cleanup: The Tokenizer doesn't need to handle UTF in code nor multiline string. That is handled in the Preprocessor.

This commit is contained in:
Daniel Marjamäki 2010-04-02 20:48:32 +02:00
parent a1d0defbc0
commit ff38bbf468
2 changed files with 6 additions and 8 deletions

View File

@ -230,11 +230,8 @@ void Tokenizer::createTokens(std::istream &code)
// Read one byte at a time from code and create tokens // Read one byte at a time from code and create tokens
for (char ch = (char)code.get(); code.good(); ch = (char)code.get()) for (char ch = (char)code.get(); code.good(); ch = (char)code.get())
{ {
// We are not handling UTF and stuff like that. Code is supposed to plain simple text.
if (ch < 0)
continue;
// char/string.. // char/string..
// multiline strings are not handled. The preprocessor should handle that for us.
if (ch == '\'' || ch == '\"') if (ch == '\'' || ch == '\"')
{ {
std::string line; std::string line;
@ -247,9 +244,6 @@ void Tokenizer::createTokens(std::istream &code)
// Append token.. // Append token..
line += c; line += c;
if (c == '\n')
++lineno;
// Special sequence '\.' // Special sequence '\.'
if (special) if (special)
special = false; special = false;

View File

@ -71,7 +71,11 @@ public:
/** /**
* Create tokens from code. * Create tokens from code.
* @param code input stream for code, same as what tokenize() * The code must be preprocessed first:
* - multiline strings are not handled.
* - UTF in the code are not handled.
* - comments are not handled.
* @param code input stream for code
*/ */
void createTokens(std::istream &code); void createTokens(std::istream &code);