Lines Matching refs:stream
40 self.stream = environment._tokenize(source, name, filename, state)
58 lineno = self.stream.current.lineno
108 if self.stream.current.type in ('variable_end', 'block_end', 'rparen'):
111 return self.stream.current.test_any(extra_end_rules)
123 token = self.stream.current
130 return getattr(self, 'parse_' + self.stream.current.value)()
155 reached. Per default the active token in the stream at the end of
160 self.stream.skip_if('colon')
164 self.stream.expect('block_end')
169 if self.stream.current.type == 'eof':
173 next(self.stream)
178 lineno = next(self.stream).lineno
180 if self.stream.skip_if('assign'):
190 lineno = self.stream.expect('name:for').lineno
192 self.stream.expect('name:in')
196 if self.stream.skip_if('name:if'):
198 recursive = self.stream.skip_if('name:recursive')
200 if next(self.stream).value == 'endfor':
209 node = result = nodes.If(lineno=self.stream.expect('name:if').lineno)
216 token = next(self.stream)
218 node = nodes.If(lineno=self.stream.current.lineno)
228 node = nodes.With(lineno=next(self.stream).lineno)
231 while self.stream.current.type != 'block_end':
232 lineno = self.stream.current.lineno
234 self.stream.expect('comma')
238 self.stream.expect('assign')
247 node = nodes.ScopedEvalContextModifier(lineno=next(self.stream).lineno)
256 node = nodes.Block(lineno=next(self.stream).lineno)
257 node.name = self.stream.expect('name').value
258 node.scoped = self.stream.skip_if('name:scoped')
263 if self.stream.current.type == 'sub':
269 self.stream.skip_if('name:' + node.name)
273 node = nodes.Extends(lineno=next(self.stream).lineno)
278 if self.stream.current.test_any('name:with', 'name:without') and \
279 self.stream.look().test('name:context'):
280 node.with_context = next(self.stream).value == 'with'
281 self.stream.skip()
287 node = nodes.Include(lineno=next(self.stream).lineno)
289 if self.stream.current.test('name:ignore') and \
290 self.stream.look().test('name:missing'):
292 self.stream.skip(2)
298 node = nodes.Import(lineno=next(self.stream).lineno)
300 self.stream.expect('name:as')
305 node = nodes.FromImport(lineno=next(self.stream).lineno)
307 self.stream.expect('name:import')
311 if self.stream.current.value in ('with', 'without') and \
312 self.stream.look().test('name:context'):
313 node.with_context = next(self.stream).value == 'with'
314 self.stream.skip()
320 self.stream.expect('comma')
321 if self.stream.current.type == 'name':
329 if self.stream.skip_if('name:as'):
334 if parse_context() or self.stream.current.type != 'comma':
337 self.stream.expect('name')
345 self.stream.expect('lparen')
346 while self.stream.current.type != 'rparen':
348 self.stream.expect('comma')
351 if self.stream.skip_if('assign'):
356 self.stream.expect('rparen')
359 node = nodes.CallBlock(lineno=next(self.stream).lineno)
360 if self.stream.current.type == 'lparen':
373 node = nodes.FilterBlock(lineno=next(self.stream).lineno)
380 node = nodes.Macro(lineno=next(self.stream).lineno)
388 node = nodes.Output(lineno=next(self.stream).lineno)
390 while self.stream.current.type != 'block_end':
392 self.stream.expect('comma')
406 if with_namespace and self.stream.look().type == 'dot':
407 token = self.stream.expect('name')
408 next(self.stream) # dot
409 attr = self.stream.expect('name')
412 token = self.stream.expect('name')
436 lineno = self.stream.current.lineno
438 while self.stream.skip_if('name:if'):
440 if self.stream.skip_if('name:else'):
445 lineno = self.stream.current.lineno
449 lineno = self.stream.current.lineno
451 while self.stream.skip_if('name:or'):
454 lineno = self.stream.current.lineno
458 lineno = self.stream.current.lineno
460 while self.stream.skip_if('name:and'):
463 lineno = self.stream.current.lineno
467 if self.stream.current.test('name:not'):
468 lineno = next(self.stream).lineno
473 lineno = self.stream.current.lineno
477 token_type = self.stream.current.type
479 next(self.stream)
481 elif self.stream.skip_if('name:in'):
483 elif (self.stream.current.test('name:not') and
484 self.stream.look().test('name:in')):
485 self.stream.skip(2)
489 lineno = self.stream.current.lineno
495 lineno = self.stream.current.lineno
497 while self.stream.current.type in ('add', 'sub'):
498 cls = _math_nodes[self.stream.current.type]
499 next(self.stream)
502 lineno = self.stream.current.lineno
506 lineno = self.stream.current.lineno
508 while self.stream.current.type == 'tilde':
509 next(self.stream)
516 lineno = self.stream.current.lineno
518 while self.stream.current.type in ('mul', 'div', 'floordiv', 'mod'):
519 cls = _math_nodes[self.stream.current.type]
520 next(self.stream)
523 lineno = self.stream.current.lineno
527 lineno = self.stream.current.lineno
529 while self.stream.current.type == 'pow':
530 next(self.stream)
533 lineno = self.stream.current.lineno
537 token_type = self.stream.current.type
538 lineno = self.stream.current.lineno
540 next(self.stream)
543 next(self.stream)
553 token = self.stream.current
562 next(self.stream)
564 next(self.stream)
567 while self.stream.current.type == 'string':
568 buf.append(self.stream.current.value)
569 next(self.stream)
572 next(self.stream)
575 next(self.stream)
577 self.stream.expect('rparen')
606 lineno = self.stream.current.lineno
617 self.stream.expect('comma')
621 if self.stream.current.type == 'comma':
625 lineno = self.stream.current.lineno
637 describe_token(self.stream.current))
642 token = self.stream.expect('lbracket')
644 while self.stream.current.type != 'rbracket':
646 self.stream.expect('comma')
647 if self.stream.current.type == 'rbracket':
650 self.stream.expect('rbracket')
654 token = self.stream.expect('lbrace')
656 while self.stream.current.type != 'rbrace':
658 self.stream.expect('comma')
659 if self.stream.current.type == 'rbrace':
662 self.stream.expect('colon')
665 self.stream.expect('rbrace')
670 token_type = self.stream.current.type
683 token_type = self.stream.current.type
686 elif token_type == 'name' and self.stream.current.value == 'is':
697 token = next(self.stream)
699 attr_token = self.stream.current
700 next(self.stream)
710 while self.stream.current.type != 'rbracket':
712 self.stream.expect('comma')
714 self.stream.expect('rbracket')
723 lineno = self.stream.current.lineno
725 if self.stream.current.type == 'colon':
726 next(self.stream)
730 if self.stream.current.type != 'colon':
732 next(self.stream)
735 if self.stream.current.type == 'colon':
737 elif self.stream.current.type not in ('rbracket', 'comma'):
742 if self.stream.current.type == 'colon':
743 next(self.stream)
744 if self.stream.current.type not in ('rbracket', 'comma'):
754 token = self.stream.expect('lparen')
765 while self.stream.current.type != 'rparen':
767 self.stream.expect('comma')
769 if self.stream.current.type == 'rparen':
771 if self.stream.current.type == 'mul':
773 next(self.stream)
775 elif self.stream.current.type == 'pow':
777 next(self.stream)
781 if self.stream.current.type == 'name' and \
782 self.stream.look().type == 'assign':
783 key = self.stream.current.value
784 self.stream.skip(2)
793 self.stream.expect('rparen')
801 while self.stream.current.type == 'pipe' or start_inline:
803 next(self.stream)
804 token = self.stream.expect('name')
806 while self.stream.current.type == 'dot':
807 next(self.stream)
808 name += '.' + self.stream.expect('name').value
809 if self.stream.current.type == 'lparen':
821 token = next(self.stream)
822 if self.stream.current.test('name:not'):
823 next(self.stream)
827 name = self.stream.expect('name').value
828 while self.stream.current.type == 'dot':
829 next(self.stream)
830 name += '.' + self.stream.expect('name').value
833 if self.stream.current.type == 'lparen':
835 elif (self.stream.current.type in ('name', 'string', 'integer',
838 self.stream.current.test_any('name:else', 'name:or',
840 if self.stream.current.test('name:is'):
866 while self.stream:
867 token = self.stream.current
872 next(self.stream)
874 next(self.stream)
876 self.stream.expect('variable_end')
879 next(self.stream)
881 self.stream.current.test_any(*end_tokens):
888 self.stream.expect('block_end')