pygments.lexers

Pygments lexers.

copyright:Copyright 2006-2013 by the Pygments team, see AUTHORS.
license:BSD, see LICENSE for details.
pygments.lexers.get_lexer_by_name(_alias, **options)[source]

Get a lexer by an alias.

pygments.lexers.get_lexer_for_filename(_fn, code=None, **options)[source]

Get a lexer for a filename. If multiple lexers match the filename pattern, use analyze_text() to figure out which one is more appropriate.

pygments.lexers.find_lexer_class(name)[source]

Lookup a lexer class by name. Return None if not found.

pygments.lexers.guess_lexer(_text, **options)[source]

Guess a lexer by strong distinctions in the text (eg, shebang).

class pygments.lexers.SourcesListLexer(**options)

Lexer that highlights debian sources.list files.

New in Pygments 0.7.

class pygments.lexers.DelphiLexer(**options)

For Delphi (Borland Object Pascal), Turbo Pascal and Free Pascal source code.

Additional options accepted:

turbopascal
Highlight Turbo Pascal specific keywords (default: True).
delphi
Highlight Borland Delphi specific keywords (default: True).
freepascal
Highlight Free Pascal specific keywords (default: True).
units
A list of units that should be considered builtin, supported are System, SysUtils, Classes and Math. Default is to consider all of them builtin.
class pygments.lexers.MakoJavascriptLexer(**options)

Subclass of the MakoLexer that highlights unlexer data with the JavascriptLexer.

New in Pygments 0.7.

class pygments.lexers.ElixirConsoleLexer(**options)

For Elixir interactive console (iex) output like:

iex> [head | tail] = [1,2,3]
[1,2,3]
iex> head
1
iex> tail
[2,3]
iex> [head | tail]
[1,2,3]
iex> length [head | tail]
3

New in Pygments 1.5.

class pygments.lexers.PostgresConsoleLexer(**options)

Lexer for psql sessions.

New in Pygments 1.5.

class pygments.lexers.BrainfuckLexer(**options)

Lexer for the esoteric BrainFuck language.

class pygments.lexers.CeylonLexer(**options)

For Ceylon source code.

New in Pygments 1.6.

class pygments.lexers.JavascriptDjangoLexer(**options)

Subclass of the DjangoLexer that highlights unlexed data with the JavascriptLexer.

class pygments.lexers.EvoqueHtmlLexer(**options)

Subclass of the EvoqueLexer that highlights unlexed data with the HtmlLexer.

New in Pygments 1.1.

class pygments.lexers.NumPyLexer(**options)

A Python lexer recognizing Numerical Python builtins.

New in Pygments 0.10.

class pygments.lexers.Modula2Lexer(**options)

For Modula-2 source code.

Additional options that determine which keywords are highlighted:

pim
Select PIM Modula-2 dialect (default: True).
iso
Select ISO Modula-2 dialect (default: False).
objm2
Select Objective Modula-2 dialect (default: False).
gm2ext
Also highlight GNU extensions (default: False).

New in Pygments 1.3.

class pygments.lexers.LiveScriptLexer(**options)

For LiveScript source code.

New in Pygments 1.6.

class pygments.lexers.NimrodLexer(**options)

For Nimrod source code.

New in Pygments 1.5.

class pygments.lexers.BashLexer(**options)

Lexer for (ba|k|)sh shell scripts.

New in Pygments 0.6.

class pygments.lexers.HtmlDjangoLexer(**options)

Subclass of the DjangoLexer that highighlights unlexed data with the HtmlLexer.

Nested Javascript and CSS is highlighted too.

class pygments.lexers.CssPhpLexer(**options)

Subclass of PhpLexer which highlights unmatched data with the CssLexer.

class pygments.lexers.LassoXmlLexer(**options)

Subclass of the LassoLexer which highlights unhandled data with the XmlLexer.

New in Pygments 1.6.

class pygments.lexers.VimLexer(**options)

Lexer for VimL script files.

New in Pygments 0.8.

is_in(w, mapping)

It’s kind of difficult to decide if something might be a keyword in VimL because it allows you to abbreviate them. In fact, ‘ab[breviate]’ is a good example. :ab, :abbre, or :abbreviate are valid ways to call it so rather than making really awful regexps like:

\bab(?:b(?:r(?:e(?:v(?:i(?:a(?:t(?:e)?)?)?)?)?)?)?)?\b

we match bw+b and then call is_in() on those tokens. See scripts/get_vimkw.py for how the lists are extracted.

class pygments.lexers.CssGenshiLexer(**options)

A lexer that highlights CSS definitions in genshi text templates.

class pygments.lexers.FancyLexer(**options)

Pygments Lexer For Fancy.

Fancy is a self-hosted, pure object-oriented, dynamic, class-based, concurrent general-purpose programming language running on Rubinius, the Ruby VM.

New in Pygments 1.5.

class pygments.lexers.ColdfusionHtmlLexer(**options)

Coldfusion markup in html

class pygments.lexers.ColdfusionLexer(**options)

Coldfusion statements

class pygments.lexers.SspLexer(**options)

Lexer for Scalate Server Pages.

New in Pygments 1.4.

class pygments.lexers.SmartyLexer(**options)

Generic Smarty template lexer.

Just highlights smarty code between the preprocessor directives, other data is left untouched by the lexer.

class pygments.lexers.EvoqueXmlLexer(**options)

Subclass of the EvoqueLexer that highlights unlexed data with the XmlLexer.

New in Pygments 1.1.

class pygments.lexers.HaxeLexer(**options)

For haXe source code (http://haxe.org/).

New in Pygments 1.3.

class pygments.lexers.PowerShellLexer(**options)

For Windows PowerShell code.

New in Pygments 1.5.

class pygments.lexers.TeaTemplateLexer(**options)

Lexer for Tea Templates.

New in Pygments 1.5.

class pygments.lexers.CheetahHtmlLexer(**options)

Subclass of the CheetahLexer that highlights unlexer data with the HtmlLexer.

class pygments.lexers.RubyConsoleLexer(**options)

For Ruby interactive console (irb) output like:

irb(main):001:0> a = 1
=> 1
irb(main):002:0> puts a
1
=> nil
class pygments.lexers.MasonLexer(**options)

Generic mason templates lexer. Stolen from Myghty lexer. Code that isn’t Mason markup is HTML.

New in Pygments 1.4.

class pygments.lexers.DjangoLexer(**options)

Generic django and jinja template lexer.

It just highlights django/jinja code between the preprocessor directives, other data is left untouched by the lexer.

class pygments.lexers.JagsLexer(**options)

Pygments Lexer for JAGS.

New in Pygments 1.6.

class pygments.lexers.ApacheConfLexer(**options)

Lexer for configuration files following the Apache config file format.

New in Pygments 0.6.

class pygments.lexers.DtdLexer(**options)

A lexer for DTDs (Document Type Definitions).

New in Pygments 1.5.

class pygments.lexers.DylanConsoleLexer(**options)

For Dylan interactive console output like:

? let a = 1;
=> 1
? a
=> 1

This is based on a copy of the RubyConsoleLexer.

New in Pygments 1.6.

class pygments.lexers.LighttpdConfLexer(**options)

Lexer for Lighttpd configuration files.

New in Pygments 0.11.

class pygments.lexers.JavaLexer(**options)

For Java source code.

class pygments.lexers.JavascriptGenshiLexer(**options)

A lexer that highlights javascript code in genshi text templates.

class pygments.lexers.SchemeLexer(**options)

A Scheme lexer, parsing a stream and outputting the tokens needed to highlight scheme code. This lexer could be most probably easily subclassed to parse other LISP-Dialects like Common Lisp, Emacs Lisp or AutoLisp.

This parser is checked with pastes from the LISP pastebin at http://paste.lisp.org/ to cover as much syntax as possible.

It supports the full Scheme syntax as defined in R5RS.

New in Pygments 0.6.

class pygments.lexers.NemerleLexer(**options)

For Nemerle source code.

Additional options accepted:

unicodelevel

Determines which Unicode characters this lexer allows for identifiers. The possible values are:

  • none – only the ASCII letters and numbers are allowed. This is the fastest selection.
  • basic – all Unicode characters from the specification except category Lo are allowed.
  • full – all Unicode characters as specified in the C# specs are allowed. Note that this means a considerable slowdown since the Lo category has more than 40,000 characters in it!

The default value is basic.

New in Pygments 1.5.

class pygments.lexers.RhtmlLexer(**options)

Subclass of the ERB lexer that highlights the unlexed data with the html lexer.

Nested Javascript and CSS is highlighted too.

class pygments.lexers.RagelJavaLexer(**options)

A lexer for Ragel in a Java host file.

New in Pygments 1.1.

class pygments.lexers.DarcsPatchLexer(**options)

DarcsPatchLexer is a lexer for the various versions of the darcs patch format. Examples of this format are derived by commands such as darcs annotate --patch and darcs send.

New in Pygments 0.10.

class pygments.lexers.PuppetLexer(**options)

For Puppet configuration DSL.

New in Pygments 1.6.

class pygments.lexers.OctaveLexer(**options)

For GNU Octave source code.

New in Pygments 1.5.

class pygments.lexers.CoffeeScriptLexer(**options)

For CoffeeScript source code.

New in Pygments 1.3.

class pygments.lexers.RagelDLexer(**options)

A lexer for Ragel in a D host file.

New in Pygments 1.1.

class pygments.lexers.ScilabLexer(**options)

For Scilab source code.

New in Pygments 1.5.

class pygments.lexers.MonkeyLexer(**options)

For Monkey source code.

New in Pygments 1.6.

class pygments.lexers.MyghtyHtmlLexer(**options)

Subclass of the MyghtyLexer that highlights unlexer data with the HtmlLexer.

New in Pygments 0.6.

class pygments.lexers.ErlangShellLexer(**options)

Shell sessions in erl (for Erlang code).

New in Pygments 1.1.

class pygments.lexers.CssLexer(**options)

For CSS (Cascading Style Sheets).

class pygments.lexers.JavascriptSmartyLexer(**options)

Subclass of the SmartyLexer that highlights unlexed data with the JavascriptLexer.

class pygments.lexers.IoLexer(**options)

For Io (a small, prototype-based programming language) source.

New in Pygments 0.10.

class pygments.lexers.CobolFreeformatLexer(**options)

Lexer for Free format OpenCOBOL code.

New in Pygments 1.6.

class pygments.lexers.AsymptoteLexer(**options)

For Asymptote source code.

New in Pygments 1.2.

class pygments.lexers.VhdlLexer(**options)

For VHDL source code.

New in Pygments 1.5.

class pygments.lexers.Python3Lexer(**options)

For Python source code (version 3.0).

New in Pygments 0.10.

class pygments.lexers.CssErbLexer(**options)

Subclass of ErbLexer which highlights unlexed data with the CssLexer.

class pygments.lexers.FortranLexer(**options)

Lexer for FORTRAN 90 code.

New in Pygments 0.10.

class pygments.lexers.DObjdumpLexer(**options)

For the output of ‘objdump -Sr on compiled D files’

class pygments.lexers.MySqlLexer(**options)

Special lexer for MySQL.

class pygments.lexers.RebolLexer(**options)

A REBOL lexer.

New in Pygments 1.1.

class pygments.lexers.CppLexer(**options)

For C++ source code with preprocessor directives.

class pygments.lexers.ErbLexer(**options)

Generic ERB (Ruby Templating) lexer.

Just highlights ruby code between the preprocessor directives, other data is left untouched by the lexer.

All options are also forwarded to the RubyLexer.

get_tokens_unprocessed(text)

Since ERB doesn’t allow “<%” and other tags inside of ruby blocks we have to use a split approach here that fails for that too.

class pygments.lexers.CbmBasicV2Lexer(**options)

For CBM BASIC V2 sources.

New in Pygments 1.6.

class pygments.lexers.BefungeLexer(**options)

Lexer for the esoteric Befunge language.

New in Pygments 0.7.

class pygments.lexers.JuliaLexer(**options)

For Julia source code.

New in Pygments 1.6.

class pygments.lexers.MoonScriptLexer(**options)

For MoonScript source code.

New in Pygments 1.5.

class pygments.lexers.RubyLexer(**options)

For Ruby source code.

class pygments.lexers.XmlSmartyLexer(**options)

Subclass of the SmartyLexer that highlights unlexed data with the XmlLexer.

class pygments.lexers.DylanLexer(**options)

For the Dylan language.

New in Pygments 0.7.

class pygments.lexers.GroovyLexer(**options)

For Groovy source code.

New in Pygments 1.5.

class pygments.lexers.MoinWikiLexer(**options)

For MoinMoin (and Trac) Wiki markup.

New in Pygments 0.7.

class pygments.lexers.AutohotkeyLexer(**options)

For autohotkey source code.

New in Pygments 1.4.

class pygments.lexers.CLexer(**options)

For C source code with preprocessor directives.

class pygments.lexers.HtmlLexer(**options)

For HTML 4 and XHTML 1 markup. Nested JavaScript and CSS is highlighted by the appropriate lexer.

class pygments.lexers.FelixLexer(**options)

For Felix source code.

New in Pygments 1.2.

class pygments.lexers.CMakeLexer(**options)

Lexer for CMake files.

New in Pygments 1.2.

class pygments.lexers.NSISLexer(**options)

For NSIS scripts.

New in Pygments 1.6.

class pygments.lexers.SourcePawnLexer(**options)

For SourcePawn source code with preprocessor directives.

New in Pygments 1.6.

class pygments.lexers.MakoLexer(**options)

Generic mako templates lexer. Code that isn’t Mako markup is yielded as Token.Other.

New in Pygments 0.7.

class pygments.lexers.VGLLexer(**options)

For SampleManager VGL source code.

New in Pygments 1.6.

class pygments.lexers.VelocityLexer(**options)

Generic Velocity template lexer.

Just highlights velocity directives and variable references, other data is left untouched by the lexer.

class pygments.lexers.KokaLexer(**options)

Lexer for the Koka language.

New in Pygments 1.6.

class pygments.lexers.CudaLexer(**options)

For NVIDIA CUDA™ source.

New in Pygments 1.6.

class pygments.lexers.GnuplotLexer(**options)

For Gnuplot plotting scripts.

New in Pygments 0.11.

class pygments.lexers.IrcLogsLexer(**options)

Lexer for IRC logs in irssi, xchat or weechat style.

class pygments.lexers.PrologLexer(**options)

Lexer for Prolog files.

class pygments.lexers.PythonLexer(**options)

For Python source code.

class pygments.lexers.CssDjangoLexer(**options)

Subclass of the DjangoLexer that highlights unlexed data with the CssLexer.

class pygments.lexers.VerilogLexer(**options)

For verilog source code with preprocessor directives.

New in Pygments 1.4.

class pygments.lexers.SmalltalkLexer(**options)

For Smalltalk syntax. Contributed by Stefan Matthias Aust. Rewritten by Nils Winter.

New in Pygments 0.10.

class pygments.lexers.MyghtyJavascriptLexer(**options)

Subclass of the MyghtyLexer that highlights unlexer data with the JavascriptLexer.

New in Pygments 0.6.

class pygments.lexers.YamlLexer(**options)

Lexer for YAML, a human-friendly data serialization language.

New in Pygments 0.11.

parse_block_scalar_empty_line(indent_token_class, content_token_class)

Process an empty line in a block scalar.

parse_block_scalar_indent(token_class)

Process indentation spaces in a block scalar.

parse_plain_scalar_indent(token_class)

Process indentation spaces in a plain scalar.

reset_indent(token_class)

Reset the indentation levels.

save_indent(token_class, start=False)

Save a possible indentation level.

set_block_scalar_indent(token_class)

Set an explicit indentation level for a block scalar.

set_indent(token_class, implicit=False)

Set the previously saved indentation level.

something(token_class)

Do not produce empty tokens.

class pygments.lexers.AntlrActionScriptLexer(**options)

ANTLR with ActionScript Target

New in Pygments 1.1.

class pygments.lexers.MakoXmlLexer(**options)

Subclass of the MakoLexer that highlights unlexer data with the XmlLexer.

New in Pygments 0.7.

class pygments.lexers.XsltLexer(**options)

A lexer for XSLT.

New in Pygments 0.10.

class pygments.lexers.UrbiscriptLexer(**options)

For UrbiScript source code.

New in Pygments 1.5.

class pygments.lexers.ScamlLexer(**options)

For Scaml markup. Scaml is Haml for Scala.

New in Pygments 1.4.

class pygments.lexers.SLexer(**options)

For S, S-plus, and R source code.

New in Pygments 0.10.

class pygments.lexers.DylanLidLexer(**options)

For Dylan LID (Library Interchange Definition) files.

New in Pygments 1.6.

class pygments.lexers.MaqlLexer(**options)

Lexer for GoodData MAQL scripts.

New in Pygments 1.4.

class pygments.lexers.SqliteConsoleLexer(**options)

Lexer for example sessions using sqlite3.

New in Pygments 0.11.

class pygments.lexers.BooLexer(**options)

For Boo source code.

class pygments.lexers.OcamlLexer(**options)

For the OCaml language.

New in Pygments 0.7.

class pygments.lexers.ECLexer(**options)

For eC source code with preprocessor directives.

New in Pygments 1.5.

class pygments.lexers.ActionScriptLexer(**options)

For ActionScript source code.

New in Pygments 0.9.

class pygments.lexers.VbNetLexer(**options)

For Visual Basic.NET source code.

class pygments.lexers.SquidConfLexer(**options)

Lexer for squid configuration files.

New in Pygments 0.9.

class pygments.lexers.XQueryLexer(**options)

An XQuery lexer, parsing a stream and outputting the tokens needed to highlight xquery code.

New in Pygments 1.4.

class pygments.lexers.DLexer(**options)

For D source.

New in Pygments 1.2.

class pygments.lexers.FantomLexer(**options)

For Fantom source code.

New in Pygments 1.5.

class pygments.lexers.GettextLexer(**options)

Lexer for Gettext catalog files.

New in Pygments 0.9.

class pygments.lexers.LogosLexer(**options)

For Logos + Objective-C source code with preprocessor directives.

New in Pygments 1.6.

class pygments.lexers.JuliaConsoleLexer(**options)

For Julia console sessions. Modeled after MatlabSessionLexer.

New in Pygments 1.6.

class pygments.lexers.LassoLexer(**options)

For Lasso source code, covering both Lasso 9 syntax and LassoScript for Lasso 8.6 and earlier. For Lasso embedded in HTML, use the LassoHtmlLexer.

Additional options accepted:

builtinshighlighting
If given and True, highlight builtin tags, types, traits, and methods (default: True).
requiredelimiters
If given and True, only highlight code between delimiters as Lasso (default: False).

New in Pygments 1.6.

class pygments.lexers.ScssLexer(**options)

For SCSS stylesheets.

class pygments.lexers.BBCodeLexer(**options)

A lexer that highlights BBCode(-like) syntax.

New in Pygments 0.6.

class pygments.lexers.HamlLexer(**options)

For Haml markup.

New in Pygments 1.3.

class pygments.lexers.FoxProLexer(**options)

Lexer for Microsoft Visual FoxPro language.

FoxPro syntax allows to shorten all keywords and function names to 4 characters. Shortened forms are not recognized by this lexer.

New in Pygments 1.6.

class pygments.lexers.Python3TracebackLexer(**options)

For Python 3.0 tracebacks, with support for chained exceptions.

New in Pygments 1.0.

class pygments.lexers.MuPADLexer(**options)

A MuPAD lexer. Contributed by Christopher Creutzig <christopher@creutzig.de>.

New in Pygments 0.8.

class pygments.lexers.XmlErbLexer(**options)

Subclass of ErbLexer which highlights data outside preprocessor directives with the XmlLexer.

class pygments.lexers.DartLexer(**options)

For Dart source code.

New in Pygments 1.5.

class pygments.lexers.IDLLexer(**options)

Pygments Lexer for IDL (Interactive Data Language).

New in Pygments 1.6.

class pygments.lexers.DgLexer(**options)

Lexer for dg, a functional and object-oriented programming language running on the CPython 3 VM.

New in Pygments 1.6.

class pygments.lexers.EvoqueLexer(**options)

For files using the Evoque templating system.

New in Pygments 1.1.

class pygments.lexers.JadeLexer(**options)

For Jade markup. Jade is a variant of Scaml, see: http://scalate.fusesource.org/documentation/scaml-reference.html

New in Pygments 1.4.

class pygments.lexers.CObjdumpLexer(**options)

For the output of ‘objdump -Sr on compiled C files’

class pygments.lexers.KconfigLexer(**options)

For Linux-style Kconfig files.

New in Pygments 1.6.

class pygments.lexers.JspLexer(**options)

Lexer for Java Server Pages.

New in Pygments 0.7.

class pygments.lexers.RegeditLexer(**options)

Lexer for Windows Registry files produced by regedit.

New in Pygments 1.6.

class pygments.lexers.ABAPLexer(**options)

Lexer for ABAP, SAP’s integrated language.

New in Pygments 1.1.

class pygments.lexers.VelocityXmlLexer(**options)

Subclass of the VelocityLexer that highlights unlexer data with the XmlLexer.

class pygments.lexers.CheetahJavascriptLexer(**options)

Subclass of the CheetahLexer that highlights unlexer data with the JavascriptLexer.

class pygments.lexers.MakoHtmlLexer(**options)

Subclass of the MakoLexer that highlights unlexed data with the HtmlLexer.

New in Pygments 0.7.

class pygments.lexers.RagelRubyLexer(**options)

A lexer for Ragel in a Ruby host file.

New in Pygments 1.1.

class pygments.lexers.RobotFrameworkLexer(**options)

For Robot Framework test data.

Supports both space and pipe separated plain text formats.

New in Pygments 1.6.

class pygments.lexers.ProtoBufLexer(**options)

Lexer for Protocol Buffer definition files.

New in Pygments 1.4.

class pygments.lexers.Cfengine3Lexer(**options)

Lexer for CFEngine3 policy files.

New in Pygments 1.5.

class pygments.lexers.RagelLexer(**options)

A pure Ragel lexer. Use this for fragments of Ragel. For .rl files, use RagelEmbeddedLexer instead (or one of the language-specific subclasses).

New in Pygments 1.1.

class pygments.lexers.GLShaderLexer(**options)

GLSL (OpenGL Shader) lexer.

New in Pygments 1.1.

class pygments.lexers.CobolLexer(**options)

Lexer for OpenCOBOL code.

New in Pygments 1.6.

class pygments.lexers.TypeScriptLexer(**options)

For TypeScript source code.

New in Pygments 1.6.

class pygments.lexers.AdaLexer(**options)

For Ada source code.

New in Pygments 1.3.

class pygments.lexers.PostgresLexer(**options)

Lexer for the PostgreSQL dialect of SQL.

New in Pygments 1.5.

class pygments.lexers.XtendLexer(**options)

For Xtend source code.

New in Pygments 1.6.

class pygments.lexers.LogtalkLexer(**options)

For Logtalk source code.

New in Pygments 0.10.

class pygments.lexers.ObjdumpLexer(**options)

For the output of ‘objdump -dr’

class pygments.lexers.MakoCssLexer(**options)

Subclass of the MakoLexer that highlights unlexer data with the CssLexer.

New in Pygments 0.7.

class pygments.lexers.Ca65Lexer(**options)

For ca65 assembler sources.

New in Pygments 1.6.

class pygments.lexers.ObjectiveCppLexer(**options)

For Objective-C++ source code with preprocessor directives.

class pygments.lexers.GherkinLexer(**options)

For Gherkin <http://github.com/aslakhellesoy/gherkin/> syntax.

New in Pygments 1.2.

class pygments.lexers.HtmlPhpLexer(**options)

Subclass of PhpLexer that highlights unhandled data with the HtmlLexer.

Nested Javascript and CSS is highlighted too.

class pygments.lexers.MakefileLexer(**options)

Lexer for BSD and GNU make extensions (lenient enough to handle both in the same file even).

Rewritten in Pygments 0.10.

class pygments.lexers.PostScriptLexer(**options)

Lexer for PostScript files.

The PostScript Language Reference published by Adobe at <http://partners.adobe.com/public/developer/en/ps/PLRM.pdf> is the authority for this.

New in Pygments 1.4.

class pygments.lexers.HxmlLexer(**options)

Lexer for haXe build files.

New in Pygments 1.6.

class pygments.lexers.KotlinLexer(**options)

For Kotlin source code.

Additional options accepted:

unicodelevel

Determines which Unicode characters this lexer allows for identifiers. The possible values are:

  • none – only the ASCII letters and numbers are allowed. This is the fastest selection.
  • basic – all Unicode characters from the specification except category Lo are allowed.
  • full – all Unicode characters as specified in the C# specs are allowed. Note that this means a considerable slowdown since the Lo category has more than 40,000 characters in it!

The default value is basic.

New in Pygments 1.5.

class pygments.lexers.PlPgsqlLexer(**options)

Handle the extra syntax in Pl/pgSQL language.

New in Pygments 1.5.

class pygments.lexers.ValaLexer(**options)

For Vala source code with preprocessor directives.

New in Pygments 1.1.

class pygments.lexers.HaskellLexer(**options)

A Haskell lexer based on the lexemes defined in the Haskell 98 Report.

New in Pygments 0.8.

class pygments.lexers.BroLexer(**options)

For Bro scripts.

New in Pygments 1.5.

class pygments.lexers.LuaLexer(**options)

For Lua source code.

Additional options accepted:

func_name_highlighting
If given and True, highlight builtin function names (default: True).
disabled_modules

If given, must be a list of module names whose function names should not be highlighted. By default all modules are highlighted.

To get a list of allowed modules have a look into the _luabuiltins module:

>>> from pygments.lexers._luabuiltins import MODULES
>>> MODULES.keys()
['string', 'coroutine', 'modules', 'io', 'basic', ...]
class pygments.lexers.PovrayLexer(**options)

For Persistence of Vision Raytracer files.

New in Pygments 0.11.

class pygments.lexers.SassLexer(**options)

For Sass stylesheets.

New in Pygments 1.3.

class pygments.lexers.AntlrJavaLexer(**options)

ANTLR with Java Target

New in Pygments 1.1

class pygments.lexers.TclLexer(**options)

For Tcl source code.

New in Pygments 0.10.

class pygments.lexers.AntlrObjectiveCLexer(**options)

ANTLR with Objective-C Target

New in Pygments 1.1.

class pygments.lexers.JavascriptErbLexer(**options)

Subclass of ErbLexer which highlights unlexed data with the JavascriptLexer.

class pygments.lexers.RacketLexer(**options)

Lexer for Racket source code (formerly known as PLT Scheme).

New in Pygments 1.6.

class pygments.lexers.AspectJLexer(**options)

For AspectJ source code.

New in Pygments 1.6.

class pygments.lexers.BaseMakefileLexer(**options)

Lexer for simple Makefiles (no preprocessing).

New in Pygments 0.10.

class pygments.lexers.AntlrPythonLexer(**options)

ANTLR with Python Target

New in Pygments 1.1.

class pygments.lexers.CppObjdumpLexer(**options)

For the output of ‘objdump -Sr on compiled C++ files’

class pygments.lexers.GenshiTextLexer(**options)

A lexer that highlights genshi text templates.

class pygments.lexers.IokeLexer(**options)

For Ioke (a strongly typed, dynamic, prototype based programming language) source.

New in Pygments 1.4.

class pygments.lexers.PyPyLogLexer(**options)

Lexer for PyPy log files.

New in Pygments 1.5.

class pygments.lexers.CrocLexer(**options)

For Croc source.

class pygments.lexers.ObjectiveJLexer(**options)

For Objective-J source code with preprocessor directives.

New in Pygments 1.3.

class pygments.lexers.GasLexer(**options)

For Gas (AT&T) assembly code.

class pygments.lexers.BatchLexer(**options)

Lexer for the DOS/Windows Batch file format.

New in Pygments 0.7.

class pygments.lexers.SnobolLexer(**options)

Lexer for the SNOBOL4 programming language.

Recognizes the common ASCII equivalents of the original SNOBOL4 operators. Does not require spaces around binary operators.

New in Pygments 1.5.

class pygments.lexers.PythonConsoleLexer(**options)

For Python console output or doctests, such as:

>>> a = 'foo'
>>> print a
foo
>>> 1 / 0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero

Additional options:

python3
Use Python 3 lexer for code. Default is False. New in Pygments 1.0.
class pygments.lexers.XmlLexer(**options)

Generic lexer for XML (eXtensible Markup Language).

class pygments.lexers.AntlrLexer(**options)

Generic ANTLR Lexer. Should not be called directly, instead use DelegatingLexer for your target language.

New in Pygments 1.1.

class pygments.lexers.OpaLexer(**options)

Lexer for the Opa language (http://opalang.org).

New in Pygments 1.5.

class pygments.lexers.CheetahXmlLexer(**options)

Subclass of the CheetahLexer that highlights unlexer data with the XmlLexer.

class pygments.lexers.GoLexer(**options)

For Go source.

class pygments.lexers.DiffLexer(**options)

Lexer for unified or context-style diffs or patches.

class pygments.lexers.MiniDLexer(**options)

For MiniD source. MiniD is now known as Croc.

class pygments.lexers.CythonLexer(**options)

For Pyrex and Cython source code.

New in Pygments 1.1.

class pygments.lexers.RagelCLexer(**options)

A lexer for Ragel in a C host file.

New in Pygments 1.1.

class pygments.lexers.ErlangLexer(**options)

For the Erlang functional programming language.

Blame Jeremy Thurgood (http://jerith.za.net/).

New in Pygments 0.9.

class pygments.lexers.DebianControlLexer(**options)

Lexer for Debian control files and apt-cache show <pkg> outputs.

New in Pygments 0.9.

class pygments.lexers.VbNetAspxLexer(**options)

Lexer for highligting Visual Basic.net within ASP.NET pages.

class pygments.lexers.BugsLexer(**options)

Pygments Lexer for OpenBugs and WinBugs models.

New in Pygments 1.6.

class pygments.lexers.RagelCppLexer(**options)

A lexer for Ragel in a CPP host file.

New in Pygments 1.1.

class pygments.lexers.CSharpAspxLexer(**options)

Lexer for highligting C# within ASP.NET pages.

class pygments.lexers.MatlabSessionLexer(**options)

For Matlab sessions. Modeled after PythonConsoleLexer. Contributed by Ken Schutte <kschutte@csail.mit.edu>.

New in Pygments 0.10.

class pygments.lexers.PropertiesLexer(**options)

Lexer for configuration files in Java’s properties format.

New in Pygments 1.4.

class pygments.lexers.GroffLexer(**options)

Lexer for the (g)roff typesetting language, supporting groff extensions. Mainly useful for highlighting manpage sources.

New in Pygments 0.6.

class pygments.lexers.ClojureLexer(**options)

Lexer for Clojure source code.

New in Pygments 0.11.

class pygments.lexers.ModelicaLexer(**options)

For Modelica source code.

New in Pygments 1.1.

class pygments.lexers.QmlLexer(**options)

For QML files. See http://doc.qt.digia.com/4.7/qdeclarativeintroduction.html.

New in Pygments 1.6.

class pygments.lexers.LassoJavascriptLexer(**options)

Subclass of the LassoLexer which highlights unhandled data with the JavascriptLexer.

New in Pygments 1.6.

class pygments.lexers.AntlrPerlLexer(**options)

ANTLR with Perl Target

New in Pygments 1.1.

class pygments.lexers.GenshiLexer(**options)

A lexer that highlights genshi and kid kid XML templates.

class pygments.lexers.BlitzMaxLexer(**options)

For BlitzMax source code.

New in Pygments 1.4.

class pygments.lexers.TreetopLexer(**options)

A lexer for Treetop grammars.

New in Pygments 1.6.

class pygments.lexers.MatlabLexer(**options)

For Matlab source code.

New in Pygments 0.10.

class pygments.lexers.MyghtyLexer(**options)

Generic myghty templates lexer. Code that isn’t Myghty markup is yielded as Token.Other.

New in Pygments 0.6.

class pygments.lexers.HtmlGenshiLexer(**options)

A lexer that highlights genshi and kid kid HTML templates.

class pygments.lexers.DuelLexer(**options)

Lexer for Duel Views Engine (formerly JBST) markup with JavaScript code blocks. See http://duelengine.org/. See http://jsonml.org/jbst/.

New in Pygments 1.4.

class pygments.lexers.PerlLexer(**options)

For Perl source code.

class pygments.lexers.FSharpLexer(**options)

For the F# language.

New in Pygments 1.5.

class pygments.lexers.RstLexer(**options)

For reStructuredText markup.

New in Pygments 0.7.

Additional options accepted:

handlecodeblocks
Highlight the contents of .. sourcecode:: langauge and .. code:: language directives with a lexer for the given language (default: True). New in Pygments 0.8.
class pygments.lexers.NewLispLexer(**options)

For newLISP. source code (version 10.3.0).

New in Pygments 1.5.

class pygments.lexers.ScalaLexer(**options)

For Scala source code.

class pygments.lexers.LassoCssLexer(**options)

Subclass of the LassoLexer which highlights unhandled data with the CssLexer.

New in Pygments 1.6.

class pygments.lexers.XmlPhpLexer(**options)

Subclass of PhpLexer that higlights unhandled data with the XmlLexer.

class pygments.lexers.StanLexer(**options)

Pygments Lexer for Stan models.

New in Pygments 1.6.

class pygments.lexers.IniLexer(**options)

Lexer for configuration files in INI style.

class pygments.lexers.MOOCodeLexer(**options)

For MOOCode (the MOO scripting language).

New in Pygments 0.9.

class pygments.lexers.ShellSessionLexer(**options)

Lexer for shell sessions that works with different command prompts

New in Pygments 1.6.

class pygments.lexers.RPMSpecLexer(**options)

For RPM *.spec files

New in Pygments 1.6.

class pygments.lexers.NewspeakLexer(**options)

For Newspeak <http://newspeaklanguage.org/> syntax.

class pygments.lexers.BashSessionLexer(**options)

Lexer for simplistic shell sessions.

New in Pygments 1.1.

class pygments.lexers.CoqLexer(**options)

For the Coq theorem prover.

New in Pygments 1.5.

class pygments.lexers.RawTokenLexer(**options)

Recreate a token stream formatted with the RawTokenFormatter. This lexer raises exceptions during parsing if the token stream in the file is malformed.

Additional options accepted:

compress
If set to "gz" or "bz2", decompress the token stream with the given compression algorithm before lexing (default: "").
class pygments.lexers.TcshLexer(**options)

Lexer for tcsh scripts.

New in Pygments 0.10.

class pygments.lexers.LassoHtmlLexer(**options)

Subclass of the LassoLexer which highlights unhandled data with the HtmlLexer.

Nested JavaScript and CSS is also highlighted.

New in Pygments 1.6.

class pygments.lexers.CSharpLexer(**options)

For C# source code.

Additional options accepted:

unicodelevel

Determines which Unicode characters this lexer allows for identifiers. The possible values are:

  • none – only the ASCII letters and numbers are allowed. This is the fastest selection.
  • basic – all Unicode characters from the specification except category Lo are allowed.
  • full – all Unicode characters as specified in the C# specs are allowed. Note that this means a considerable slowdown since the Lo category has more than 40,000 characters in it!

The default value is basic.

New in Pygments 0.8.

class pygments.lexers.GosuTemplateLexer(**options)

For Gosu templates.

New in Pygments 1.5.

class pygments.lexers.RConsoleLexer(**options)

For R console transcripts or R CMD BATCH output files.

class pygments.lexers.MxmlLexer(**options)

For MXML markup. Nested AS3 in <script> tags is highlighted by the appropriate lexer.

New in Pygments 1.1.

class pygments.lexers.TexLexer(**options)

Lexer for the TeX and LaTeX typesetting languages.

class pygments.lexers.CssSmartyLexer(**options)

Subclass of the SmartyLexer that highlights unlexed data with the CssLexer.

class pygments.lexers.TextLexer(**options)

“Null” lexer, doesn’t highlight anything.

class pygments.lexers.AntlrCSharpLexer(**options)

ANTLR with C# Target

New in Pygments 1.1.

class pygments.lexers.OpenEdgeLexer(**options)

Lexer for OpenEdge ABL (formerly Progress) source code.

New in Pygments 1.5.

class pygments.lexers.CheetahLexer(**options)

Generic cheetah templates lexer. Code that isn’t Cheetah markup is yielded as Token.Other. This also works for spitfire templates which use the same syntax.

class pygments.lexers.SmaliLexer(**options)

For Smali (Android/Dalvik) assembly code.

New in Pygments 1.6.

class pygments.lexers.MyghtyCssLexer(**options)

Subclass of the MyghtyLexer that highlights unlexer data with the CssLexer.

New in Pygments 0.6.

class pygments.lexers.RdLexer(**options)

Pygments Lexer for R documentation (Rd) files

This is a very minimal implementation, highlighting little more than the macros. A description of Rd syntax is found in Writing R Extensions and Parsing Rd files.

New in Pygments 1.6.

class pygments.lexers.LlvmLexer(**options)

For LLVM assembly code.

class pygments.lexers.SMLLexer(**options)

For the Standard ML language.

New in Pygments 1.5.

class pygments.lexers.ElixirLexer(**options)

For the Elixir language.

New in Pygments 1.5.

class pygments.lexers.NginxConfLexer(**options)

Lexer for Nginx configuration files.

New in Pygments 0.11.

class pygments.lexers.GoodDataCLLexer(**options)

Lexer for GoodData-CL script files.

New in Pygments 1.4.

class pygments.lexers.AppleScriptLexer(**options)

For AppleScript source code, including AppleScript Studio. Contributed by Andreas Amann <aamann@mac.com>.

class pygments.lexers.HtmlSmartyLexer(**options)

Subclass of the SmartyLexer that highighlights unlexed data with the HtmlLexer.

Nested Javascript and CSS is highlighted too.

class pygments.lexers.ObjectiveCLexer(**options)

For Objective-C source code with preprocessor directives.

class pygments.lexers.JavascriptLexer(**options)

For JavaScript source code.

class pygments.lexers.RustLexer(**options)

Lexer for Mozilla’s Rust programming language.

New in Pygments 1.6.

class pygments.lexers.CommonLispLexer(**options)

A Common Lisp lexer.

New in Pygments 0.9.

class pygments.lexers.RagelEmbeddedLexer(**options)

A lexer for Ragel embedded in a host language file.

This will only highlight Ragel statements. If you want host language highlighting then call the language-specific Ragel lexer.

New in Pygments 1.1.

class pygments.lexers.ActionScript3Lexer(**options)

For ActionScript 3 source code.

New in Pygments 0.11.

class pygments.lexers.SystemVerilogLexer(**options)

Extends verilog lexer to recognise all SystemVerilog keywords from IEEE 1800-2009 standard.

New in Pygments 1.5.

class pygments.lexers.LiterateHaskellLexer(**options)

For Literate Haskell (Bird-style or LaTeX) source.

Additional options accepted:

litstyle
If given, must be "bird" or "latex". If not given, the style is autodetected: if the first non-whitespace character in the source is a backslash or percent character, LaTeX is assumed, else Bird.

New in Pygments 0.9.

class pygments.lexers.PythonTracebackLexer(**options)

For Python tracebacks.

New in Pygments 0.7.

class pygments.lexers.PhpLexer(**options)

For PHP source code. For PHP embedded in HTML, use the HtmlPhpLexer.

Additional options accepted:

startinline
If given and True the lexer starts highlighting with php code (i.e.: no starting <?php required). The default is False.
funcnamehighlighting
If given and True, highlight builtin function names (default: True).
disabledmodules

If given, must be a list of module names whose function names should not be highlighted. By default all modules are highlighted except the special 'unknown' module that includes functions that are known to php but are undocumented.

To get a list of allowed modules have a look into the _phpbuiltins module:

>>> from pygments.lexers._phpbuiltins import MODULES
>>> MODULES.keys()
['PHP Options/Info', 'Zip', 'dba', ...]

In fact the names of those modules match the module names from the php documentation.

class pygments.lexers.AntlrCppLexer(**options)

ANTLR with CPP Target

New in Pygments 1.1.

class pygments.lexers.GosuLexer(**options)

For Gosu source code.

New in Pygments 1.5.

class pygments.lexers.HybrisLexer(**options)

For Hybris source code.

New in Pygments 1.4.

class pygments.lexers.JavascriptPhpLexer(**options)

Subclass of PhpLexer which highlights unmatched data with the JavascriptLexer.

class pygments.lexers.FactorLexer(**options)

Lexer for the Factor language.

New in Pygments 1.4.

class pygments.lexers.VelocityHtmlLexer(**options)

Subclass of the VelocityLexer that highlights unlexer data with the HtmlLexer.

class pygments.lexers.MscgenLexer(**options)

For Mscgen files.

New in Pygments 1.6.

class pygments.lexers.OocLexer(**options)

For Ooc source code

New in Pygments 1.2.

class pygments.lexers.SqlLexer(**options)

Lexer for Structured Query Language. Currently, this lexer does not recognize any special syntax except ANSI SQL.

class pygments.lexers.HttpLexer(**options)

Lexer for HTTP sessions.

New in Pygments 1.5.

class pygments.lexers.ECLLexer(**options)

Lexer for the declarative big-data ECL language.

New in Pygments 1.5.

class pygments.lexers.RedcodeLexer(**options)

A simple Redcode lexer based on ICWS‘94. Contributed by Adam Blinkinsop <blinks@acm.org>.

New in Pygments 0.8.

class pygments.lexers.RagelObjectiveCLexer(**options)

A lexer for Ragel in an Objective C host file.

New in Pygments 1.1.

class pygments.lexers.XmlDjangoLexer(**options)

Subclass of the DjangoLexer that highlights unlexed data with the XmlLexer.

class pygments.lexers.AwkLexer(**options)

For Awk scripts.

New in Pygments 1.5.

class pygments.lexers.JsonLexer(**options)

For JSON data structures.

New in Pygments 1.5.

class pygments.lexers.NasmLexer(**options)

For Nasm (Intel) assembly code.

class pygments.lexers.AntlrRubyLexer(**options)

ANTLR with Ruby Target

New in Pygments 1.1.

class pygments.lexers.MyghtyXmlLexer(**options)

Subclass of the MyghtyLexer that highlights unlexer data with the XmlLexer.

New in Pygments 0.6.

class pygments.lexers.AutoItLexer(**options)

For AutoIt files.

AutoIt is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting

New in Pygments 1.6.

Project Versions

Table Of Contents

This Page