mstch/src/token.hpp

28 lines
704 B
C++
Raw Normal View History

2015-04-10 02:41:27 +08:00
#ifndef _MSTCH_TOKEN_H_
#define _MSTCH_TOKEN_H_
#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-13 22:35:12 +08:00
token(bool is_tag_val, const std::string& raw_val);
2015-04-13 08:34:27 +08:00
type token_type() const;
std::string content() const;
std::string raw() const;
2015-04-13 22:35:12 +08:00
bool is_tag() const;
2015-04-10 02:41:27 +08:00
private:
2015-04-13 08:15:51 +08:00
type type_val;
2015-04-10 02:41:27 +08:00
std::string content_val;
std::string raw_val;
2015-04-13 22:35:12 +08:00
bool is_tag_val;
2015-04-13 08:15:51 +08:00
std::tuple<int,int,type> token_info(const std::string& inside);
2015-04-10 02:41:27 +08:00
};
}
#endif //_MSTCH_TOKEN_H_