diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-10-12 01:09:34 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-10-12 01:09:34 +0200 |
commit | c66400b2f1566088f508cd04758956761876515b (patch) | |
tree | 93155328e33a26f3e2d8879b65a94f2ba78ff8f2 | |
parent | update dist (diff) | |
download | gpp-c66400b2f1566088f508cd04758956761876515b.tar.gz gpp-c66400b2f1566088f508cd04758956761876515b.tar.bz2 gpp-c66400b2f1566088f508cd04758956761876515b.tar.xz |
how did I miss testing that it still worked with non-ASCII
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rwxr-xr-x | src/gpp.py | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -155,8 +155,11 @@ def pp(line): esc = False dollar = False quote = [] - for i in range(len(line)): + n = len(line) + i = 0 + while i < n: c = line[i] + i += 1 if brackets > 0: if esc: esc = False @@ -180,8 +183,9 @@ def pp(line): rc.append(ord('"')) rc.append(ord('$')) rc.append(c) - elif line[i : i + symlen] == symbol: + elif line[i - 1 : i + symlen - 1] == symbol: symb = True + i += symlen - 1 elif len(quote) > 0: if esc: esc = False @@ -214,7 +218,7 @@ for _ in range(iterations): for lineno in range(len(data)): line = data[lineno] if (len(line) > symlen) and (line[:symlen] == symbol) and (line[symlen] in (ord('<'), ord('>'))): - bashed.append(line[2:]) + bashed.append(line[symlen + 1:]) entered = line[symlen] == ord('<') elif entered: bashed.append(line) |