aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-10-12 01:09:34 +0200
committerMattias Andrée <maandree@operamail.com>2014-10-12 01:09:34 +0200
commitc66400b2f1566088f508cd04758956761876515b (patch)
tree93155328e33a26f3e2d8879b65a94f2ba78ff8f2 /src
parentupdate dist (diff)
downloadgpp-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 'src')
-rwxr-xr-xsrc/gpp.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gpp.py b/src/gpp.py
index cd3910b..7d3f4f0 100755
--- a/src/gpp.py
+++ b/src/gpp.py
@@ -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)