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-23 17:06:44 +08:00
|
|
|
token(const std::string& str, std::size_t left = 0, std::size_t right = 0);
|
2015-04-16 04:32:27 +08:00
|
|
|
type token_type() const { return m_type; };
|
2015-04-22 17:39:07 +08:00
|
|
|
const std::string& raw() const { return m_raw; };
|
|
|
|
const std::string& name() const { return m_name; };
|
2015-04-16 04:32:27 +08:00
|
|
|
bool eol() const { return m_eol; }
|
|
|
|
bool ws_only() const { return m_ws_only; }
|
2015-04-10 02:41:27 +08:00
|
|
|
private:
|
2015-04-16 04:32:27 +08:00
|
|
|
type m_type;
|
2015-04-22 17:39:07 +08:00
|
|
|
std::string m_name;
|
|
|
|
std::string m_raw;
|
2015-04-16 04:32:27 +08:00
|
|
|
bool m_eol;
|
|
|
|
bool m_ws_only;
|
2015-04-15 22:13:23 +08:00
|
|
|
type token_info(char c);
|
2015-04-10 02:41:27 +08:00
|
|
|
};
|
|
|
|
}
|