Lines Matching refs:token

167         token = self.stream.current
168 if token.type != "name":
169 self.fail("tag name expected", token.lineno)
170 self._tag_stack.append(token.value)
173 if token.value in _statement_keywords:
176 if token.value == "call":
178 if token.value == "filter":
180 ext = self.extensions.get(token.value)
184 # did not work out, remove the token we pushed by accident
189 self.fail_unknown_tag(token.value, token.lineno)
200 current token is a colon and skips it if there is one. Then it checks
202 reached. Per default the active token in the stream at the end of
203 the call is the matched end token. If this is not wanted `drop_needle`
204 can be set to `True` and the end token is removed.
206 # the first token may be a colon for python compatibility
210 # by adding some sort of end of statement token and parsing those here.
261 token = next(self.stream)
262 if token.test("name:elif"):
266 elif token.test("name:else"):
491 token = self.stream.expect("name")
494 target = nodes.NSRef(token.value, attr.value, lineno=token.lineno)
496 token = self.stream.expect("name")
497 target = nodes.Name(token.value, "store", lineno=token.lineno)
647 token = self.stream.current
649 if token.type == "name":
650 if token.value in ("true", "false", "True", "False"):
651 node = nodes.Const(token.value in ("true", "True"), lineno=token.lineno)
652 elif token.value in ("none", "None"):
653 node = nodes.Const(None, lineno=token.lineno)
655 node = nodes.Name(token.value, "load", lineno=token.lineno)
657 elif token.type == "string":
659 buf = [token.value]
660 lineno = token.lineno
665 elif token.type in ("integer", "float"):
667 node = nodes.Const(token.value, lineno=token.lineno)
668 elif token.type == "lparen":
672 elif token.type == "lbracket":
674 elif token.type == "lbrace":
677 self.fail(f"unexpected {describe_token(token)!r}", token.lineno)
747 token = self.stream.expect("lbracket")
756 return nodes.List(items, lineno=token.lineno)
759 token = self.stream.expect("lbrace")
771 return nodes.Dict(items, lineno=token.lineno)
804 token = next(self.stream)
807 if token.type == "dot":
812 node, attr_token.value, "load", lineno=token.lineno
817 return nodes.Getitem(node, arg, "load", lineno=token.lineno)
818 if token.type == "lbracket":
828 arg = nodes.Tuple(args, "load", lineno=token.lineno)
829 return nodes.Getitem(node, arg, "load", lineno=token.lineno)
830 self.fail("expected subscript expression", token.lineno)
865 token = self.stream.expect("lparen")
874 self.fail("invalid syntax for function call expression", token.lineno)
916 token = self.stream.current
918 return nodes.Call(node, args, kwargs, dyn_args, dyn_kwargs, lineno=token.lineno)
926 token = self.stream.expect("name")
927 name = token.value
938 node, name, args, kwargs, dyn_args, dyn_kwargs, lineno=token.lineno
944 token = next(self.stream)
975 node, name, args, kwargs, dyn_args, dyn_kwargs, lineno=token.lineno
978 node = nodes.Not(node, lineno=token.lineno)
999 token = self.stream.current
1000 if token.type == "data":
1001 if token.value:
1002 add_data(nodes.TemplateData(token.value, lineno=token.lineno))
1004 elif token.type == "variable_begin":
1008 elif token.type == "block_begin":