diff options
author | Mark Shoulson <mark@kli.org> | 2009-05-18 21:58:39 -0400 |
---|---|---|
committer | Mark Shoulson <mark@kli.org> | 2009-05-18 21:58:39 -0400 |
commit | af3ce62c2d4ee2bd148d25079dd5962f1f07a218 (patch) | |
tree | 676de641a636d34c1b58992f584390636c9111c0 | |
parent | Comments on flaws remaining in scan4dups, some additional chars. (diff) | |
download | dotXCompose-af3ce62c2d4ee2bd148d25079dd5962f1f07a218.tar.gz dotXCompose-af3ce62c2d4ee2bd148d25079dd5962f1f07a218.tar.bz2 dotXCompose-af3ce62c2d4ee2bd148d25079dd5962f1f07a218.zip |
Another rewrite of scan4dups to fix things still being missed. Added NABLA and INTEGRAL: how did we ever manage without them??
-rw-r--r-- | dotXCompose | 7 | ||||
-rw-r--r-- | 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" <Multi_key> <Up> <Down> : "↕" U2195 # UP DOWN ARROW (kragen's) <Multi_key> <Down> <Left> : "↵" 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. <Multi_key> <F> <Left> : "☚" U261A # BLACK LEFT POINTING INDEX <Multi_key> <F> <Right> : "☛" U261B # BLACK RIGHT POINTING INDEX <Multi_key> <f> <Left> : "☜" U261C # WHITE LEFT POINTING INDEX @@ -150,6 +154,9 @@ include "%L" <Multi_key> <period> <quotedbl> : "∴" U2234 # THEREFORE <Multi_key> <quotedbl> <period> : "∵" U2235 # BECAUSE <Multi_key> <percent> <percent> : "‱" U2031 # PER TEN THOUSAND (basis points) +# OK, absolutely cannot believe we made it this long without NABLA or INTEGRAL +<Multi_key> <ampersand> <d> <e> <l> : "∇" U2207 # NABLA +<Multi_key> <ampersand> <i> <n> <t> : "∫" U222B # INTEGRAL <Multi_key> <asciicircum> <greater> : "⃗" 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. <Multi_key> <bar> <C> : "ℂ" 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]) + |