ok, support for nested regions is as good as it is likely to get in the next week

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-07-18 14:21:34 +00:00
parent 5c095c0971
commit 1551555d85
3 changed files with 32 additions and 21 deletions

View File

@ -13,8 +13,8 @@ drop table foog;
select cast(plunk as timestamp) from blarg join plarg using(id_what) where x = 3;
EOT
#@@:string:mode_sql.Sql
my $foo = {
#@@:string:mode_sql.Sql
'drop table ',
'bar',
};

View File

@ -463,13 +463,18 @@ class DumpTokens(Method):
lines.append("LINE %d" % i)
group = tokens[i]
for token in group:
coord = '(%d, %d)' % (token.x, token.y)
fqname = token.fqname()
p1 = Point(token.x, token.y)
if token.parent is None:
pcoord = ''
else:
pcoord = '[%d, %d]' % (token.parent.x, token.parent.y)
fields = (coord, pcoord, token.fqname(), token.string)
lines.append(' %-10s %-10s %-30s %r' % fields)
if fqname in w.mode.ghist and p1 in w.mode.ghist[fqname]:
g = '[' + w.mode.ghist[fqname][p1].name() + ']'
else:
g = ''
fields = (str(p1), pcoord, token.fqname(), g, token.string)
lines.append(' %-10s %-10s %-20s %-10s %r' % fields)
else:
lines.append("no tokens")
output = "\n".join(lines)

View File

@ -216,15 +216,21 @@ class Fundamental(Handler):
xdelta = len(newlines[-1])
ghist = {}
for name in self.ghist:
for p2 in self.ghist[name]:
if p2.y > p.y:
newp = Point(p2.x, p2.y + ydelta)
for gp in self.ghist[name]:
if gp < p:
newp = gp
elif ydelta == 0:
newp = Point(p2.x + xdelta, p2.y)
if p.y == gp.y:
newp = Point(gp.x + xdelta, gp.y)
else:
newp = gp
else:
newp = Point(p2.x, p2.y + ydelta)
if gp.y == p.y:
newp = Point(gp.x + xdelta, gp.y + ydelta)
else:
newp = Point(gp.x, gp.y + ydelta)
ghist.setdefault(name, {})
ghist[name][newp] = self.ghist[name][p2]
ghist[name][newp] = self.ghist[name][gp]
self.ghist = ghist
def region_removed(self, p1, p2):
if self.tabber is not None:
@ -234,21 +240,21 @@ class Fundamental(Handler):
xdelta = p2.x - p1.x
ghist = {}
for name in self.ghist:
for p in self.ghist[name]:
if p < p1:
newp = p
elif p1 <= p and p < p2:
for gp in self.ghist[name]:
if gp < p1:
newp = gp
elif p1 <= gp and gp < p2:
continue
elif ydelta == 0:
if p.y == p2.y:
newp = Point(p.x - xdelta, p.y)
if gp.y == p2.y:
newp = Point(gp.x - xdelta, gp.y)
else:
newp = p
newp = gp
else:
if p.y == p2.y:
newp = Point(p.x - xdelta, p.y - ydelta)
if gp.y == p2.y:
newp = Point(gp.x - xdelta, gp.y - ydelta)
else:
newp = Point(p.x, p.y - ydelta)
newp = Point(gp.x, gp.y - ydelta)
ghist.setdefault(name, {})
ghist[name][newp] = self.ghist[name][p]
ghist[name][newp] = self.ghist[name][gp]
self.ghist = ghist