Lines Matching refs:parser

45     system at the parser level.  Custom extensions are bound to an environment
101 def parse(self, parser):
103 parser as first argument. The token the parser stream is pointing at
217 def parse(self, parser):
219 lineno = next(parser.stream).lineno
229 while parser.stream.current.type != 'block_end':
231 parser.stream.expect('comma')
234 if parser.stream.skip_if('colon'):
237 name = parser.stream.expect('name')
239 parser.fail('translatable variable %r defined twice.' %
244 if parser.stream.current.type == 'assign':
245 next(parser.stream)
246 variables[name.value] = var = parser.parse_expression()
263 parser.stream.expect('block_end')
270 singular_names, singular = self._parse_block(parser, True)
278 if parser.stream.current.test('name:pluralize'):
280 next(parser.stream)
281 if parser.stream.current.type != 'block_end':
282 name = parser.stream.expect('name')
284 parser.fail('unknown variable %r for pluralization' %
289 parser.stream.expect('block_end')
290 plural_names, plural = self._parse_block(parser, False)
291 next(parser.stream)
294 next(parser.stream)
304 parser.fail('pluralize without variables', lineno)
325 def _parse_block(self, parser, allow_pluralize):
330 if parser.stream.current.type == 'data':
331 buf.append(parser.stream.current.value.replace('%', '%%'))
332 next(parser.stream)
333 elif parser.stream.current.type == 'variable_begin':
334 next(parser.stream)
335 name = parser.stream.expect('name').value
338 parser.stream.expect('variable_end')
339 elif parser.stream.current.type == 'block_begin':
340 next(parser.stream)
341 if parser.stream.current.test('name:endtrans'):
343 elif parser.stream.current.test('name:pluralize'):
346 parser.fail('a translatable section can have only one '
348 parser.fail('control structures in translatable sections are '
350 elif parser.stream.eos:
351 parser.fail('unclosed translation block')
353 assert False, 'internal parser error'
412 def parse(self, parser):
413 node = nodes.ExprStmt(lineno=next(parser.stream).lineno)
414 node.node = parser.parse_tuple()
422 def parse(self, parser):
423 token = next(parser.stream)