Commit cb8c06ca by Chris Jerdonek

Renamed variables in the parse_to_tree() method.

parent c2500342
...@@ -134,23 +134,25 @@ class Template(object): ...@@ -134,23 +134,25 @@ class Template(object):
self.tag_re = re.compile(tag % tags, re.M | re.X) self.tag_re = re.compile(tag % tags, re.M | re.X)
def parse_to_tree(self, template, index=0): def parse_to_tree(self, template, index=0):
"""Parse a template into a syntax tree.""" """
Parse a template into a syntax tree.
buffer = [] """
pos = index parse_tree = []
start_index = index
while True: while True:
match = self.tag_re.search(template, pos) match = self.tag_re.search(template, index)
if match is None: if match is None:
break break
pos = self._handle_match(template, match, buffer, index) index = self._handle_match(template, match, parse_tree, start_index)
# Save the rest of the template. # Save the rest of the template.
buffer.append(template[pos:]) parse_tree.append(template[index:])
return buffer return parse_tree
def _handle_match(self, template, match, buffer, index): def _handle_match(self, template, match, buffer, index):
# Normalize the captures dictionary. # Normalize the captures dictionary.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment