# eric7.QScintilla.Lexers.LexerPygments

Module implementing a custom lexer using pygments.

### Global Attributes

PYGMENTS_ATTRIBUTE
PYGMENTS_BACKTICKSTRING
PYGMENTS_BUILTIN
PYGMENTS_CHAR
PYGMENTS_CLASS
PYGMENTS_COMMENT
PYGMENTS_CONSTANT
PYGMENTS_DECORATOR
PYGMENTS_DEFAULT
PYGMENTS_DELETED
PYGMENTS_DOCSTRING
PYGMENTS_DOUBLESTRING
PYGMENTS_EMPHASIZE
PYGMENTS_ENTITY
PYGMENTS_ERROR
PYGMENTS_ESCAPE
PYGMENTS_EXCEPTION
PYGMENTS_FUNCTION
PYGMENTS_GENERIC_ERROR
PYGMENTS_HASHBANG
PYGMENTS_HEADING
PYGMENTS_HEREDOC
PYGMENTS_INSERTED
PYGMENTS_KEYWORD
PYGMENTS_LABEL
PYGMENTS_LITERAL
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_RESERVEDKEYWORD
PYGMENTS_SCALAR
PYGMENTS_SINGLESTRING
PYGMENTS_STRING
PYGMENTS_STRONG
PYGMENTS_SUBHEADING
PYGMENTS_SYMBOL
PYGMENTS_TAG
PYGMENTS_TRACEBACK
PYGMENTS_TYPEKEYWORD
PYGMENTS_VARIABLE
PYGMENTS_WHITESPACE
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.
readSettings | Public method to read the lexer settings.
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)

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

#### LexerPygments.canStyle

canStyle()

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

Return:
  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)

Return:
  foreground color (QColor)

#### LexerPygments.defaultEolFill

defaultEolFill(style)

Public method to get the default fill to eol flag.

style
  style number (integer)

Return:
  fill to eol flag (boolean)

#### LexerPygments.defaultFont

defaultFont(style)

Public method to get the default font for a style.

style
  style number (integer)

Return:
  font (QFont)

#### LexerPygments.defaultKeywords

defaultKeywords(kwSet)

Public method to get the default keywords.

kwSet
  number of the keyword set (integer)

Return:
  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)

Return:
  background color (QColor)

#### LexerPygments.description

description(style)

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

style
  style number (integer)

Return:
  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)

Return:
  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)

Return:
  flag indicating a string style (boolean)

#### LexerPygments.language

language()

Public method returning the language of the lexer.

Return:
  language of the lexer (string)

#### LexerPygments.name

name()

Public method to get the name of the pygments lexer.

Return:
  name of the pygments lexer (string)

#### LexerPygments.readSettings

readSettings(qs, prefix="/Scintilla")

Public method to read the lexer settings.

Note: Overridden to treat the Pygments lexer specially.

qs (QSettings)
  reference to the settings object
prefix (str (optional))
  prefix for the settings key (defaults to "/Scintilla")

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