Logo Search packages:      
Sourcecode: viewcvs 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 pytext. 
The returned value is a list of tuples, formatted like this:
	[('keyword', 0, 6, None), ('keyword', 11, 17, None), ('comment', 23, 53, None), etc. ]
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 replace
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 matchPat = "\|"
tuple matchRE = re.compile(matchPat)
string nonKeyPat = "\(^\|[^a-zA-Z0-9_.\"']\)"
string pat = "q[^\q\n]*\(\\\\[\000-\377][^\q\n]*\)*q"
tuple quotePat = replace(pat, "q", "'")
tuple tripleQuotePat = replace(pat, "q", "'")

Generated by  Doxygen 1.6.0   Back to index