# eric5.QScintilla.Lexers.__init__

Package implementing lexers for the various supported programming languages.

### Global Attributes

LexerRegistry

### Classes

None

### Functions

__getPygmentsLexer | Private module function to instantiate a pygments lexer.
getDefaultLexerAssociations | Module function to get a dictionary with the default associations.
getLanguageIcon | Module function to get an icon for a language.
getLexer | Module function to instantiate a lexer object for a given language.
getOpenFileFiltersList | Module function to get the file filter list for an open file operation.
getSaveFileFiltersList | Module function to get the file filter list for a save file operation.
getSupportedLanguages | Module function to get a dictionary of supported lexer languages.
registerLexer | Module function to register a custom QScintilla lexer.
unregisterLexer | Module function to unregister a custom QScintilla lexer.

## __getPygmentsLexer

__getPygmentsLexer(parent, name="")

Private module function to instantiate a pygments lexer.

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

Returns:
  reference to the lexer (LexerPygments) or None

Up

## getDefaultLexerAssociations

getDefaultLexerAssociations()

Module function to get a dictionary with the default associations.

Returns:
  dictionary with the default lexer associations

Up

## getLanguageIcon

getLanguageIcon(language, pixmap)

Module function to get an icon for a language.

language
  language of the lexer (string)
pixmap
  flag indicating to return a pixmap (boolean)

Returns:
  icon for the language (QPixmap or QIcon)

Up

## getLexer

getLexer(language, parent=None, pyname="")

Module function to instantiate a lexer object for a given language.

language
  language of the lexer (string)
parent
  reference to the parent object (QObject)
pyname=
  name of the pygments lexer to use (string)

Returns:
  reference to the instanciated lexer object (QsciLexer)

Up

## getOpenFileFiltersList

getOpenFileFiltersList(includeAll=False, asString=False, withAdditional=True)

Module function to get the file filter list for an open file operation.

includeAll
  flag indicating the inclusion of the All Files filter (boolean)
asString
  flag indicating the list should be returned as a string (boolean)
withAdditional=
  flag indicating to include additional filters defined by the user (boolean)

Returns:
  file filter list (list of strings or string)

Up

## getSaveFileFiltersList

getSaveFileFiltersList(includeAll=False, asString=False, withAdditional=True)

Module function to get the file filter list for a save file operation.

includeAll
  flag indicating the inclusion of the All Files filter (boolean)
asString
  flag indicating the list should be returned as a string (boolean)
withAdditional=
  flag indicating to include additional filters defined by the user (boolean)

Returns:
  file filter list (list of strings or string)

Up

## getSupportedLanguages

getSupportedLanguages()

Module function to get a dictionary of supported lexer languages.

Returns:
  dictionary of supported lexer languages. The keys are the internal language names. The items are lists of three entries. The first is the display string for the language, the second is a dummy file name, which can be used to derive the lexer, and the third is the name of an icon file. (string, string, string)

Up

## registerLexer

registerLexer(name, displayString, filenameSample, getLexerFunc, openFilters=[], saveFilters=[], defaultAssocs=[], iconFileName="")

Module function to register a custom QScintilla lexer.

name
  lexer language name (string)
displayString
  display string (string)
filenameSample
  dummy filename to derive lexer name (string)
getLexerFunc
  reference to a function instantiating the specific lexer. This function must take a reference to the parent as its only argument.
openFilters=
  list of open file filters (list of strings)
saveFilters=
  list of save file filters (list of strings)
defaultAssocs=
  default lexer associations (list of strings of filename wildcard patterns to be associated with the lexer)
iconFileName=
  name of an icon file (string)

Raises KeyError:
  raised when the given name is already in use

Up

## unregisterLexer

unregisterLexer(name)

Module function to unregister a custom QScintilla lexer.

name
  lexer language name (string)

Up