Lines Matching refs:stream

60         self.stream = environment._tokenize(source, name, filename, state)
85 lineno = self.stream.current.lineno
152 if self.stream.current.type in ("variable_end", "block_end", "rparen"):
155 return self.stream.current.test_any(extra_end_rules) # type: ignore
167 token = self.stream.current
174 f = getattr(self, f"parse_{self.stream.current.value}")
202 reached. Per default the active token in the stream at the end of
207 self.stream.skip_if("colon")
211 self.stream.expect("block_end")
216 if self.stream.current.type == "eof":
220 next(self.stream)
225 lineno = next(self.stream).lineno
227 if self.stream.skip_if("assign"):
236 lineno = self.stream.expect("name:for").lineno
238 self.stream.expect("name:in")
243 if self.stream.skip_if("name:if"):
245 recursive = self.stream.skip_if("name:recursive")
247 if next(self.stream).value == "endfor":
255 node = result = nodes.If(lineno=self.stream.expect("name:if").lineno)
261 token = next(self.stream)
263 node = nodes.If(lineno=self.stream.current.lineno)
272 node = nodes.With(lineno=next(self.stream).lineno)
275 while self.stream.current.type != "block_end":
277 self.stream.expect("comma")
281 self.stream.expect("assign")
289 node = nodes.ScopedEvalContextModifier(lineno=next(self.stream).lineno)
295 node = nodes.Block(lineno=next(self.stream).lineno)
296 node.name = self.stream.expect("name").value
297 node.scoped = self.stream.skip_if("name:scoped")
298 node.required = self.stream.skip_if("name:required")
303 if self.stream.current.type == "sub":
323 self.stream.skip_if("name:" + node.name)
327 node = nodes.Extends(lineno=next(self.stream).lineno)
334 if self.stream.current.test_any(
336 ) and self.stream.look().test("name:context"):
337 node.with_context = next(self.stream).value == "with"
338 self.stream.skip()
344 node = nodes.Include(lineno=next(self.stream).lineno)
346 if self.stream.current.test("name:ignore") and self.stream.look().test(
350 self.stream.skip(2)
356 node = nodes.Import(lineno=next(self.stream).lineno)
358 self.stream.expect("name:as")
363 node = nodes.FromImport(lineno=next(self.stream).lineno)
365 self.stream.expect("name:import")
369 if self.stream.current.value in {
372 } and self.stream.look().test("name:context"):
373 node.with_context = next(self.stream).value == "with"
374 self.stream.skip()
380 self.stream.expect("comma")
381 if self.stream.current.type == "name":
391 if self.stream.skip_if("name:as"):
396 if parse_context() or self.stream.current.type != "comma":
399 self.stream.expect("name")
407 self.stream.expect("lparen")
408 while self.stream.current.type != "rparen":
410 self.stream.expect("comma")
413 if self.stream.skip_if("assign"):
418 self.stream.expect("rparen")
421 node = nodes.CallBlock(lineno=next(self.stream).lineno)
422 if self.stream.current.type == "lparen":
436 node = nodes.FilterBlock(lineno=next(self.stream).lineno)
442 node = nodes.Macro(lineno=next(self.stream).lineno)
449 node = nodes.Output(lineno=next(self.stream).lineno)
451 while self.stream.current.type != "block_end":
453 self.stream.expect("comma")
490 if with_namespace and self.stream.look().type == "dot":
491 token = self.stream.expect("name")
492 next(self.stream) # dot
493 attr = self.stream.expect("name")
496 token = self.stream.expect("name")
525 lineno = self.stream.current.lineno
529 while self.stream.skip_if("name:if"):
531 if self.stream.skip_if("name:else"):
536 lineno = self.stream.current.lineno
540 lineno = self.stream.current.lineno
542 while self.stream.skip_if("name:or"):
545 lineno = self.stream.current.lineno
549 lineno = self.stream.current.lineno
551 while self.stream.skip_if("name:and"):
554 lineno = self.stream.current.lineno
558 if self.stream.current.test("name:not"):
559 lineno = next(self.stream).lineno
564 lineno = self.stream.current.lineno
568 token_type = self.stream.current.type
570 next(self.stream)
572 elif self.stream.skip_if("name:in"):
574 elif self.stream.current.test("name:not") and self.stream.look().test(
577 self.stream.skip(2)
581 lineno = self.stream.current.lineno
587 lineno = self.stream.current.lineno
589 while self.stream.current.type in ("add", "sub"):
590 cls = _math_nodes[self.stream.current.type]
591 next(self.stream)
594 lineno = self.stream.current.lineno
598 lineno = self.stream.current.lineno
600 while self.stream.current.type == "tilde":
601 next(self.stream)
608 lineno = self.stream.current.lineno
610 while self.stream.current.type in ("mul", "div", "floordiv", "mod"):
611 cls = _math_nodes[self.stream.current.type]
612 next(self.stream)
615 lineno = self.stream.current.lineno
619 lineno = self.stream.current.lineno
621 while self.stream.current.type == "pow":
622 next(self.stream)
625 lineno = self.stream.current.lineno
629 token_type = self.stream.current.type
630 lineno = self.stream.current.lineno
634 next(self.stream)
637 next(self.stream)
647 token = self.stream.current
656 next(self.stream)
658 next(self.stream)
661 while self.stream.current.type == "string":
662 buf.append(self.stream.current.value)
663 next(self.stream)
666 next(self.stream)
669 next(self.stream)
671 self.stream.expect("rparen")
705 lineno = self.stream.current.lineno
720 self.stream.expect("comma")
724 if self.stream.current.type == "comma":
728 lineno = self.stream.current.lineno
741 f" got {describe_token(self.stream.current)!r}"
747 token = self.stream.expect("lbracket")
749 while self.stream.current.type != "rbracket":
751 self.stream.expect("comma")
752 if self.stream.current.type == "rbracket":
755 self.stream.expect("rbracket")
759 token = self.stream.expect("lbrace")
761 while self.stream.current.type != "rbrace":
763 self.stream.expect("comma")
764 if self.stream.current.type == "rbrace":
767 self.stream.expect("colon")
770 self.stream.expect("rbrace")
775 token_type = self.stream.current.type
788 token_type = self.stream.current.type
791 elif token_type == "name" and self.stream.current.value == "is":
804 token = next(self.stream)
808 attr_token = self.stream.current
809 next(self.stream)
820 while self.stream.current.type != "rbracket":
822 self.stream.expect("comma")
824 self.stream.expect("rbracket")
833 lineno = self.stream.current.lineno
836 if self.stream.current.type == "colon":
837 next(self.stream)
841 if self.stream.current.type != "colon":
843 next(self.stream)
846 if self.stream.current.type == "colon":
848 elif self.stream.current.type not in ("rbracket", "comma"):
853 if self.stream.current.type == "colon":
854 next(self.stream)
855 if self.stream.current.type not in ("rbracket", "comma"):
865 token = self.stream.expect("lparen")
876 while self.stream.current.type != "rparen":
878 self.stream.expect("comma")
881 if self.stream.current.type == "rparen":
884 if self.stream.current.type == "mul":
886 next(self.stream)
888 elif self.stream.current.type == "pow":
890 next(self.stream)
894 self.stream.current.type == "name"
895 and self.stream.look().type == "assign"
899 key = self.stream.current.value
900 self.stream.skip(2)
910 self.stream.expect("rparen")
915 # needs to be recorded before the stream is advanced.
916 token = self.stream.current
923 while self.stream.current.type == "pipe" or start_inline:
925 next(self.stream)
926 token = self.stream.expect("name")
928 while self.stream.current.type == "dot":
929 next(self.stream)
930 name += "." + self.stream.expect("name").value
931 if self.stream.current.type == "lparen":
944 token = next(self.stream)
945 if self.stream.current.test("name:not"):
946 next(self.stream)
950 name = self.stream.expect("name").value
951 while self.stream.current.type == "dot":
952 next(self.stream)
953 name += "." + self.stream.expect("name").value
956 if self.stream.current.type == "lparen":
958 elif self.stream.current.type in {
966 } and not self.stream.current.test_any("name:else", "name:or", "name:and"):
967 if self.stream.current.test("name:is"):
998 while self.stream:
999 token = self.stream.current
1003 next(self.stream)
1005 next(self.stream)
1007 self.stream.expect("variable_end")
1010 next(self.stream)
1011 if end_tokens is not None and self.stream.current.test_any(
1020 self.stream.expect("block_end")