# eric7.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.
getSupportedApiLanguages | Module function to get a list of supported API languages.
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 (QWidget)
  reference to the parent widget
name (str)
  name of the pygments lexer to use

Return:
  reference to the lexer or None

Return Type:
  LexerPygments

Up

## getDefaultLexerAssociations

getDefaultLexerAssociations()

Module function to get a dictionary with the default associations.

Return:
  dictionary with the default lexer associations

Return Type:
  dict

Up

## getLanguageIcon

getLanguageIcon(language, pixmap)

Module function to get an icon for a language.

language (str)
  language of the lexer
pixmap (bool)
  flag indicating to return a pixmap

Return:
  icon for the language

Return Type:
  QPixmap or QIcon

Up

## getLexer

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

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

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

Return:
  reference to the instantiated lexer object

Return Type:
  QsciLexer

Up

## getOpenFileFiltersList

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

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

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

Return:
  file filter list

Return Type:
  list of str or str

Up

## getSaveFileFiltersList

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

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

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

Return:
  file filter list

Return Type:
  list of str or str

Up

## getSupportedApiLanguages

getSupportedApiLanguages()

Module function to get a list of supported API languages.

Return:
  list of supported API languages

Return Type:
  list of str

Up

## getSupportedLanguages

getSupportedLanguages()

Module function to get a dictionary of supported lexer languages.

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

Return Type:
  dict of {str: [str, str, str]}

Up

## registerLexer

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

Module function to register a custom QScintilla lexer.

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

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

Up

## unregisterLexer

unregisterLexer(name)

Module function to unregister a custom QScintilla lexer.

name (str)
  lexer language name

Up