refactor tokenizer with delimiter change support
This commit is contained in:
parent
7bdde0783f
commit
8a32d98443
14 changed files with 65 additions and 89 deletions
|
@ -19,7 +19,9 @@ token::token(const std::string& str, std::size_t left, std::size_t right):
|
|||
m_raw(str), m_eol(false), m_ws_only(false)
|
||||
{
|
||||
if (left != 0 && right != 0) {
|
||||
if (str[left] == '{' && str[str.size() - right - 1] == '}') {
|
||||
if (str[left] == '=' && str[str.size() - right - 1] == '=') {
|
||||
m_type = type::delimiter_change;
|
||||
} else if (str[left] == '{' && str[str.size() - right - 1] == '}') {
|
||||
m_type = type::unescaped_variable;
|
||||
m_name = {first_not_ws(str.begin() + left + 1, str.end() - right),
|
||||
first_not_ws(str.rbegin() + 1 + right, str.rend() - left) + 1};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue