Lines Matching refs:token

123         token = self.stream.current
124 if token.type != 'name':
125 self.fail('tag name expected', token.lineno)
126 self._tag_stack.append(token.value)
129 if token.value in _statement_keywords:
131 if token.value == 'call':
133 if token.value == 'filter':
135 ext = self.extensions.get(token.value)
139 # did not work out, remove the token we pushed by accident
144 self.fail_unknown_tag(token.value, token.lineno)
153 current token is a colon and skips it if there is one. Then it checks
155 reached. Per default the active token in the stream at the end of
156 the call is the matched end token. If this is not wanted `drop_needle`
157 can be set to `True` and the end token is removed.
159 # the first token may be a colon for python compatibility
163 # by adding some sort of end of statement token and parsing those here.
216 token = next(self.stream)
217 if token.test('name:elif'):
221 elif token.test('name:else'):
407 token = self.stream.expect('name')
410 target = nodes.NSRef(token.value, attr.value, lineno=token.lineno)
412 token = self.stream.expect('name')
413 target = nodes.Name(token.value, 'store', lineno=token.lineno)
553 token = self.stream.current
554 if token.type == 'name':
555 if token.value in ('true', 'false', 'True', 'False'):
556 node = nodes.Const(token.value in ('true', 'True'),
557 lineno=token.lineno)
558 elif token.value in ('none', 'None'):
559 node = nodes.Const(None, lineno=token.lineno)
561 node = nodes.Name(token.value, 'load', lineno=token.lineno)
563 elif token.type == 'string':
565 buf = [token.value]
566 lineno = token.lineno
571 elif token.type in ('integer', 'float'):
573 node = nodes.Const(token.value, lineno=token.lineno)
574 elif token.type == 'lparen':
578 elif token.type == 'lbracket':
580 elif token.type == 'lbrace':
583 self.fail("unexpected '%s'" % describe_token(token), token.lineno)
642 token = self.stream.expect('lbracket')
651 return nodes.List(items, lineno=token.lineno)
654 token = self.stream.expect('lbrace')
666 return nodes.Dict(items, lineno=token.lineno)
697 token = next(self.stream)
698 if token.type == 'dot':
703 lineno=token.lineno)
707 return nodes.Getitem(node, arg, 'load', lineno=token.lineno)
708 if token.type == 'lbracket':
718 arg = nodes.Tuple(args, 'load', lineno=token.lineno)
719 return nodes.Getitem(node, arg, 'load', lineno=token.lineno)
754 token = self.stream.expect('lparen')
763 token.lineno)
798 lineno=token.lineno)
804 token = self.stream.expect('name')
805 name = token.value
816 dyn_kwargs, lineno=token.lineno)
821 token = next(self.stream)
846 dyn_kwargs, lineno=token.lineno)
848 node = nodes.Not(node, lineno=token.lineno)
867 token = self.stream.current
868 if token.type == 'data':
869 if token.value:
870 add_data(nodes.TemplateData(token.value,
871 lineno=token.lineno))
873 elif token.type == 'variable_begin':
877 elif token.type == 'block_begin':