peppy :: editra :: syntax :: syntax' :: SyntaxMgr :: Class SyntaxMgr
[frames] | no frames]

Class SyntaxMgr

object --+
         |
        SyntaxMgr

Class Object for managing loaded syntax data. The manager is only created once as a singleton and shared amongst all editor windows

Instance Methods
 
GetLangId(self, ext)
Gets the language Id that is associated with the file extension.
 
IsModLoaded(self, modname)
Checks if a module has already been loaded
 
LoadModule(self, modname)
Dynamically loads a module by name.
 
SaveState(self)
Saves the current configuration state of the manager to disk for use in other sessions.
 
SyntaxData(self, ext)
Fetches the language data based on a file extention string.
 
__init__(self, config=None)
Initialize a syntax manager.

Inherited from object: __delattr__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Static Methods
a new object with type S, a subtype of T
__new__(cls, *args, **kargs)
Ensure only a single instance is shared amongst all objects.
Class Variables
  first = True
  instance = syntax.SyntaxMgr()
Properties

Inherited from object: __class__

Method Details

GetLangId(self, ext)

 

Gets the language Id that is associated with the file extension.

Parameters:
  • ext - extension to get lang id for

IsModLoaded(self, modname)

 

Checks if a module has already been loaded

Parameters:
  • modname - name of module to lookup

LoadModule(self, modname)

 

Dynamically loads a module by name. The loading is only done if the modules data set is not already being managed

Parameters:
  • modname - name of syntax module to load

SaveState(self)

 

Saves the current configuration state of the manager to disk for use in other sessions.

Returns:
whether save was successful or not

SyntaxData(self, ext)

 

Fetches the language data based on a file extention string. The file extension is used to look up the default lexer actions from the EXT_REG dictionary. @see synglob

Parameters:
  • ext - a string representing the file extension
Returns:
Returns a Dictionary of Lexer Config Data

__init__(self, config=None)
(Constructor)

 

Initialize a syntax manager. If the optional value config is set the mapping of extensions to lexers will be loaded from a config file.

Parameters:
  • config - path of config file to load file extension config from
Overrides: object.__init__

__new__(cls, *args, **kargs)
Static Method

 

Ensure only a single instance is shared amongst all objects.

Returns: a new object with type S, a subtype of T
class instance
Overrides: object.__new__