From: Alec Warner Date: Sun, 18 Jun 2006 23:42:29 +0000 (-0000) Subject: goodbye tokenize X-Git-Tag: v2.1.1~462 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=605c793707dc54215de85fd9d1072811f1d1100d;p=portage.git goodbye tokenize svn path=/main/trunk/; revision=3533 --- diff --git a/pym/portage.py b/pym/portage.py index 8503ec198..d7fb000d0 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -317,52 +317,6 @@ def listdir(mypath, recursive=False, filesonly=False, ignorecvs=False, ignorelis starttime=long(time.time()) -def tokenize(mystring): - """breaks a string like 'foo? (bar) oni? (blah (blah))' - into embedded lists; returns None on paren mismatch""" - - # This function is obsoleted. - # Use portage_dep.paren_reduce - - writemsg( output.red("!!! Tokenize is deprecated, please use portage_dep.paren_reduce.\n") ) - - newtokens=[] - curlist=newtokens - prevlists=[] - level=0 - accum="" - for x in mystring: - if x=="(": - if accum: - curlist.append(accum) - accum="" - prevlists.append(curlist) - curlist=[] - level=level+1 - elif x==")": - if accum: - curlist.append(accum) - accum="" - if level==0: - writemsg("!!! tokenizer: Unmatched left parenthesis in:\n'"+str(mystring)+"'\n") - return None - newlist=curlist - curlist=prevlists.pop() - curlist.append(newlist) - level=level-1 - elif x in string.whitespace: - if accum: - curlist.append(accum) - accum="" - else: - accum=accum+x - if accum: - curlist.append(accum) - if (level!=0): - writemsg("!!! tokenizer: Exiting with unterminated parenthesis in:\n'"+str(mystring)+"'\n") - return None - return newtokens - def flatten(mytokens): """this function now turns a [1,[2,3]] list into a [1,2,3] list and returns it."""