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; select cast(plunk as timestamp) from blarg join plarg using(id_what) where x = 3;
EOT EOT
#@@:string:mode_sql.Sql
my $foo = { my $foo = {
#@@:string:mode_sql.Sql
'drop table ', 'drop table ',
'bar', 'bar',
}; };

View File

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

View File

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