Available lexers¶
This page lists all available builtin lexers and the options they take.
Currently, all lexers support these options:
- stripnl
- Strip leading and trailing newlines from the input (default: True)
- stripall
- Strip all leading and trailing whitespace from the input (default: False).
- ensurenl
Make sure that the input ends with a newline (default: True). This is required for some lexers that consume input linewise.
New in version 1.3.
- tabsize
- If given and greater than 0, expand tabs in the input (default: 0).
- encoding
If given, must be an encoding name (such as "utf-8"). This encoding will be used to convert the input string to Unicode (if it is not already a Unicode string). The default is "guess".
If this option is set to "guess", a simple UTF-8 vs. Latin-1 detection is used, if it is set to "chardet", the chardet library is used to guess the encoding of the input.
New in version 0.6.
The “Short Names” field lists the identifiers that can be used with the get_lexer_by_name() function.
These lexers are builtin and can be imported from pygments.lexers:
Lexers for ActionScript and MXML¶
- class pygments.lexers.actionscript.ActionScript3Lexer¶
Short names: as3, actionscript3 Filenames: *.as MIME types: application/x-actionscript3, text/x-actionscript3, text/actionscript3 For ActionScript 3 source code.
New in version 0.11.
- class pygments.lexers.actionscript.ActionScriptLexer¶
Short names: as, actionscript Filenames: *.as MIME types: application/x-actionscript, text/x-actionscript, text/actionscript For ActionScript source code.
New in version 0.9.
- class pygments.lexers.actionscript.MxmlLexer¶
Short names: mxml Filenames: *.mxml MIME types: None For MXML markup. Nested AS3 in <script> tags is highlighted by the appropriate lexer.
New in version 1.1.
Lexers for computer algebra systems¶
- class pygments.lexers.algebra.GAPLexer¶
Short names: gap Filenames: *.g, *.gd, *.gi, *.gap MIME types: None For GAP source code.
New in version 2.0.
- class pygments.lexers.algebra.MathematicaLexer¶
Short names: mathematica, mma, nb Filenames: *.nb, *.cdf, *.nbp, *.ma MIME types: application/mathematica, application/vnd.wolfram.mathematica, application/vnd.wolfram.mathematica.package, application/vnd.wolfram.cdf Lexer for Mathematica source code.
New in version 2.0.
- class pygments.lexers.algebra.MuPADLexer¶
Short names: mupad Filenames: *.mu MIME types: None A MuPAD lexer. Contributed by Christopher Creutzig <christopher@creutzig.de>.
New in version 0.8.
Lexers for AmbientTalk language¶
- class pygments.lexers.ambient.AmbientTalkLexer¶
Short names: at, ambienttalk, ambienttalk/2 Filenames: *.at MIME types: text/x-ambienttalk Lexer for AmbientTalk source code.
New in version 2.0.
Lexers for APL¶
- class pygments.lexers.apl.APLLexer¶
Short names: apl Filenames: *.apl MIME types: None A simple APL lexer.
New in version 2.0.
Lexers for assembly languages¶
- class pygments.lexers.asm.CObjdumpLexer¶
Short names: c-objdump Filenames: *.c-objdump MIME types: text/x-c-objdump For the output of ‘objdump -Sr on compiled C files’
- class pygments.lexers.asm.Ca65Lexer¶
Short names: ca65 Filenames: *.s MIME types: None For ca65 assembler sources.
New in version 1.6.
- class pygments.lexers.asm.CppObjdumpLexer¶
Short names: cpp-objdump, c++-objdumb, cxx-objdump Filenames: *.cpp-objdump, *.c++-objdump, *.cxx-objdump MIME types: text/x-cpp-objdump For the output of ‘objdump -Sr on compiled C++ files’
- class pygments.lexers.asm.DObjdumpLexer¶
Short names: d-objdump Filenames: *.d-objdump MIME types: text/x-d-objdump For the output of ‘objdump -Sr on compiled D files’
- class pygments.lexers.asm.GasLexer¶
Short names: gas, asm Filenames: *.s, *.S MIME types: text/x-gas For Gas (AT&T) assembly code.
- class pygments.lexers.asm.LlvmLexer¶
Short names: llvm Filenames: *.ll MIME types: text/x-llvm For LLVM assembly code.
- class pygments.lexers.asm.NasmLexer¶
Short names: nasm Filenames: *.asm, *.ASM MIME types: text/x-nasm For Nasm (Intel) assembly code.
- class pygments.lexers.asm.NasmObjdumpLexer¶
Short names: objdump-nasm Filenames: *.objdump-intel MIME types: text/x-nasm-objdump For the output of ‘objdump -d -M intel’.
New in version 2.0.
- class pygments.lexers.asm.ObjdumpLexer¶
Short names: objdump Filenames: *.objdump MIME types: text/x-objdump For the output of ‘objdump -dr’
Lexers for automation scripting languages¶
- class pygments.lexers.automation.AutoItLexer¶
Short names: autoit Filenames: *.au3 MIME types: text/x-autoit For AutoIt files.
AutoIt is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting
New in version 1.6.
- class pygments.lexers.automation.AutohotkeyLexer¶
Short names: ahk, autohotkey Filenames: *.ahk, *.ahkl MIME types: text/x-autohotkey For autohotkey source code.
New in version 1.4.
Lexers for BASIC like languages (other than VB.net)¶
- class pygments.lexers.basic.BlitzBasicLexer¶
Short names: blitzbasic, b3d, bplus Filenames: *.bb, *.decls MIME types: text/x-bb For BlitzBasic source code.
New in version 2.0.
- class pygments.lexers.basic.BlitzMaxLexer¶
Short names: blitzmax, bmax Filenames: *.bmx MIME types: text/x-bmx For BlitzMax source code.
New in version 1.4.
- class pygments.lexers.basic.CbmBasicV2Lexer¶
Short names: cbmbas Filenames: *.bas MIME types: None For CBM BASIC V2 sources.
New in version 1.6.
- class pygments.lexers.basic.MonkeyLexer¶
Short names: monkey Filenames: *.monkey MIME types: text/x-monkey For Monkey source code.
New in version 1.6.
- class pygments.lexers.basic.QBasicLexer¶
Short names: qbasic, basic Filenames: *.BAS, *.bas MIME types: text/basic For QBasic source code.
New in version 2.0.
Lexers for “business-oriented” languages¶
- class pygments.lexers.business.ABAPLexer¶
Short names: abap Filenames: *.abap MIME types: text/x-abap Lexer for ABAP, SAP’s integrated language.
New in version 1.1.
- class pygments.lexers.business.CobolFreeformatLexer¶
Short names: cobolfree Filenames: *.cbl, *.CBL MIME types: None Lexer for Free format OpenCOBOL code.
New in version 1.6.
- class pygments.lexers.business.CobolLexer¶
Short names: cobol Filenames: *.cob, *.COB, *.cpy, *.CPY MIME types: text/x-cobol Lexer for OpenCOBOL code.
New in version 1.6.
- class pygments.lexers.business.GoodDataCLLexer¶
Short names: gooddata-cl Filenames: *.gdc MIME types: text/x-gooddata-cl Lexer for GoodData-CL script files.
New in version 1.4.
- class pygments.lexers.business.MaqlLexer¶
Short names: maql Filenames: *.maql MIME types: text/x-gooddata-maql, application/x-gooddata-maql Lexer for GoodData MAQL scripts.
New in version 1.4.
- class pygments.lexers.business.OpenEdgeLexer¶
Short names: openedge, abl, progress Filenames: *.p, *.cls MIME types: text/x-openedge, application/x-openedge Lexer for OpenEdge ABL (formerly Progress) source code.
New in version 1.5.