summaryrefslogtreecommitdiff
path: root/jinja2/parser.py
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2008-05-08 23:57:56 +0200
committerArmin Ronacher <armin.ronacher@active-4.com>2008-05-08 23:57:56 +0200
commit762079cd25921596b9e1227e6c3bad6d465c430f (patch)
tree9ff65b07de174d7f314781ba35e917dd414ae93d /jinja2/parser.py
parent023b5e9212155169d5ee5f979e3168b4196268f9 (diff)
downloadjinja2-762079cd25921596b9e1227e6c3bad6d465c430f.tar.gz
more updates on the extension API
--HG-- branch : trunk
Diffstat (limited to 'jinja2/parser.py')
-rw-r--r--jinja2/parser.py11
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.