]>
git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/lib/editor/tokenizer.py
7 Simple class to create a list of token-tuples like:
9 (type, string, first, last)
12 t = Tokenizer('def hallo(du): # juchee')
16 def __init__(self
, text
):
20 tokenize(self
.readline
, self
.get
)
27 def get(self
, type, string
, begin
, end
, l
):
31 tname
= tok_name
[type]
34 self
.toks
.append(tname
, string
, b
, e
)
44 for type, string
, begin
, end
in self
.toks
:
45 if (pre
in ["NAME","KEY"]) and (not string
in [".",",","("]):
48 if type in ["NAME","KEY"]:
51 if string
in [",",":"]:
52 out
= out
+ string
+ " "