MCPcopy Index your code
hub / github.com/nodejs/node / expect

Method expect

tools/inspector_protocol/jinja2/lexer.py:370–388  ·  view source on GitHub ↗

Expect a given token type and return it. This accepts the same argument as :meth:`jinja2.lexer.Token.test`.

(self, expr)

Source from the content-addressed store, hash-verified

368 self.closed = True
369
370 def expect(self, expr):
371 """Expect a given token type and return it. This accepts the same
372 argument as :meth:`jinja2.lexer.Token.test`.
373 """
374 if not self.current.test(expr):
375 expr = describe_token_expr(expr)
376 if self.current.type is TOKEN_EOF:
377 raise TemplateSyntaxError('unexpected end of template, '
378 'expected %r.' % expr,
379 self.current.lineno,
380 self.name, self.filename)
381 raise TemplateSyntaxError("expected token %r, got %r" %
382 (expr, describe_token(self.current)),
383 self.current.lineno,
384 self.name, self.filename)
385 try:
386 return self.current
387 finally:
388 next(self)
389
390
391def get_lexer(environment):

Callers 15

parseMethod · 0.45
_parse_blockMethod · 0.45
parse_statementsMethod · 0.45
parse_forMethod · 0.45
parse_ifMethod · 0.45
parse_withMethod · 0.45
parse_blockMethod · 0.45
parse_importMethod · 0.45
parse_fromMethod · 0.45
parse_signatureMethod · 0.45
parse_printMethod · 0.45
parse_assign_targetMethod · 0.45

Calls 5

TemplateSyntaxErrorClass · 0.90
describe_token_exprFunction · 0.70
describe_tokenFunction · 0.70
nextFunction · 0.50
testMethod · 0.45

Tested by

no test coverage detected