#include "StringFromStringLexer.h" namespace string { StringFromStringLexer::StringFromStringLexer(std::stringstream& in) : m_In(in) { m_Current.type = TokenType::ERROR; m_Current.value = ""; } StringFromStringLexer& StringFromStringLexer::next() { char character; m_Current.value = ""; L0: character = m_In.get(); if(m_In.eof()) { m_Current.type = TokenType::TEOF; return *this; } else if(character == ' ' || character == '\n' || character == '\t') { goto L0; } else if(character == '<') { m_Current.type = TokenType::LESS; m_Current.value += character; return *this; } else if(character == '>') { m_Current.type = TokenType::GREATER; m_Current.value += character; return *this; } else if(character == '"') { m_Current.type = TokenType::QUOTE; m_Current.value += character; return *this; } else { m_In.unget(); m_Current.type = TokenType::ERROR; return *this; } } StringFromStringLexer::Token StringFromStringLexer::token() { return m_Current; } } /* namespace string */