mstch/src/token.hpp

26 lines
635 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 08:34:27 +08:00
token(const std::string& raw_token);
type token_type() const;
std::string content() const;
std::string raw() 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 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_