Skip to content

lexilla

Python bindings for Lexilla, the lexer library used by Scintilla.

Re-exports the public API of the compiled _lexilla extension module, built with nanobind: create_lexer, get_lexer_count, get_lexer_name, and the Lexer class wrapping ILexer5. Hand a created lexer's .pointer (or the value from .detach()) to any Scintilla binding's SCI_SETILEXER -- see docs/lexilla/design-decisions.md.

Lexer

identifier property

This lexer's language identifier (see the LanguageIdentifier enum).

line_end_types_supported property

Line-end styles this lexer supports (see the LineEndType enum).

name property

This lexer's name, as passed to create_lexer().

pointer property

Raw ILexer5* as a plain int, e.g. for SCI_SETILEXER. Does not transfer ownership.

allocate_sub_styles(style_base, number_styles)

Allocate number_styles new style numbers derived from style_base (e.g. per-identifier-class highlighting); returns the first allocated style number, or -1 if none could be allocated.

describe_property(name)

Human-readable description of what the named property controls.

describe_word_list_sets()

Newline-separated description of each word-list slot accepted by word_list_set.

description_of_style(style)

Human-readable description of what a style number represents.

detach()

Hand ownership to the caller (e.g. a Scintilla editor) and stop managing this lexer's lifetime.

distance_to_secondary_styles()

Offset added to a primary style number to reach its secondary-style counterpart, or 0 if this lexer has none.

free_sub_styles()

Release all sub-styles previously allocated via allocate_sub_styles.

get_sub_style_bases()

Style numbers that allocate_sub_styles can be called on for this lexer, as a string with one style number per character (cast each char to int).

name_of_style(style)

Symbolic name of a style number (e.g. "SCE_C_DEFAULT" for cpp style 0).

named_styles()

Number of named styles this lexer defines (including allocated sub-styles), for iterating name_of_style/tags_of_style/description_of_style(0..named_styles()-1).

primary_style_from_style(style)

Primary style a secondary style number maps to (see distance_to_secondary_styles).

private_call(operation, pointer)

Lexer-specific opaque escape hatch; operation and the address-sized pointer/return value are defined by the individual lexer, if it implements this at all. No lexer in vendored Lexilla 5.5.0 currently does (all stub it as a no-op returning 0).

property_get(key)

Current value of a lexer property previously set via property_set, or its default.

property_names()

Newline-separated list of property keys this lexer recognizes via property_set/property_get.

property_set(key, value)

Set a lexer property; returns a Sci_Position invalidation hint (lexer-specific, often 0).

property_type(name)

Value type of the named property (see the PropertyType enum).

release()

Release the lexer now rather than waiting for garbage collection. No-op if detached or already released.

set_identifiers(style, identifiers)

Assign a space-separated list of identifiers to a sub-style number, so the lexer recognizes them as that class (e.g. known type names).

style_from_sub_style(sub_style)

Base style a previously allocated sub-style number was derived from.

sub_styles_length(style_base)

Number of sub-styles allocated from style_base via allocate_sub_styles.

sub_styles_start(style_base)

First sub-style number allocated from style_base via allocate_sub_styles, or -1 if none.

tags_of_style(style)

Space-separated semantic tags for a style number (e.g. "literal numeric").

word_list_set(n, word_list)

Set word-list slot n (see describe_word_list_sets) to a space-separated list of words.

Language

Bases: StrEnum

A lexer name from Lexilla's catalogue, accepted by create_lexer().

A68K = 'a68k' class-attribute instance-attribute

Lexilla's "a68k" lexer name, for create_lexer().

ABAQUS = 'abaqus' class-attribute instance-attribute

Lexilla's "abaqus" lexer name, for create_lexer().

ABL = 'abl' class-attribute instance-attribute

Lexilla's "abl" lexer name, for create_lexer().

ADA = 'ada' class-attribute instance-attribute

Lexilla's "ada" lexer name, for create_lexer().

APDL = 'apdl' class-attribute instance-attribute

Lexilla's "apdl" lexer name, for create_lexer().

AS = 'as' class-attribute instance-attribute

Lexilla's "as" lexer name, for create_lexer().

ASCIIDOC = 'asciidoc' class-attribute instance-attribute

Lexilla's "asciidoc" lexer name, for create_lexer().

ASM = 'asm' class-attribute instance-attribute

Lexilla's "asm" lexer name, for create_lexer().

ASN1 = 'asn1' class-attribute instance-attribute

Lexilla's "asn1" lexer name, for create_lexer().

ASY = 'asy' class-attribute instance-attribute

Lexilla's "asy" lexer name, for create_lexer().

AU3 = 'au3' class-attribute instance-attribute

Lexilla's "au3" lexer name, for create_lexer().

AVE = 'ave' class-attribute instance-attribute

Lexilla's "ave" lexer name, for create_lexer().

AVS = 'avs' class-attribute instance-attribute

Lexilla's "avs" lexer name, for create_lexer().

BAAN = 'baan' class-attribute instance-attribute

Lexilla's "baan" lexer name, for create_lexer().

BASH = 'bash' class-attribute instance-attribute

Lexilla's "bash" lexer name, for create_lexer().

BATCH = 'batch' class-attribute instance-attribute

Lexilla's "batch" lexer name, for create_lexer().

BIB = 'bib' class-attribute instance-attribute

Lexilla's "bib" lexer name, for create_lexer().

BLITZBASIC = 'blitzbasic' class-attribute instance-attribute

Lexilla's "blitzbasic" lexer name, for create_lexer().

BULLANT = 'bullant' class-attribute instance-attribute

Lexilla's "bullant" lexer name, for create_lexer().

CAML = 'caml' class-attribute instance-attribute

Lexilla's "caml" lexer name, for create_lexer().

CIL = 'cil' class-attribute instance-attribute

Lexilla's "cil" lexer name, for create_lexer().

CLARION = 'clarion' class-attribute instance-attribute

Lexilla's "clarion" lexer name, for create_lexer().

CLARIONNOCASE = 'clarionnocase' class-attribute instance-attribute

Lexilla's "clarionnocase" lexer name, for create_lexer().

CMAKE = 'cmake' class-attribute instance-attribute

Lexilla's "cmake" lexer name, for create_lexer().

COBOL = 'COBOL' class-attribute instance-attribute

Lexilla's "COBOL" lexer name, for create_lexer().

COFFEESCRIPT = 'coffeescript' class-attribute instance-attribute

Lexilla's "coffeescript" lexer name, for create_lexer().

CONF = 'conf' class-attribute instance-attribute

Lexilla's "conf" lexer name, for create_lexer().

CPP = 'cpp' class-attribute instance-attribute

Lexilla's "cpp" lexer name, for create_lexer().

CPPNOCASE = 'cppnocase' class-attribute instance-attribute

Lexilla's "cppnocase" lexer name, for create_lexer().

CSOUND = 'csound' class-attribute instance-attribute

Lexilla's "csound" lexer name, for create_lexer().

CSS = 'css' class-attribute instance-attribute

Lexilla's "css" lexer name, for create_lexer().

D = 'd' class-attribute instance-attribute

Lexilla's "d" lexer name, for create_lexer().

DART = 'dart' class-attribute instance-attribute

Lexilla's "dart" lexer name, for create_lexer().

DATAFLEX = 'dataflex' class-attribute instance-attribute

Lexilla's "dataflex" lexer name, for create_lexer().

DIFF = 'diff' class-attribute instance-attribute

Lexilla's "diff" lexer name, for create_lexer().

DMAP = 'DMAP' class-attribute instance-attribute

Lexilla's "DMAP" lexer name, for create_lexer().

DMIS = 'DMIS' class-attribute instance-attribute

Lexilla's "DMIS" lexer name, for create_lexer().

ECL = 'ecl' class-attribute instance-attribute

Lexilla's "ecl" lexer name, for create_lexer().

EDIFACT = 'edifact' class-attribute instance-attribute

Lexilla's "edifact" lexer name, for create_lexer().

EIFFEL = 'eiffel' class-attribute instance-attribute

Lexilla's "eiffel" lexer name, for create_lexer().

EIFFELKW = 'eiffelkw' class-attribute instance-attribute

Lexilla's "eiffelkw" lexer name, for create_lexer().

ERLANG = 'erlang' class-attribute instance-attribute

Lexilla's "erlang" lexer name, for create_lexer().

ERRORLIST = 'errorlist' class-attribute instance-attribute

Lexilla's "errorlist" lexer name, for create_lexer().

ESCRIPT = 'escript' class-attribute instance-attribute

Lexilla's "escript" lexer name, for create_lexer().

ESCSEQ = 'escseq' class-attribute instance-attribute

Lexilla's "escseq" lexer name, for create_lexer().

F77 = 'f77' class-attribute instance-attribute

Lexilla's "f77" lexer name, for create_lexer().

FCST = 'fcST' class-attribute instance-attribute

Lexilla's "fcST" lexer name, for create_lexer().

FLAGSHIP = 'flagship' class-attribute instance-attribute

Lexilla's "flagship" lexer name, for create_lexer().

FORTH = 'forth' class-attribute instance-attribute

Lexilla's "forth" lexer name, for create_lexer().

FORTRAN = 'fortran' class-attribute instance-attribute

Lexilla's "fortran" lexer name, for create_lexer().

FREEBASIC = 'freebasic' class-attribute instance-attribute

Lexilla's "freebasic" lexer name, for create_lexer().

FSHARP = 'fsharp' class-attribute instance-attribute

Lexilla's "fsharp" lexer name, for create_lexer().

GAP = 'gap' class-attribute instance-attribute

Lexilla's "gap" lexer name, for create_lexer().

GDSCRIPT = 'gdscript' class-attribute instance-attribute

Lexilla's "gdscript" lexer name, for create_lexer().

GUI4CLI = 'gui4cli' class-attribute instance-attribute

Lexilla's "gui4cli" lexer name, for create_lexer().

HASKELL = 'haskell' class-attribute instance-attribute

Lexilla's "haskell" lexer name, for create_lexer().

HOLLYWOOD = 'hollywood' class-attribute instance-attribute

Lexilla's "hollywood" lexer name, for create_lexer().

HYPERTEXT = 'hypertext' class-attribute instance-attribute

Lexilla's "hypertext" lexer name, for create_lexer().

IHEX = 'ihex' class-attribute instance-attribute

Lexilla's "ihex" lexer name, for create_lexer().

INDENT = 'indent' class-attribute instance-attribute

Lexilla's "indent" lexer name, for create_lexer().

INNO = 'inno' class-attribute instance-attribute

Lexilla's "inno" lexer name, for create_lexer().

JSON = 'json' class-attribute instance-attribute

Lexilla's "json" lexer name, for create_lexer().

JULIA = 'julia' class-attribute instance-attribute

Lexilla's "julia" lexer name, for create_lexer().

KIX = 'kix' class-attribute instance-attribute

Lexilla's "kix" lexer name, for create_lexer().

KVIRC = 'kvirc' class-attribute instance-attribute

Lexilla's "kvirc" lexer name, for create_lexer().

LATEX = 'latex' class-attribute instance-attribute

Lexilla's "latex" lexer name, for create_lexer().

LISP = 'lisp' class-attribute instance-attribute

Lexilla's "lisp" lexer name, for create_lexer().

LITERATEHASKELL = 'literatehaskell' class-attribute instance-attribute

Lexilla's "literatehaskell" lexer name, for create_lexer().

LOT = 'lot' class-attribute instance-attribute

Lexilla's "lot" lexer name, for create_lexer().

LOUT = 'lout' class-attribute instance-attribute

Lexilla's "lout" lexer name, for create_lexer().

LUA = 'lua' class-attribute instance-attribute

Lexilla's "lua" lexer name, for create_lexer().

MAGIKSF = 'magiksf' class-attribute instance-attribute

Lexilla's "magiksf" lexer name, for create_lexer().

MAKEFILE = 'makefile' class-attribute instance-attribute

Lexilla's "makefile" lexer name, for create_lexer().

MARKDOWN = 'markdown' class-attribute instance-attribute

Lexilla's "markdown" lexer name, for create_lexer().

MATLAB = 'matlab' class-attribute instance-attribute

Lexilla's "matlab" lexer name, for create_lexer().

MAXIMA = 'maxima' class-attribute instance-attribute

Lexilla's "maxima" lexer name, for create_lexer().

METAPOST = 'metapost' class-attribute instance-attribute

Lexilla's "metapost" lexer name, for create_lexer().

MMIXAL = 'mmixal' class-attribute instance-attribute

Lexilla's "mmixal" lexer name, for create_lexer().

MODULA = 'modula' class-attribute instance-attribute

Lexilla's "modula" lexer name, for create_lexer().

MSSQL = 'mssql' class-attribute instance-attribute

Lexilla's "mssql" lexer name, for create_lexer().

MYSQL = 'mysql' class-attribute instance-attribute

Lexilla's "mysql" lexer name, for create_lexer().

NIM = 'nim' class-attribute instance-attribute

Lexilla's "nim" lexer name, for create_lexer().

NIMROD = 'nimrod' class-attribute instance-attribute

Lexilla's "nimrod" lexer name, for create_lexer().

NIX = 'nix' class-attribute instance-attribute

Lexilla's "nix" lexer name, for create_lexer().

NNCRONTAB = 'nncrontab' class-attribute instance-attribute

Lexilla's "nncrontab" lexer name, for create_lexer().

NSIS = 'nsis' class-attribute instance-attribute

Lexilla's "nsis" lexer name, for create_lexer().

NULL = 'null' class-attribute instance-attribute

Lexilla's "null" lexer name, for create_lexer().

OCTAVE = 'octave' class-attribute instance-attribute

Lexilla's "octave" lexer name, for create_lexer().

OPAL = 'opal' class-attribute instance-attribute

Lexilla's "opal" lexer name, for create_lexer().

OSCRIPT = 'oscript' class-attribute instance-attribute

Lexilla's "oscript" lexer name, for create_lexer().

PASCAL = 'pascal' class-attribute instance-attribute

Lexilla's "pascal" lexer name, for create_lexer().

PERL = 'perl' class-attribute instance-attribute

Lexilla's "perl" lexer name, for create_lexer().

PHPSCRIPT = 'phpscript' class-attribute instance-attribute

Lexilla's "phpscript" lexer name, for create_lexer().

PLM = 'PL/M' class-attribute instance-attribute

Lexilla's "PL/M" lexer name, for create_lexer().

PO = 'po' class-attribute instance-attribute

Lexilla's "po" lexer name, for create_lexer().

POV = 'pov' class-attribute instance-attribute

Lexilla's "pov" lexer name, for create_lexer().

POWERBASIC = 'powerbasic' class-attribute instance-attribute

Lexilla's "powerbasic" lexer name, for create_lexer().

POWERPRO = 'powerpro' class-attribute instance-attribute

Lexilla's "powerpro" lexer name, for create_lexer().

POWERSHELL = 'powershell' class-attribute instance-attribute

Lexilla's "powershell" lexer name, for create_lexer().

PROPS = 'props' class-attribute instance-attribute

Lexilla's "props" lexer name, for create_lexer().

PS = 'ps' class-attribute instance-attribute

Lexilla's "ps" lexer name, for create_lexer().

PUREBASIC = 'purebasic' class-attribute instance-attribute

Lexilla's "purebasic" lexer name, for create_lexer().

PYTHON = 'python' class-attribute instance-attribute

Lexilla's "python" lexer name, for create_lexer().

R = 'r' class-attribute instance-attribute

Lexilla's "r" lexer name, for create_lexer().

RAKU = 'raku' class-attribute instance-attribute

Lexilla's "raku" lexer name, for create_lexer().

REBOL = 'rebol' class-attribute instance-attribute

Lexilla's "rebol" lexer name, for create_lexer().

REGISTRY = 'registry' class-attribute instance-attribute

Lexilla's "registry" lexer name, for create_lexer().

RUBY = 'ruby' class-attribute instance-attribute

Lexilla's "ruby" lexer name, for create_lexer().

RUST = 'rust' class-attribute instance-attribute

Lexilla's "rust" lexer name, for create_lexer().

SAS = 'sas' class-attribute instance-attribute

Lexilla's "sas" lexer name, for create_lexer().

SCRIPTOL = 'scriptol' class-attribute instance-attribute

Lexilla's "scriptol" lexer name, for create_lexer().

SINEX = 'sinex' class-attribute instance-attribute

Lexilla's "sinex" lexer name, for create_lexer().

SMALLTALK = 'smalltalk' class-attribute instance-attribute

Lexilla's "smalltalk" lexer name, for create_lexer().

SML = 'SML' class-attribute instance-attribute

Lexilla's "SML" lexer name, for create_lexer().

SORCINS = 'sorcins' class-attribute instance-attribute

Lexilla's "sorcins" lexer name, for create_lexer().

SPECMAN = 'specman' class-attribute instance-attribute

Lexilla's "specman" lexer name, for create_lexer().

SPICE = 'spice' class-attribute instance-attribute

Lexilla's "spice" lexer name, for create_lexer().

SQL = 'sql' class-attribute instance-attribute

Lexilla's "sql" lexer name, for create_lexer().

SREC = 'srec' class-attribute instance-attribute

Lexilla's "srec" lexer name, for create_lexer().

STATA = 'stata' class-attribute instance-attribute

Lexilla's "stata" lexer name, for create_lexer().

TACL = 'TACL' class-attribute instance-attribute

Lexilla's "TACL" lexer name, for create_lexer().

TADS3 = 'tads3' class-attribute instance-attribute

Lexilla's "tads3" lexer name, for create_lexer().

TAL = 'TAL' class-attribute instance-attribute

Lexilla's "TAL" lexer name, for create_lexer().

TCL = 'tcl' class-attribute instance-attribute

Lexilla's "tcl" lexer name, for create_lexer().

TCMD = 'tcmd' class-attribute instance-attribute

Lexilla's "tcmd" lexer name, for create_lexer().

TEHEX = 'tehex' class-attribute instance-attribute

Lexilla's "tehex" lexer name, for create_lexer().

TEX = 'tex' class-attribute instance-attribute

Lexilla's "tex" lexer name, for create_lexer().

TOML = 'toml' class-attribute instance-attribute

Lexilla's "toml" lexer name, for create_lexer().

TROFF = 'troff' class-attribute instance-attribute

Lexilla's "troff" lexer name, for create_lexer().

TXT2TAGS = 'txt2tags' class-attribute instance-attribute

Lexilla's "txt2tags" lexer name, for create_lexer().

VB = 'vb' class-attribute instance-attribute

Lexilla's "vb" lexer name, for create_lexer().

VBSCRIPT = 'vbscript' class-attribute instance-attribute

Lexilla's "vbscript" lexer name, for create_lexer().

VERILOG = 'verilog' class-attribute instance-attribute

Lexilla's "verilog" lexer name, for create_lexer().

VHDL = 'vhdl' class-attribute instance-attribute

Lexilla's "vhdl" lexer name, for create_lexer().

VISUALPROLOG = 'visualprolog' class-attribute instance-attribute

Lexilla's "visualprolog" lexer name, for create_lexer().

X12 = 'x12' class-attribute instance-attribute

Lexilla's "x12" lexer name, for create_lexer().

XML = 'xml' class-attribute instance-attribute

Lexilla's "xml" lexer name, for create_lexer().

YAML = 'yaml' class-attribute instance-attribute

Lexilla's "yaml" lexer name, for create_lexer().

ZIG = 'zig' class-attribute instance-attribute

Lexilla's "zig" lexer name, for create_lexer().

LanguageIdentifier

Bases: IntEnum

Numeric language identifier of a lexer (see Lexer.identifier), mirroring SciLexer.h's SCLEX_*.

A68K = 100 class-attribute instance-attribute

Identifier for the "a68k" lexer.

ABAQUS = 84 class-attribute instance-attribute

Identifier for the "abaqus" lexer.

ADA = 20 class-attribute instance-attribute

Identifier for the "ada" lexer.

APDL = 61 class-attribute instance-attribute

Identifier for the "apdl" lexer.

AS = 113 class-attribute instance-attribute

Identifier for the "as" lexer.

ASCIIDOC = 134 class-attribute instance-attribute

Identifier for the "asciidoc" lexer.

ASM = 34 class-attribute instance-attribute

Identifier for the "asm" lexer.

ASN1 = 63 class-attribute instance-attribute

Identifier for the "asn1" lexer.

ASYMPTOTE = 85 class-attribute instance-attribute

Identifier for the "asy" lexer.

AU3 = 60 class-attribute instance-attribute

Identifier for the "au3" lexer.

AUTOMATIC = 1000 class-attribute instance-attribute

Sentinel requesting automatic lexer selection; not itself a lexer.

AVE = 19 class-attribute instance-attribute

Identifier for the "ave" lexer.

AVS = 104 class-attribute instance-attribute

Identifier for the "avs" lexer.

BAAN = 31 class-attribute instance-attribute

Identifier for the "baan" lexer.

BASH = 62 class-attribute instance-attribute

Identifier for the "bash" lexer.

BATCH = 12 class-attribute instance-attribute

Identifier for the "batch" lexer.

BIBTEX = 116 class-attribute instance-attribute

Identifier for the "bib" lexer.

BLITZBASIC = 66 class-attribute instance-attribute

Identifier for the "blitzbasic" lexer.

BULLANT = 27 class-attribute instance-attribute

Identifier for the "bullant" lexer.

CAML = 65 class-attribute instance-attribute

Identifier for the "caml" lexer.

CIL = 127 class-attribute instance-attribute

Identifier for the "cil" lexer.

CLW = 45 class-attribute instance-attribute

Identifier for the "clarion" lexer.

CLWNOCASE = 46 class-attribute instance-attribute

Identifier for the "clarionnocase" lexer.

CMAKE = 80 class-attribute instance-attribute

Identifier for the "cmake" lexer.

COBOL = 92 class-attribute instance-attribute

Identifier for the "COBOL" lexer.

COFFEESCRIPT = 102 class-attribute instance-attribute

Identifier for the "coffeescript" lexer.

CONF = 17 class-attribute instance-attribute

Identifier for the "conf" lexer.

CONTAINER = 0 class-attribute instance-attribute

Reserved; SCLEX_CONTAINER is defined but has no associated lexer.

CPP = 3 class-attribute instance-attribute

Identifier for the "cpp" lexer.

CPPNOCASE = 35 class-attribute instance-attribute

Identifier for the "cppnocase" lexer.

CSOUND = 74 class-attribute instance-attribute

Identifier for the "csound" lexer.

CSS = 38 class-attribute instance-attribute

Identifier for the "css" lexer.

D = 79 class-attribute instance-attribute

Identifier for the "d" lexer.

DART = 138 class-attribute instance-attribute

Identifier for the "dart" lexer.

DATAFLEX = 129 class-attribute instance-attribute

Identifier for the "dataflex" lexer.

DIFF = 16 class-attribute instance-attribute

Identifier for the "diff" lexer.

DMAP = 112 class-attribute instance-attribute

Identifier for the "DMAP" lexer.

DMIS = 114 class-attribute instance-attribute

Identifier for the "DMIS" lexer.

ECL = 105 class-attribute instance-attribute

Identifier for the "ecl" lexer.

EDIFACT = 121 class-attribute instance-attribute

Identifier for the "edifact" lexer.

EIFFEL = 23 class-attribute instance-attribute

Identifier for the "eiffel" lexer.

EIFFELKW = 24 class-attribute instance-attribute

Identifier for the "eiffelkw" lexer.

ERLANG = 53 class-attribute instance-attribute

Identifier for the "erlang" lexer.

ERRORLIST = 10 class-attribute instance-attribute

Identifier for the "errorlist" lexer.

ESCRIPT = 41 class-attribute instance-attribute

Identifier for the "escript" lexer.

ESCSEQ = 142 class-attribute instance-attribute

Identifier for the "escseq" lexer.

F77 = 37 class-attribute instance-attribute

Identifier for the "f77" lexer.

FLAGSHIP = 73 class-attribute instance-attribute

Identifier for the "flagship" lexer.

FORTH = 52 class-attribute instance-attribute

Identifier for the "forth" lexer.

FORTRAN = 36 class-attribute instance-attribute

Identifier for the "fortran" lexer.

FREEBASIC = 75 class-attribute instance-attribute

Identifier for the "freebasic" lexer.

FSHARP = 132 class-attribute instance-attribute

Identifier for the "fsharp" lexer.

GAP = 81 class-attribute instance-attribute

Identifier for the "gap" lexer.

GDSCRIPT = 135 class-attribute instance-attribute

Identifier for the "gdscript" lexer.

GUI4CLI = 58 class-attribute instance-attribute

Identifier for the "gui4cli" lexer.

HASKELL = 68 class-attribute instance-attribute

Identifier for the "haskell" lexer.

HOLLYWOOD = 130 class-attribute instance-attribute

Identifier for the "hollywood" lexer.

HTML = 4 class-attribute instance-attribute

Identifier for the "hypertext" lexer.

IHEX = 118 class-attribute instance-attribute

Identifier for the "ihex" lexer.

INDENT = 122 class-attribute instance-attribute

Identifier for the "indent" lexer.

INNOSETUP = 76 class-attribute instance-attribute

Identifier for the "inno" lexer.

JSON = 120 class-attribute instance-attribute

Identifier for the "json" lexer.

JULIA = 133 class-attribute instance-attribute

Identifier for the "julia" lexer.

KIX = 57 class-attribute instance-attribute

Identifier for the "kix" lexer.

KVIRC = 110 class-attribute instance-attribute

Identifier for the "kvirc" lexer.

LATEX = 14 class-attribute instance-attribute

Identifier for the "latex" lexer.

LISP = 21 class-attribute instance-attribute

Identifier for the "lisp" lexer.

LITERATEHASKELL = 108 class-attribute instance-attribute

Identifier for the "literatehaskell" lexer.

LOT = 47 class-attribute instance-attribute

Identifier for the "lot" lexer.

LOUT = 40 class-attribute instance-attribute

Identifier for the "lout" lexer.

LUA = 15 class-attribute instance-attribute

Identifier for the "lua" lexer.

MAGIK = 87 class-attribute instance-attribute

Identifier for the "magiksf" lexer.

MAKEFILE = 11 class-attribute instance-attribute

Identifier for the "makefile" lexer.

MARKDOWN = 98 class-attribute instance-attribute

Identifier for the "markdown" lexer.

MATLAB = 32 class-attribute instance-attribute

Identifier for the "matlab" lexer.

MAXIMA = 123 class-attribute instance-attribute

Identifier for the "maxima" lexer.

METAPOST = 50 class-attribute instance-attribute

Identifier for the "metapost" lexer.

MMIXAL = 44 class-attribute instance-attribute

Identifier for the "mmixal" lexer.

MODULA = 101 class-attribute instance-attribute

Identifier for the "modula" lexer.

MSSQL = 55 class-attribute instance-attribute

Identifier for the "mssql" lexer.

MYSQL = 89 class-attribute instance-attribute

Identifier for the "mysql" lexer.

NIM = 126 class-attribute instance-attribute

Identifier for the "nim" lexer.

NIMROD = 96 class-attribute instance-attribute

Identifier for the "nimrod" lexer.

NIX = 140 class-attribute instance-attribute

Identifier for the "nix" lexer.

NNCRONTAB = 26 class-attribute instance-attribute

Identifier for the "nncrontab" lexer.

NSIS = 43 class-attribute instance-attribute

Identifier for the "nsis" lexer.

NULL = 1 class-attribute instance-attribute

Reserved; SCLEX_NULL is defined but has no associated lexer.

OCTAVE = 54 class-attribute instance-attribute

Identifier for the "octave" lexer.

OPAL = 77 class-attribute instance-attribute

Identifier for the "opal" lexer.

OSCRIPT = 106 class-attribute instance-attribute

Identifier for the "oscript" lexer.

PASCAL = 18 class-attribute instance-attribute

Identifier for the "pascal" lexer.

PERL = 6 class-attribute instance-attribute

Identifier for the "perl" lexer.

PHPSCRIPT = 69 class-attribute instance-attribute

Identifier for the "phpscript" lexer.

PLM = 82 class-attribute instance-attribute

Identifier for the "PL/M" lexer.

PO = 90 class-attribute instance-attribute

Identifier for the "po" lexer.

POV = 39 class-attribute instance-attribute

Identifier for the "pov" lexer.

POWERBASIC = 51 class-attribute instance-attribute

Identifier for the "powerbasic" lexer.

POWERPRO = 95 class-attribute instance-attribute

Identifier for the "powerpro" lexer.

POWERSHELL = 88 class-attribute instance-attribute

Identifier for the "powershell" lexer.

PROGRESS = 83 class-attribute instance-attribute

Identifier for the "abl" lexer.

PROPERTIES = 9 class-attribute instance-attribute

Identifier for the "props" lexer.

PS = 42 class-attribute instance-attribute

Identifier for the "ps" lexer.

PUREBASIC = 67 class-attribute instance-attribute

Identifier for the "purebasic" lexer.

PYTHON = 2 class-attribute instance-attribute

Identifier for the "python" lexer.

R = 86 class-attribute instance-attribute

Identifier for the "r" lexer.

RAKU = 131 class-attribute instance-attribute

Identifier for the "raku" lexer.

REBOL = 71 class-attribute instance-attribute

Identifier for the "rebol" lexer.

REGISTRY = 115 class-attribute instance-attribute

Identifier for the "registry" lexer.

RUBY = 22 class-attribute instance-attribute

Identifier for the "ruby" lexer.

RUST = 111 class-attribute instance-attribute

Identifier for the "rust" lexer.

SAS = 125 class-attribute instance-attribute

Identifier for the "sas" lexer.

SCRIPTOL = 33 class-attribute instance-attribute

Identifier for the "scriptol" lexer.

SINEX = 141 class-attribute instance-attribute

Identifier for the "sinex" lexer.

SMALLTALK = 72 class-attribute instance-attribute

Identifier for the "smalltalk" lexer.

SML = 97 class-attribute instance-attribute

Identifier for the "SML" lexer.

SORCUS = 94 class-attribute instance-attribute

Identifier for the "sorcins" lexer.

SPECMAN = 59 class-attribute instance-attribute

Identifier for the "specman" lexer.

SPICE = 78 class-attribute instance-attribute

Identifier for the "spice" lexer.

SQL = 7 class-attribute instance-attribute

Identifier for the "sql" lexer.

SREC = 117 class-attribute instance-attribute

Identifier for the "srec" lexer.

STATA = 124 class-attribute instance-attribute

Identifier for the "stata" lexer.

STTXT = 109 class-attribute instance-attribute

Identifier for the "fcST" lexer.

TACL = 93 class-attribute instance-attribute

Identifier for the "TACL" lexer.

TADS3 = 70 class-attribute instance-attribute

Identifier for the "tads3" lexer.

TAL = 91 class-attribute instance-attribute

Identifier for the "TAL" lexer.

TCL = 25 class-attribute instance-attribute

Identifier for the "tcl" lexer.

TCMD = 103 class-attribute instance-attribute

Identifier for the "tcmd" lexer.

TEHEX = 119 class-attribute instance-attribute

Identifier for the "tehex" lexer.

TEX = 49 class-attribute instance-attribute

Identifier for the "tex" lexer.

TOML = 136 class-attribute instance-attribute

Identifier for the "toml" lexer.

TROFF = 137 class-attribute instance-attribute

Identifier for the "troff" lexer.

TXT2TAGS = 99 class-attribute instance-attribute

Identifier for the "txt2tags" lexer.

VB = 8 class-attribute instance-attribute

Identifier for the "vb" lexer.

VBSCRIPT = 28 class-attribute instance-attribute

Identifier for the "vbscript" lexer.

VERILOG = 56 class-attribute instance-attribute

Identifier for the "verilog" lexer.

VHDL = 64 class-attribute instance-attribute

Identifier for the "vhdl" lexer.

VISUALPROLOG = 107 class-attribute instance-attribute

Identifier for the "visualprolog" lexer.

X12 = 128 class-attribute instance-attribute

Identifier for the "x12" lexer.

XCODE = 13 class-attribute instance-attribute

Reserved; SCLEX_XCODE is defined but has no associated lexer.

XML = 5 class-attribute instance-attribute

Identifier for the "xml" lexer.

YAML = 48 class-attribute instance-attribute

Identifier for the "yaml" lexer.

ZIG = 139 class-attribute instance-attribute

Identifier for the "zig" lexer.

PropertyType

Bases: IntEnum

Value type of a lexer property (see Lexer.property_type), mirroring Scintilla.h's SC_TYPE_*.

BOOLEAN = 0 class-attribute instance-attribute

A property whose value is interpreted as 0/1.

INTEGER = 1 class-attribute instance-attribute

A property whose value is interpreted as an integer.

STRING = 2 class-attribute instance-attribute

A property whose value is interpreted as a string.

LineEndType

Bases: IntEnum

Line-end styles a lexer supports (see Lexer.line_end_types_supported), mirroring Scintilla.h's SC_LINE_END_TYPE_*.

DEFAULT = 0 class-attribute instance-attribute

Only \r, \n, and \r\n are treated as line ends.

UNICODE = 1 class-attribute instance-attribute

Unicode line-end characters (e.g. U+2028 LINE SEPARATOR) are also treated as line ends.

create_lexer(name)

Create a lexer by name (e.g. "cpp"), or None if no lexer has that name.

get_lexer_count()

Number of lexers in Lexilla's catalogue, for iterating get_lexer_name(0..count-1).

get_lexer_name(index)

Name of the lexer at the given catalogue index, suitable for passing to create_lexer().

lexilla.pyside6_scintilla

Convenience glue for handing a Lexilla lexer to pyside6-scintilla.

Requires pyside6-scintilla to be installed -- importing this module pulls it in directly. The core lexilla package has no such dependency; this is the only place the two packages are allowed to depend on each other (see docs/lexilla/design-decisions.md's "Cross-binding integration" decision).

__all__ = ['set_lexer'] module-attribute

set_lexer(editor, lexer)

Set lexer on editor, transferring ownership to it.

:param editor: The widget to lex. :param lexer: The lexer to set; detached, so it must not be used afterwards.

Example

.. code:: python

from lexilla import Language, create_lexer
from lexilla.pyside6_scintilla import set_lexer
from pyside6_scintilla import ScintillaEdit

editor = ScintillaEdit()
lexer = create_lexer(Language.CPP)
assert lexer is not None
set_lexer(editor, lexer)