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

Method lex

tools/inspector_protocol/jinja2/environment.py:499–514  ·  view source on GitHub ↗

Lex the given sourcecode and return a generator that yields tokens as tuples in the form ``(lineno, token_type, value)``. This can be useful for :ref:`extension development ` and debugging templates. This does not perform preprocessing. If you wa

(self, source, name=None, filename=None)

Source from the content-addressed store, hash-verified

497 return Parser(self, source, name, encode_filename(filename)).parse()
498
499 def lex(self, source, name=None, filename=None):
500 """Lex the given sourcecode and return a generator that yields
501 tokens as tuples in the form ``(lineno, token_type, value)``.
502 This can be useful for :ref:`extension development <writing-extensions>`
503 and debugging templates.
504
505 This does not perform preprocessing. If you want the preprocessing
506 of the extensions to be applied you have to filter source through
507 the :meth:`preprocess` method.
508 """
509 source = text_type(source)
510 try:
511 return self.lexer.tokeniter(source, name, filename)
512 except TemplateSyntaxError:
513 exc_info = sys.exc_info()
514 self.handle_exception(exc_info, source_hint=source)
515
516 def preprocess(self, source, name=None, filename=None):
517 """Preprocesses the source with all extensions. This is automatically

Callers 3

babel_extractFunction · 0.95
marked.jsFile · 0.45
markedFunction · 0.45

Calls 3

handle_exceptionMethod · 0.95
exc_infoMethod · 0.80
tokeniterMethod · 0.45

Tested by

no test coverage detected