From af3ce62c2d4ee2bd148d25079dd5962f1f07a218 Mon Sep 17 00:00:00 2001 From: Mark Shoulson Date: Mon, 18 May 2009 21:58:39 -0400 Subject: Another rewrite of scan4dups to fix things still being missed. Added NABLA and INTEGRAL: how did we ever manage without them?? --- dotXCompose | 7 +++++++ scan4dups.py | 44 ++++++++++++++++++++++++++------------------ 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/dotXCompose b/dotXCompose index ce67240..73f0df2 100644 --- a/dotXCompose +++ b/dotXCompose @@ -52,6 +52,10 @@ include "%L" : "↕" U2195 # UP DOWN ARROW (kragen's) : "↵" U21B5 # DOWNWARDS ARROW WITH CORNER LEFTWARDS +# Arrow keys don't always work: some apps trap them for cursor control and +# other boring things. The arrow symbols have alternate keystrokes. Do +# we need others for these printer's fists? If so, what? The -= and =- +# we had before are not necessarily the best choices. : "☚" U261A # BLACK LEFT POINTING INDEX : "☛" U261B # BLACK RIGHT POINTING INDEX : "☜" U261C # WHITE LEFT POINTING INDEX @@ -150,6 +154,9 @@ include "%L" : "∴" U2234 # THEREFORE : "∵" U2235 # BECAUSE : "‱" U2031 # PER TEN THOUSAND (basis points) +# OK, absolutely cannot believe we made it this long without NABLA or INTEGRAL + : "∇" U2207 # NABLA + : "∫" U222B # INTEGRAL : "⃗" U20D7 # COMBINING RIGHT ARROW ABOVE (vector) # There's a whole passel of these guys starting at U+1D538 but I have no fonts for those. : "ℂ" U2102 # DOUBLE-STRUCK CAPITAL C (set of complex numbers) diff --git a/scan4dups.py b/scan4dups.py index f504623..00aef78 100644 --- a/scan4dups.py +++ b/scan4dups.py @@ -19,33 +19,41 @@ try: break word=m.group(1) name+=' '+word - if listing.has_key(name): - dupsfound.append(name) startpos+=m.end() if startpos<=0: continue m=re.match(r'[^"]*"(.+)"',line) if not m: # shouldn't happen, but just in case - listing[name]='???' + val='???' print "couldn't make sense of line: "+line else: - listing[name]=m.group(1) - # THIS IS STILL FAULTY. - # What if a long one comes through first, and then a short one? - # - # Probably have to do two passes: record them all in the hash - # (and check for exact duplicates), then go though all the - # keys and check all their prefixes. - for i in dupsfound: - if listing[name]==listing[i]: - msg="Redundant definition: " + val=m.group(1) + if listing.has_key(name): + if val != listing[name]: + print "Exact conflict found: (%s )[%s][%s]"%(name, + listing[name], val) else: - msg="Prefix conflict found: " - print msg+"(%s )[%s] vs (%s )[%s]"% \ - (name, listing[name], i, listing[i]) + print "Redundant definition: (%s )[%s]"%(name, val) + else: + listing[name]=val except StopIteration: print "hit end" - pass -print "Done." +# NOW check for prefix conflicts: +print "Checking prefixes." +for key in listing.keys(): + # print "Key: (%s)"%key + pref='' + # Careful when splitting. They key always starts with a space. + for word in key.split(" ")[:-1]: # chop the last one; that'll always match. + # Skip the empty first entry + if not word: + continue + pref+=" "+word + # print "checking (%s)"%pref + if listing.has_key(pref): + print "Prefix conflict found: " \ + "(%s )[%s] vs (%s )[%s]"%(pref, listing[pref], + key, listing[key]) + -- cgit v1.2.3