21 def __init__(self, string, identifiers='$@%&*'):
33 if self.
_split_split(string):
38 base = replacer.replace_string(self.
basebase)
42 return '%s{%s}' % (self.
identifieridentifier, base)
63 self.
endend += len(
''.join(self.
itemsitems)) + 2 * len(self.
itemsitems)
69 self.
startstart = start_index
76 for index, char
in enumerate(string[start_index:], start=start_index):
78 self.
_state_state(char, index)
89 max_end_index = string.rfind(
'}')
90 if max_end_index == -1:
92 if self.
_is_escaped_is_escaped(string, max_end_index):
97 return start_index, max_end_index
101 index = string.find(
'{', start, end) - 1
110 and not self.
_is_escaped_is_escaped(string, index))
114 while index > 0
and string[index-1] ==
'\\':
116 escaped =
not escaped
172 if var.identifier
is None:
174 before = string[:var.start]
175 variable =
'%s{%s}' % (var.identifier, var.base)
176 string = string[var.end:]
177 yield before, variable, string
180 return sum(1
for _
in self)
185 except StopIteration:
def __init__(self, string, identifiers='$@%&*')
def _internal_variable_start_state(self, char, index)
def get_replaced_variable(self, replacer)
def _find_start_index(self, string, start, end)
def is_dict_variable(self)
def __init__(self, string, identifiers='$@%&*')
def _item_state(self, char, index)
def _start_index_is_ok(self, string, index)
def _find_variable(self, string)
def _is_escaped(self, string, index)
def is_list_variable(self)
def _waiting_item_state(self, char, index)
_may_have_internal_variables
def _variable_state(self, char, index)