aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Shoulson <mark@kli.org>2009-05-14 16:23:09 -0400
committerMark Shoulson <mark@kli.org>2009-05-14 16:23:09 -0400
commita7af357841237c90348893b9724d36617b8864e4 (patch)
tree54f4d71251548178ff0733cdd507d3bfa50ef3f5
parentReconciled and regularized additions, added some more along the same lines (diff)
downloaddotXCompose-a7af357841237c90348893b9724d36617b8864e4.tar.gz
dotXCompose-a7af357841237c90348893b9724d36617b8864e4.tar.bz2
dotXCompose-a7af357841237c90348893b9724d36617b8864e4.zip
Rewrite of scan4dups so it's MUCH simpler and actually works for a change. A few fixes and additions. Need to ponder the dups.
-rw-r--r--dotXCompose9
-rw-r--r--scan4dups.py68
2 files changed, 27 insertions, 50 deletions
diff --git a/dotXCompose b/dotXCompose
index 803503e..b3d80b8 100644
--- a/dotXCompose
+++ b/dotXCompose
@@ -60,13 +60,13 @@ include "%L"
# For some logical statements. I prefer doubled arrows for implication.
<Multi_key> <equal> <greater> : "⇒" U21D2 # RIGHTWARDS DOUBLE ARROW
<Multi_key> <equal> <less> : "⇐" U21D0 # LEFTWARDS DOUBLE ARROW
-<Multi_key> <equal> <less> <minus> <equal> <greater> : "⇔" U21D4 # LEFT RIGHT DOUBLE ARROW
+<Multi_key> <less> <minus> <equal> <greater> : "⇔" U21D4 # LEFT RIGHT DOUBLE ARROW
<Multi_key> <equal> <Right> <Right> : "⇒" U21D2 # RIGHTWARDS DOUBLE ARROW
<Multi_key> <equal> <Left> <Left> : "⇐" U21D0 # LEFTWARDS DOUBLE ARROW
<Multi_key> <equal> <Left> <Right> : "⇔" U21D4 # LEFT RIGHT DOUBLE ARROW
<Multi_key> <equal> <Up> <Up> : "⇑" U21D1 # UPWARDS DOUBLE ARROW
<Multi_key> <equal> <Down> <Down> : "⇓" U21D3 # DOWNWARDS DOUBLE ARROW
-<Multi_key> <equal> <Up> <Up> : "⇕" U21D5 # UP DOWN DOUBLE ARROW
+<Multi_key> <equal> <Up> <Down> : "⇕" U21D5 # UP DOWN DOUBLE ARROW
# These are just too cool-looking not to have (if your font supports them)
<Multi_key> <equal> <period> <equal> : "⸎" U2E0E # EDITORIAL CORONIS
<Multi_key> <ampersand> <p> <a> <l> <m> : "⸙" U2E19 # PALM BRANCH
@@ -95,6 +95,7 @@ include "%L"
# MUCH is usually enough for me. No need for VERY.
<Multi_key> <plus> <less> : "≪" U226A # MUCH LESS-THAN
<Multi_key> <plus> <greater> : "≫" U226B # MUCH GREATER-THAN
+# Damn. That makes this conflict with the standard plus plus -> #
<Multi_key> <plus> <plus> <less> : "⋘" U22D8 # VERY MUCH LESS-THAN
<Multi_key> <plus> <plus> <greater> : "⋙" U22D9 # VERY MUCH GREATER-THAN
<Multi_key> <i> <n> : "∈" U2208 # ELEMENT OF
@@ -111,6 +112,8 @@ include "%L"
<Multi_key> <equal> <equal> : "≡" U2261 # IDENTICAL TO
# Using <slash> conflicts.
<Multi_key> <equal> <bar> <equal> : "≢" U2262 # NOT IDENTICAL TO
+# We already have ±
+<Multi_key> <minus> <plus> : "∓" U2213 # MINUS OR PLUS SIGN
<Multi_key> <s> <q> : "√" U221A # SQUARE ROOT
# “(Note: I had put the backslash in position 5/15. It enabled the
# ALGOL “and” to be “/\” and the “or” to be “\/”.)” --- Bob Bemer,
@@ -446,7 +449,7 @@ include "%L"
<Multi_key> <numbersign> <numbersign> : "♯" U266f # MUSIC SHARP SIGN
<Multi_key> <numbersign> <G> : "𝄞" U0001d11e # MUSICAL SYMBOL G CLEF
<Multi_key> <numbersign> <F> : "𝄢" U0001d122 # MUSICAL SYMBOL F CLEF
-<Multi_key> <numbersign> <C> : "𝄡 U0001d121 # MUSICAL SYMBOL C CLEF
+<Multi_key> <numbersign> <C> : "𝄡" U0001d121 # MUSICAL SYMBOL C CLEF
<Multi_key> <numbersign> <o> <slash> : "♪" U266a # EIGHTH NOTE
<Multi_key> <numbersign> <o> <o> : "♫" U266b # BEAMED EIGHTH NOTES
diff --git a/scan4dups.py b/scan4dups.py
index 80a5eb7..11bcebc 100644
--- a/scan4dups.py
+++ b/scan4dups.py
@@ -3,67 +3,41 @@
import sys
import re
-class node(dict):
- name=""
- parent=None
-# Top of tree:
-top=node()
-
-def name2leaf(ending):
- rv=""
- p=ending
- while p is not None:
- rv=p.name+" "+rv
- p=p.parent
- return rv
+listing={}
try:
while True:
line=sys.stdin.next()
# print "((%s))"%line
startpos=0
- ptr=top
+ name=''
dupsfound=[]
- lastAdded=None
while True:
m=re.match("\s*<(\w+)>",line[startpos:])
if not m:
break
word=m.group(1)
- # print "found word: %s"%word
- # Now, there is a prefix conflict if: (a) I am about to add an
- # element to an otherwise empty (i.e. terminal) directory (a
- # leaf), or (b) At the end of this element, the dictionary I
- # end on is *not* empty (i.e. NOT a leaf). We check (a) here,
- # and (b) after the loop.
- #
- # Waitasec, it's okay if I'm adding to a leaf *if I just added
- # that leaf*!
- if not ptr.keys() and ptr!=lastAdded and ptr!=top:
- dupsfound.append(name2leaf(ptr))
- try:
- next=ptr[word]
- except KeyError:
- next=node()
- next.parent=ptr
- next.name=word
- lastAdded=next
- ptr[word]=next
- ptr=next
+ name+=' '+word
+ if listing.has_key(name):
+ dupsfound.append(name)
startpos+=m.end()
- if startpos!=0: # Skip if the line had nothing.
- if ptr.keys(): # Dup if the end is NOT a leaf.
- # By rights I should follow each other key all the way
- # down to all its possible ends. Too much work. But
- # I will go one more down, OK?
- for other in ptr.keys():
- dupsfound.append(name2leaf(ptr[other])+"(+?)")
- # The (+?) is because there might be more after that.
- mystring=name2leaf(ptr)
- # print "processed: (%s)"%mystring
- for i in dupsfound:
- print "Prefix conflict found: (%s) vs (%s)"%(mystring, i)
+ if startpos<=0:
+ continue
+ m=re.match(r'[^"]*"(.+)"',line)
+ if not m:
+ # shouldn't happen, but just in case
+ listing[name]='???'
+ print "couldn't make sense of line: "+line
+ else:
+ listing[name]=m.group(1)
+ for i in dupsfound:
+ if listing[name]==listing[i]:
+ msg="Redundant definition: "
+ else:
+ msg="Prefix conflict found: "
+ print msg+"(%s )[%s] vs (%s )[%s]"% \
+ (name, listing[name], i, listing[i])
except StopIteration:
print "hit end"
pass