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

## 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 (QStringList or QString)

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 (QStringList or QString)

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 two 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. (QString, string)

Up

## registerLexer

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

Module function to register a custom QScintilla lexer.

name
  lexer language name (string)
displayString
  display string (QString)
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 (QStringList)
saveFilters=
  list of save file filters (QStringList)
defaultAssocs=
  default lexer associations (list of strings of filename wildcard patterns to be associated with the lexer)

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