# eric6.QScintilla.Lexers.LexerPygments

Module implementing a custom lexer using pygments.

### Global Attributes

PYGMENTS_ATTRIBUTE
PYGMENTS_BUILTIN
PYGMENTS_CHAR
PYGMENTS_CLASS
PYGMENTS_COMMENT
PYGMENTS_CONSTANT
PYGMENTS_DECORATOR
PYGMENTS_DEFAULT
PYGMENTS_DELETED
PYGMENTS_DOCSTRING
PYGMENTS_EMPHASIZE
PYGMENTS_ENTITY
PYGMENTS_ERROR
PYGMENTS_ESCAPE
PYGMENTS_EXCEPTION
PYGMENTS_FUNCTION
PYGMENTS_GENERIC_ERROR
PYGMENTS_HEADING
PYGMENTS_HEREDOC
PYGMENTS_INSERTED
PYGMENTS_KEYWORD
PYGMENTS_LABEL
PYGMENTS_MULTILINECOMMENT
PYGMENTS_NAMESPACE
PYGMENTS_NUMBER
PYGMENTS_OPERATOR
PYGMENTS_OTHER
PYGMENTS_OUTPUT
PYGMENTS_PREPROCESSOR
PYGMENTS_PROMPT
PYGMENTS_PROPERTY
PYGMENTS_PSEUDOKEYWORD
PYGMENTS_PUNCTUATION
PYGMENTS_REGEX
PYGMENTS_SCALAR
PYGMENTS_STRING
PYGMENTS_STRONG
PYGMENTS_SUBHEADING
PYGMENTS_SYMBOL
PYGMENTS_TAG
PYGMENTS_TRACEBACK
PYGMENTS_TYPEKEYWORD
PYGMENTS_VARIABLE
PYGMENTS_WORD
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.
defaultEolFill | Public method to get the default fill to eol flag.
defaultFont | Public method to get the default font for a style.
defaultKeywords | Public method to get the default keywords.
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.defaultEolFill

defaultEolFill(style)

Public method to get the default fill to eol flag.

style
  style number (integer)

Returns:
  fill to eol flag (boolean)

#### LexerPygments.defaultFont

defaultFont(style)

Public method to get the default font for a style.

style
  style number (integer)

Returns:
  font (QFont)

#### LexerPygments.defaultKeywords

defaultKeywords(kwSet)

Public method to get the default keywords.

kwSet
  number of the keyword set (integer)

Returns:
  string giving the keywords (string) or None

#### 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)

Returns:
  description for the style (string)

#### LexerPygments.isCommentStyle

isCommentStyle(style)

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

style
  style to check (integer)

Returns:
  flag indicating a comment style (boolean)

#### LexerPygments.isStringStyle

isStringStyle(style)

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

style
  style to check (integer)

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