Newer
Older
*
* Created on: Nov 23, 2013
* Author: Jan Travnicek
*/
ContainerFromStringLexer::Token ContainerFromStringLexer::next(std::istream& in) {
ContainerFromStringLexer::Token token;
token.type = TokenType::ERROR;
token.value = "";
token.raw = "";
if ( in.eof ( ) || character == EOF ) {
token.type = TokenType::TEOF;
return token;
} else if ( isspace ( character ) ) {
token.value += character;
token.raw += character;
return token;
token.value += character;
token.raw += character;
} else if(character == '[') {
token.type = TokenType::VECTOR_BEGIN;
token.value += character;
token.raw += character;
return token;
} else if(character == ']') {
token.type = TokenType::VECTOR_END;
token.value += character;
token.raw += character;
return token;
token.type = TokenType::PAIR_BEGIN;
token.value += character;
token.raw += character;
return token;
token.type = TokenType::PAIR_END;
token.value += character;
token.raw += character;
return token;
} else if(character == ',') {
token.type = TokenType::COMMA;
token.value += character;
token.raw += character;
return token;
token.type = TokenType::ERROR;
return token;