Logo Search packages:      
Sourcecode: viewvc version File versions  Download package

PyFontify Namespace Reference

Detailed Description

Module to analyze Python source code; for syntax coloring tools.


    tags = fontify(pytext, searchfrom, searchto)

The PYTEXT argument is a string containing Python source code.  The
(optional) arguments SEARCHFROM and SEARCHTO may contain a slice in

The returned value is a list of tuples, formatted like this:

    [('keyword', 0, 6, None),
     ('keyword', 11, 17, None),
     ('comment', 23, 53, None),
The tuple contents are always like this:

    (tag, startindex, endindex, sublist)
TAG is one of 'keyword', 'string', 'comment' or 'identifier'
SUBLIST is not used, hence always None.


def fontify
def test


string __version__ = "0.3.1"
string commentPat = "#.*"
string idKeyPat = "[ \t]*[A-Za-z_][A-Za-z_0-9.]*"
tuple idRE = re.compile(idKeyPat)
string keyPat = "("
list keywordsList
string nonKeyPat = "(^|[^a-zA-Z0-9_.\"'])"
string pat = "q[^q\\n]*(\\[\000-\377][^q\\n]*)*q"
tuple quotePat = string.replace(pat, "q", "'")
 syntaxPat = keyPat+\
tuple syntaxRE = re.compile(syntaxPat)
tuple tripleQuotePat = string.replace(pat, "q", "'")

Generated by  Doxygen 1.6.0   Back to index