diff options
Diffstat (limited to 'jinja2/parser.py')
-rw-r--r-- | jinja2/parser.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/jinja2/parser.py b/jinja2/parser.py index 91a848b..427cb05 100644 --- a/jinja2/parser.py +++ b/jinja2/parser.py @@ -42,13 +42,20 @@ class Parser(object): 'rparen') or \ self.stream.current.test('name:in') - def ignore_colon(self): + def skip_colon(self): """If there is a colon, skip it and return `True`, else `False`.""" if self.stream.current.type is 'colon': self.stream.next() return True return False + def skip_comma(self): + """If there is a comma, skip it and return `True`, else `False`.""" + if self.stream.current.type is 'comma': + self.stream.next() + return True + return False + def free_identifier(self, lineno=None): """Return a new free identifier as :class:`~jinja2.nodes.InternalName`.""" self._last_identifier += 1 @@ -100,7 +107,7 @@ class Parser(object): can be set to `True` and the end token is removed. """ # the first token may be a colon for python compatibility - self.ignore_colon() + self.skip_colon() # in the future it would be possible to add whole code sections # by adding some sort of end of statement token and parsing those here. |