From 762079cd25921596b9e1227e6c3bad6d465c430f Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Thu, 8 May 2008 23:57:56 +0200 Subject: more updates on the extension API --HG-- branch : trunk --- jinja2/parser.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'jinja2/parser.py') 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. -- cgit v1.2.1