Back to index

python3.2  3.2.2
Classes | Functions | Variables
idlelib.ColorDelegator Namespace Reference

Classes

class  ColorDelegator

Functions

def any
def make_pat
def main

Variables

 DEBUG = False
tuple prog = re.compile(make_pat(), re.S)
tuple idprog = re.compile(r"\s+(\w+)", re.S)
tuple asprog = re.compile(r".*?\b(as)\b")

Function Documentation

def idlelib.ColorDelegator.any (   name,
  alternates 
)

Definition at line 11 of file ColorDelegator.py.

00011 
00012 def any(name, alternates):
00013     "Return a named group pattern matching list of alternates."
00014     return "(?P<%s>" % name + "|".join(alternates) + ")"

Here is the caller graph for this function:

Definition at line 250 of file ColorDelegator.py.

00250 
00251 def main():
00252     from idlelib.Percolator import Percolator
00253     root = Tk()
00254     root.wm_protocol("WM_DELETE_WINDOW", root.quit)
00255     text = Text(background="white")
00256     text.pack(expand=1, fill="both")
00257     text.focus_set()
00258     p = Percolator(text)
00259     d = ColorDelegator()
00260     p.insertfilter(d)
00261     root.mainloop()

Definition at line 15 of file ColorDelegator.py.

00015 
00016 def make_pat():
00017     kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b"
00018     builtinlist = [str(name) for name in dir(builtins)
00019                                         if not name.startswith('_')]
00020     # self.file = open("file") :
00021     # 1st 'file' colorized normal, 2nd as builtin, 3rd as string
00022     builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b"
00023     comment = any("COMMENT", [r"#[^\n]*"])
00024     sqstring = r"(\b[rRuU])?'[^'\\\n]*(\\.[^'\\\n]*)*'?"
00025     dqstring = r'(\b[rRuU])?"[^"\\\n]*(\\.[^"\\\n]*)*"?'
00026     sq3string = r"(\b[rRuU])?'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?"
00027     dq3string = r'(\b[rRuU])?"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?'
00028     string = any("STRING", [sq3string, dq3string, sqstring, dqstring])
00029     return kw + "|" + builtin + "|" + comment + "|" + string +\
00030            "|" + any("SYNC", [r"\n"])

Here is the call graph for this function:


Variable Documentation

Definition at line 33 of file ColorDelegator.py.

Definition at line 9 of file ColorDelegator.py.

tuple idlelib.ColorDelegator.idprog = re.compile(r"\s+(\w+)", re.S)

Definition at line 32 of file ColorDelegator.py.

Definition at line 31 of file ColorDelegator.py.