# eric4.QScintilla.Lexers.LexerPygments

Module implementing a custom lexer using pygments.

### Global Attributes

PYGMENTS_ERROR
PYGMENTS_INSERTED
TOKEN_MAP

### Classes

LexerPygments | Class implementing a custom lexer using pygments.

### Functions

None

## LexerPygments

Class implementing a custom lexer using pygments.

### Derived from

LexerContainer

### Class Attributes

None

### Class Methods

None

### Methods

LexerPygments | Constructor
__guessLexer | Private method to guess a pygments lexer.
canStyle | Public method to check, if the lexer is able to style the text.
defaultColor | Public method to get the default foreground color for a style.
defaultFont | Public method to get the default font for a style.
defaultPaper | Public method to get the default background color for a style.
description | Public method returning the descriptions of the styles supported by the lexer.
isCommentStyle | Public method to check, if a style is a comment style.
isStringStyle | Public method to check, if a style is a string style.
language | Public method returning the language of the lexer.
name | Public method to get the name of the pygments lexer.
styleBitsNeeded | Public method to get the number of style bits needed by the lexer.
styleText | Public method to perform the styling.

### Static Methods

None

#### LexerPygments (Constructor)

LexerPygments(parent = None, name = "")

Constructor

parent
  parent widget of this lexer
name=
  name of the pygments lexer to use (string)

#### LexerPygments.__guessLexer

__guessLexer(text)

Private method to guess a pygments lexer.

text
  text to base guessing on (string)

Returns:
  reference to the guessed lexer (pygments.lexer)

#### LexerPygments.canStyle

canStyle()

Public method to check, if the lexer is able to style the text.

Returns:
  flag indicating the lexer capability (boolean)

#### LexerPygments.defaultColor

defaultColor(style)

Public method to get the default foreground color for a style.

style
  style number (integer)

Returns:
  foreground color (QColor)

#### LexerPygments.defaultFont

defaultFont(style)

Public method to get the default font for a style.

style
  style number (integer)

Returns:
  font (QFont)

#### LexerPygments.defaultPaper

defaultPaper(style)

Public method to get the default background color for a style.

style
  style number (integer)

Returns:
  background color (QColor)

#### LexerPygments.description

description(style)

Public method returning the descriptions of the styles supported by the lexer.

style
  style number (integer)

#### LexerPygments.isCommentStyle

isCommentStyle(style)

Public method to check, if a style is a comment style.

Returns:
  flag indicating a comment style (boolean)

#### LexerPygments.isStringStyle

isStringStyle(style)

Public method to check, if a style is a string style.

Returns:
  flag indicating a string style (boolean)

#### LexerPygments.language

language()

Public method returning the language of the lexer.

Returns:
  language of the lexer (string)

#### LexerPygments.name

name()

Public method to get the name of the pygments lexer.

Returns:
  name of the pygments lexer (string)

#### LexerPygments.styleBitsNeeded

styleBitsNeeded()

Public method to get the number of style bits needed by the lexer.

Returns:
  number of style bits needed (integer)

#### LexerPygments.styleText

styleText(start, end)

Public method to perform the styling.

start
  position of first character to be styled (integer)
end
  position of last character to be styled (integer)

Up