mstch/src/token.hpp

28 lines
800 B
C++
Raw Normal View History

2015-04-16 05:37:32 +08:00
#pragma once
2015-04-10 02:41:27 +08:00
#include <string>
namespace mstch {
class token {
2015-04-13 08:15:51 +08:00
public:
enum class type {
text, variable, section_open, section_close, inverted_section_open,
unescaped_variable, comment, partial
};
2015-04-16 04:32:27 +08:00
token(bool is_tag, bool eol, bool ws_only, const std::string& str);
type token_type() const { return m_type; };
const std::string& content() const { return m_content; };
bool eol() const { return m_eol; }
bool ws_only() const { return m_ws_only; }
bool marked() const { return m_marked; }
void mark() { m_marked = true; };
2015-04-10 02:41:27 +08:00
private:
2015-04-16 04:32:27 +08:00
type m_type;
std::string m_content;
bool m_eol;
bool m_ws_only;
bool m_marked;
2015-04-15 22:13:23 +08:00
type token_info(char c);
2015-04-10 02:41:27 +08:00
};
}