Package peppy :: Package editra :: Package syntax' :: Module syntax'
[frames] | no frames]

Module syntax'

FILE: syntax.py AUTHOR: Cody Precord

SUMMARY:

Toolkit for managing the importing of syntax modules and providing the data to the requesting text control. It is meant to be the main access point to the resources and api provided by this package.

DETAIL:

The main item of this module is the SyntaxMgr it is a singleton object that manages the dynamic importing of syntax data and configurations for all of the editors supported languages. It allows only the needed data to be loaded into memory when requested. The loading is only done once per session and all subsequent requests share the same object.

In addition to the SyntaxMgr there are also a number of other utility and convienience functions in this module for accessing data from other related objects such as the Extension Register.


Author: Cody Precord <cprecord@editra.org>

Classes
  SyntaxMgr
Class Object for managing loaded syntax data.
Functions
 
GenFileFilters()
Generates a list of file filters
wx.Menu
GenLexerMenu()
Generates a menu of available syntax configurations
string
GetExtFromId(ext_id)
Takes a language ID and fetches an appropriate file extension string
 
GetIdFromExt(ext)
Get the language id from the given file extension
 
GetLexerList()
Gets a list of unique file lexer configurations available
 
GetTypeFromExt(ext)
Get the filetype description string from the given extension.
 
SyntaxIds()
Gets a list of all Syntax Ids and returns it
Variables
  COMMENT = 5
  KEYWORDS = 0
  LANGUAGE = 4
  LANG_ID = 0
  LEXER = 1
  LEXER_ID = 1
  MODULE = 2
  PROPERTIES = 3
  SYNSPEC = 2
  __revision__ = '$Revision: 50787 $'
  __svnid__ = '$Id: syntax.py 50787 2007-12-18 07:45:00Z CJP $'
Function Details

GenFileFilters()

 

Generates a list of file filters

Returns:
list of all file filters based on exentsion associations

GenLexerMenu()

 

Generates a menu of available syntax configurations

Returns: wx.Menu
alphabetically ordered menu of of all lexer settings

GetExtFromId(ext_id)

 

Takes a language ID and fetches an appropriate file extension string

Parameters:
  • ext_id - language id to get extension for
Returns: string
file extension

GetIdFromExt(ext)

 

Get the language id from the given file extension

Parameters:
  • ext - file extension (no dot)
Returns:
language identifier id from extension register

GetLexerList()

 

Gets a list of unique file lexer configurations available

Returns:
list of all lexer identifiers

GetTypeFromExt(ext)

 

Get the filetype description string from the given extension. The return value defaults to synglob.LANG_TXT if nothing is found.

Parameters:
  • ext - file extension string (no dot)
Returns:
String

SyntaxIds()

 

Gets a list of all Syntax Ids and returns it

Returns:
list of all syntax language ids