package documentation

Pygments lexers.

Unknown Field: copyright
Copyright 2006-2021 by the Pygments team, see AUTHORS.
Unknown Field: license
BSD, see LICENSE for details.
Module actionscript pygments.lexers.actionscript ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module algebra pygments.lexers.algebra ~~~~~~~~~~~~~~~~~~~~~~~
Module ambient pygments.lexers.ambient ~~~~~~~~~~~~~~~~~~~~~~~
Module amdgpu pygments.lexers.amdgpu ~~~~~~~~~~~~~~~~~~~~~~
Module ampl pygments.lexers.ampl ~~~~~~~~~~~~~~~~~~~~
Module apdlexer pygments.lexers.apdlexer ~~~~~~~~~~~~~~~~~~~~~~~~
Module apl pygments.lexers.apl ~~~~~~~~~~~~~~~~~~~
Module archetype pygments.lexers.archetype ~~~~~~~~~~~~~~~~~~~~~~~~~
Module arrow pygments.lexers.arrow ~~~~~~~~~~~~~~~~~~~~~
Module asc pygments.lexers.asc ~~~~~~~~~~~~~~~~~~~
Module asm pygments.lexers.asm ~~~~~~~~~~~~~~~~~~~
Module automation pygments.lexers.automation ~~~~~~~~~~~~~~~~~~~~~~~~~~
Module bare pygments.lexers.bare ~~~~~~~~~~~~~~~~~~~~
Module basic pygments.lexers.basic ~~~~~~~~~~~~~~~~~~~~~
Module bdd pygments.lexers.bdd ~~~~~~~~~~~~~~~~~~~
Module bibtex pygments.lexers.bibtex ~~~~~~~~~~~~~~~~~~~~~~
Module boa pygments.lexers.boa ~~~~~~~~~~~~~~~~~~~
Module business pygments.lexers.business ~~~~~~~~~~~~~~~~~~~~~~~~
Module c​_cpp pygments.lexers.c_cpp ~~~~~~~~~~~~~~~~~~~~~
Module c​_like pygments.lexers.c_like ~~~~~~~~~~~~~~~~~~~~~~
Module capnproto pygments.lexers.capnproto ~~~~~~~~~~~~~~~~~~~~~~~~~
Module cddl pygments.lexers.cddl ~~~~~~~~~~~~~~~~~~~~
Module chapel pygments.lexers.chapel ~~~~~~~~~~~~~~~~~~~~~~
Module clean pygments.lexers.clean ~~~~~~~~~~~~~~~~~~~~~
Module configs pygments.lexers.configs ~~~~~~~~~~~~~~~~~~~~~~~
Module console pygments.lexers.console ~~~~~~~~~~~~~~~~~~~~~~~
Module crystal pygments.lexers.crystal ~~~~~~~~~~~~~~~~~~~~~~~
Module csound pygments.lexers.csound ~~~~~~~~~~~~~~~~~~~~~~
Module css pygments.lexers.css ~~~~~~~~~~~~~~~~~~~
Module d pygments.lexers.d ~~~~~~~~~~~~~~~~~
Module dalvik pygments.lexers.dalvik ~~~~~~~~~~~~~~~~~~~~~~
Module data pygments.lexers.data ~~~~~~~~~~~~~~~~~~~~
Module devicetree pygments.lexers.devicetree ~~~~~~~~~~~~~~~~~~~~~~~~~~
Module diff pygments.lexers.diff ~~~~~~~~~~~~~~~~~~~~
Module dotnet pygments.lexers.dotnet ~~~~~~~~~~~~~~~~~~~~~~
Module dsls pygments.lexers.dsls ~~~~~~~~~~~~~~~~~~~~
Module dylan pygments.lexers.dylan ~~~~~~~~~~~~~~~~~~~~~
Module ecl pygments.lexers.ecl ~~~~~~~~~~~~~~~~~~~
Module eiffel pygments.lexers.eiffel ~~~~~~~~~~~~~~~~~~~~~~
Module elm pygments.lexers.elm ~~~~~~~~~~~~~~~~~~~
Module elpi pygments.lexers.elpi ~~~~~~~~~~~~~~~~~~~~
Module email pygments.lexers.email ~~~~~~~~~~~~~~~~~~~~~
Module erlang pygments.lexers.erlang ~~~~~~~~~~~~~~~~~~~~~~
Module esoteric pygments.lexers.esoteric ~~~~~~~~~~~~~~~~~~~~~~~~
Module ezhil pygments.lexers.ezhil ~~~~~~~~~~~~~~~~~~~~~
Module factor pygments.lexers.factor ~~~~~~~~~~~~~~~~~~~~~~
Module fantom pygments.lexers.fantom ~~~~~~~~~~~~~~~~~~~~~~
Module felix pygments.lexers.felix ~~~~~~~~~~~~~~~~~~~~~
Module floscript pygments.lexers.floscript ~~~~~~~~~~~~~~~~~~~~~~~~~
Module forth pygments.lexers.forth ~~~~~~~~~~~~~~~~~~~~~
Module fortran pygments.lexers.fortran ~~~~~~~~~~~~~~~~~~~~~~~
Module foxpro pygments.lexers.foxpro ~~~~~~~~~~~~~~~~~~~~~~
Module freefem pygments.lexers.freefem ~~~~~~~~~~~~~~~~~~~~~~~
Module futhark pygments.lexers.futhark ~~~~~~~~~~~~~~~~~~~~~~~
Module gcodelexer pygments.lexers.gcodelexer ~~~~~~~~~~~~~~~~~~~~~~~~~~
Module gdscript pygments.lexers.gdscript ~~~~~~~~~~~~~~~~~~~~~~~~
Module go pygments.lexers.go ~~~~~~~~~~~~~~~~~~
Module grammar​_notation pygments.lexers.grammar_notation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module graph pygments.lexers.graph ~~~~~~~~~~~~~~~~~~~~~
Module graphics pygments.lexers.graphics ~~~~~~~~~~~~~~~~~~~~~~~~
Module graphviz pygments.lexers.graphviz ~~~~~~~~~~~~~~~~~~~~~~~~
Module gsql pygments.lexers.gsql ~~~~~~~~~~~~~~~~~~~~
Module haskell pygments.lexers.haskell ~~~~~~~~~~~~~~~~~~~~~~~
Module haxe pygments.lexers.haxe ~~~~~~~~~~~~~~~~~~~~
Module hdl pygments.lexers.hdl ~~~~~~~~~~~~~~~~~~~
Module hexdump pygments.lexers.hexdump ~~~~~~~~~~~~~~~~~~~~~~~
Module html pygments.lexers.html ~~~~~~~~~~~~~~~~~~~~
Module idl pygments.lexers.idl ~~~~~~~~~~~~~~~~~~~
Module igor pygments.lexers.igor ~~~~~~~~~~~~~~~~~~~~
Module inferno pygments.lexers.inferno ~~~~~~~~~~~~~~~~~~~~~~~
Module installers pygments.lexers.installers ~~~~~~~~~~~~~~~~~~~~~~~~~~
Module int​_fiction pygments.lexers.int_fiction ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module iolang pygments.lexers.iolang ~~~~~~~~~~~~~~~~~~~~~~
Module j pygments.lexers.j ~~~~~~~~~~~~~~~~~
Module javascript pygments.lexers.javascript ~~~~~~~~~~~~~~~~~~~~~~~~~~
Module jslt pygments.lexers.jslt ~~~~~~~~~~~~~~~~~~~~
Module julia pygments.lexers.julia ~~~~~~~~~~~~~~~~~~~~~
Module jvm pygments.lexers.jvm ~~~~~~~~~~~~~~~~~~~
Module kuin pygments.lexers.kuin ~~~~~~~~~~~~~~~~~~~~
Module lilypond pygments.lexers.lilypond ~~~~~~~~~~~~~~~~~~~~~~~~
Module lisp pygments.lexers.lisp ~~~~~~~~~~~~~~~~~~~~
Module make pygments.lexers.make ~~~~~~~~~~~~~~~~~~~~
Module markup pygments.lexers.markup ~~~~~~~~~~~~~~~~~~~~~~
Module matlab pygments.lexers.matlab ~~~~~~~~~~~~~~~~~~~~~~
Module maxima pygments.lexers.maxima ~~~~~~~~~~~~~~~~~~~~~~
Module meson pygments.lexers.meson ~~~~~~~~~~~~~~~~~~~~~
Module mime pygments.lexers.mime ~~~~~~~~~~~~~~~~~~~~
Module ml pygments.lexers.ml ~~~~~~~~~~~~~~~~~~
Module modeling pygments.lexers.modeling ~~~~~~~~~~~~~~~~~~~~~~~~
Module modula2 pygments.lexers.modula2 ~~~~~~~~~~~~~~~~~~~~~~~
Module monte pygments.lexers.monte ~~~~~~~~~~~~~~~~~~~~~
Module mosel pygments.lexers.mosel ~~~~~~~~~~~~~~~~~~~~~
Module ncl pygments.lexers.ncl ~~~~~~~~~~~~~~~~~~~
Module nimrod pygments.lexers.nimrod ~~~~~~~~~~~~~~~~~~~~~~
Module nit pygments.lexers.nit ~~~~~~~~~~~~~~~~~~~
Module nix pygments.lexers.nix ~~~~~~~~~~~~~~~~~~~
Module oberon pygments.lexers.oberon ~~~~~~~~~~~~~~~~~~~~~~
Module objective pygments.lexers.objective ~~~~~~~~~~~~~~~~~~~~~~~~~
Module ooc pygments.lexers.ooc ~~~~~~~~~~~~~~~~~~~
Module parasail pygments.lexers.parasail ~~~~~~~~~~~~~~~~~~~~~~~~
Module parsers pygments.lexers.parsers ~~~~~~~~~~~~~~~~~~~~~~~
Module pascal pygments.lexers.pascal ~~~~~~~~~~~~~~~~~~~~~~
Module pawn pygments.lexers.pawn ~~~~~~~~~~~~~~~~~~~~
Module perl pygments.lexers.perl ~~~~~~~~~~~~~~~~~~~~
Module php pygments.lexers.php ~~~~~~~~~~~~~~~~~~~
Module pointless pygments.lexers.pointless ~~~~~~~~~~~~~~~~~~~~~~~~~
Module pony pygments.lexers.pony ~~~~~~~~~~~~~~~~~~~~
Module praat pygments.lexers.praat ~~~~~~~~~~~~~~~~~~~~~
Module procfile pygments.lexers.procfile ~~~~~~~~~~~~~~~~~~~~~~~~
Module prolog pygments.lexers.prolog ~~~~~~~~~~~~~~~~~~~~~~
Module promql pygments.lexers.promql ~~~~~~~~~~~~~~~~~~~~~~
Module python pygments.lexers.python ~~~~~~~~~~~~~~~~~~~~~~
Module qvt pygments.lexers.qvt ~~~~~~~~~~~~~~~~~~~
Module r pygments.lexers.r ~~~~~~~~~~~~~~~~~
Module rdf pygments.lexers.rdf ~~~~~~~~~~~~~~~~~~~
Module rebol pygments.lexers.rebol ~~~~~~~~~~~~~~~~~~~~~
Module resource pygments.lexers.resource ~~~~~~~~~~~~~~~~~~~~~~~~
Module ride pygments.lexers.ride ~~~~~~~~~~~~~~~~~~~~
Module rita pygments.lexers.rita ~~~~~~~~~~~~~~~~~~~~
Module rnc pygments.lexers.rnc ~~~~~~~~~~~~~~~~~~~
Module roboconf pygments.lexers.roboconf ~~~~~~~~~~~~~~~~~~~~~~~~
Module robotframework pygments.lexers.robotframework ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ruby pygments.lexers.ruby ~~~~~~~~~~~~~~~~~~~~
Module rust pygments.lexers.rust ~~~~~~~~~~~~~~~~~~~~
Module sas pygments.lexers.sas ~~~~~~~~~~~~~~~~~~~
Module savi pygments.lexers.savi ~~~~~~~~~~~~~~~~~~~~
Module scdoc pygments.lexers.scdoc ~~~~~~~~~~~~~~~~~~~~~
Module scripting pygments.lexers.scripting ~~~~~~~~~~~~~~~~~~~~~~~~~
Module sgf pygments.lexers.sgf ~~~~~~~~~~~~~~~~~~~
Module shell pygments.lexers.shell ~~~~~~~~~~~~~~~~~~~~~
Module sieve pygments.lexers.sieve ~~~~~~~~~~~~~~~~~~~~~
Module slash pygments.lexers.slash ~~~~~~~~~~~~~~~~~~~~~
Module smalltalk pygments.lexers.smalltalk ~~~~~~~~~~~~~~~~~~~~~~~~~
Module smithy pygments.lexers.smithy ~~~~~~~~~~~~~~~~~~~~~~
Module smv pygments.lexers.smv ~~~~~~~~~~~~~~~~~~~
Module snobol pygments.lexers.snobol ~~~~~~~~~~~~~~~~~~~~~~
Module solidity pygments.lexers.solidity ~~~~~~~~~~~~~~~~~~~~~~~~
Module sophia pygments.lexers.sophia ~~~~~~~~~~~~~~~~~~~~~~
Module special pygments.lexers.special ~~~~~~~~~~~~~~~~~~~~~~~
Module spice pygments.lexers.spice ~~~~~~~~~~~~~~~~~~~~~
Module sql pygments.lexers.sql ~~~~~~~~~~~~~~~~~~~
Module srcinfo pygments.lexers.srcinfo ~~~~~~~~~~~~~~~~~~~~~~~
Module stata pygments.lexers.stata ~~~~~~~~~~~~~~~~~~~~~
Module supercollider pygments.lexers.supercollider ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module tcl pygments.lexers.tcl ~~~~~~~~~~~~~~~~~~~
Module teal pygments.lexers.teal ~~~~~~~~~~~~~~~~~~~~
Module templates pygments.lexers.templates ~~~~~~~~~~~~~~~~~~~~~~~~~
Module teraterm pygments.lexers.teraterm ~~~~~~~~~~~~~~~~~~~~~~~~
Module testing pygments.lexers.testing ~~~~~~~~~~~~~~~~~~~~~~~
Module textedit pygments.lexers.textedit ~~~~~~~~~~~~~~~~~~~~~~~~
Module textfmts pygments.lexers.textfmts ~~~~~~~~~~~~~~~~~~~~~~~~
Module theorem pygments.lexers.theorem ~~~~~~~~~~~~~~~~~~~~~~~
Module thingsdb pygments.lexers.thingsdb ~~~~~~~~~~~~~~~~~~~~~~~~
Module tnt pygments.lexers.tnt ~~~~~~~~~~~~~~~~~~~
Module trafficscript pygments.lexers.trafficscript ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module typoscript pygments.lexers.typoscript ~~~~~~~~~~~~~~~~~~~~~~~~~~
Module unicon pygments.lexers.unicon ~~~~~~~~~~~~~~~~~~~~~~
Module urbi pygments.lexers.urbi ~~~~~~~~~~~~~~~~~~~~
Module usd pygments.lexers.usd ~~~~~~~~~~~~~~~~~~~
Module varnish pygments.lexers.varnish ~~~~~~~~~~~~~~~~~~~~~~~
Module verification pygments.lexers.verification ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module webassembly pygments.lexers.webassembly ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module webidl pygments.lexers.webidl ~~~~~~~~~~~~~~~~~~~~~~
Module webmisc pygments.lexers.webmisc ~~~~~~~~~~~~~~~~~~~~~~~
Module whiley pygments.lexers.whiley ~~~~~~~~~~~~~~~~~~~~~~
Module x10 pygments.lexers.x10 ~~~~~~~~~~~~~~~~~~~
Module xorg pygments.lexers.xorg ~~~~~~~~~~~~~~~~~~~~
Module yang pygments.lexers.yang ~~~~~~~~~~~~~~~~~~~~
Module zig pygments.lexers.zig ~~~~~~~~~~~~~~~~~~~
Module ​_asy​_builtins pygments.lexers._asy_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_cl​_builtins pygments.lexers._cl_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_cocoa​_builtins pygments.lexers._cocoa_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_csound​_builtins pygments.lexers._csound_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_julia​_builtins pygments.lexers._julia_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_lasso​_builtins pygments.lexers._lasso_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_lilypond​_builtins pygments.lexers._lilypond_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_lua​_builtins pygments.lexers._lua_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_mapping pygments.lexers._mapping ~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_mql​_builtins pygments.lexers._mql_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_mysql​_builtins pygments.lexers._mysql_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_openedge​_builtins pygments.lexers._openedge_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_php​_builtins pygments.lexers._php_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_postgres​_builtins pygments.lexers._postgres_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_scilab​_builtins pygments.lexers._scilab_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_sourcemod​_builtins pygments.lexers._sourcemod_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_stan​_builtins pygments.lexers._stan_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_stata​_builtins pygments.lexers._stata_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_tsql​_builtins pygments.lexers._tsql_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_usd​_builtins pygments.lexers._usd_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_vbscript​_builtins pygments.lexers._vbscript_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module ​_vim​_builtins pygments.lexers._vim_builtins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module agile pygments.lexers.agile ~~~~~~~~~~~~~~~~~~~~~
Module compiled pygments.lexers.compiled ~~~~~~~~~~~~~~~~~~~~~~~~
Module functional pygments.lexers.functional ~~~~~~~~~~~~~~~~~~~~~~~~~~
Module math pygments.lexers.math ~~~~~~~~~~~~~~~~~~~~
Module other pygments.lexers.other ~~~~~~~~~~~~~~~~~~~~~
Module text pygments.lexers.text ~~~~~~~~~~~~~~~~~~~~
Module web pygments.lexers.web ~~~~~~~~~~~~~~~~~~~

From __init__.py:

Function find​_lexer​_class Lookup a lexer class by name.
Function find​_lexer​_class​_by​_name Lookup a lexer class by alias.
Function get​_all​_lexers Return a generator of tuples in the form (name, aliases, filenames, mimetypes) of all know lexers.
Function get​_lexer​_by​_name Get a lexer by an alias.
Function get​_lexer​_for​_filename Get a lexer for a filename.
Function get​_lexer​_for​_mimetype Get a lexer for a mimetype.
Function guess​_lexer Guess a lexer by strong distinctions in the text (eg, shebang).
Function guess​_lexer​_for​_filename Lookup all lexers that handle those filenames primary (filenames) or secondary (alias_filenames). Then run a text analysis for those lexers and choose the best result.
Function load​_lexer​_from​_file Load a lexer from a file.
Constant COMPAT Undocumented
Variable newmod Undocumented
Variable oldmod Undocumented
Class ​_automodule Automatically import lexers.
Function ​_fn​_matches Return whether the supplied file name fn matches pattern filename.
Function ​_iter​_lexerclasses Return an iterator over all lexer classes.
Function ​_load​_lexers Load a lexer (and all others in the module too).
Function find​_lexer​_class​_for​_filename Get a lexer for a filename.
Variable ​_lexer​_cache Undocumented
Variable ​_pattern​_cache Undocumented
COMPAT: dict[str, str] =

Undocumented

Value
{'Python3Lexer': 'PythonLexer', 'Python3TracebackLexer': 'PythonTracebackLexer'}
_lexer_cache: dict =

Undocumented

_pattern_cache: dict =

Undocumented

def _fn_matches(fn, glob):
Return whether the supplied file name fn matches pattern filename.
def _load_lexers(module_name):
Load a lexer (and all others in the module too).
def get_all_lexers():
Return a generator of tuples in the form (name, aliases, filenames, mimetypes) of all know lexers.
def find_lexer_class(name):

Lookup a lexer class by name.

Return None if not found.

def find_lexer_class_by_name(_alias):

Lookup a lexer class by alias.

Like get_lexer_by_name, but does not instantiate the class.

New in version 2.2.
def get_lexer_by_name(_alias, **options):

Get a lexer by an alias.

Raises ClassNotFound if not found.

def load_lexer_from_file(filename, lexername='CustomLexer', **options):

Load a lexer from a file.

This method expects a file located relative to the current working directory, which contains a Lexer class. By default, it expects the Lexer to be name CustomLexer; you can specify your own class name as the second argument to this function.

Users should be very careful with the input, because this method is equivalent to running eval on the input file.

Raises ClassNotFound if there are any problems importing the Lexer.

New in version 2.2.
def find_lexer_class_for_filename(_fn, code=None):

Get a lexer for a filename.

If multiple lexers match the filename pattern, use analyse_text() to figure out which one is more appropriate.

Returns None if not found.

def get_lexer_for_filename(_fn, code=None, **options):

Get a lexer for a filename.

If multiple lexers match the filename pattern, use analyse_text() to figure out which one is more appropriate.

Raises ClassNotFound if not found.

def get_lexer_for_mimetype(_mime, **options):

Get a lexer for a mimetype.

Raises ClassNotFound if not found.

def _iter_lexerclasses(plugins=True):
Return an iterator over all lexer classes.
def guess_lexer_for_filename(_fn, _text, **options):

Lookup all lexers that handle those filenames primary (filenames) or secondary (alias_filenames). Then run a text analysis for those lexers and choose the best result.

usage:

>>> from pygments.lexers import guess_lexer_for_filename
>>> guess_lexer_for_filename('hello.html', '<%= @foo %>')
<pygments.lexers.templates.RhtmlLexer object at 0xb7d2f32c>
>>> guess_lexer_for_filename('hello.html', '<h1>{{ title|e }}</h1>')
<pygments.lexers.templates.HtmlDjangoLexer object at 0xb7d2f2ac>
>>> guess_lexer_for_filename('style.css', 'a { color: <?= $link ?> }')
<pygments.lexers.templates.CssPhpLexer object at 0xb7ba518c>
def guess_lexer(_text, **options):
Guess a lexer by strong distinctions in the text (eg, shebang).
oldmod =

Undocumented

newmod =

Undocumented