optimizations

This commit is contained in:
Daniel Sipka 2015-04-15 22:32:27 +02:00
parent 48fbaeb3c9
commit 127609f392
5 changed files with 51 additions and 49 deletions

View file

@ -10,20 +10,19 @@ namespace mstch {
text, variable, section_open, section_close, inverted_section_open,
unescaped_variable, comment, partial
};
token(bool is_tag, bool eol, bool ws_only, const std::string& raw_val);
type token_type() const { return type_val; };
const std::string& content() const { return content_val; };
bool is_eol() const { return eol; }
bool is_ws_only() const { return ws_only; }
bool is_marked() const { return marked; }
void mark() { marked = true; };
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; };
private:
enum class parse_state { prews, postws, content };
type type_val;
std::string content_val;
bool eol;
bool ws_only;
bool marked;
type m_type;
std::string m_content;
bool m_eol;
bool m_ws_only;
bool m_marked;
type token_info(char c);
};
}