aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-02-13 08:46:05 +0100
committerMattias Andrée <maandree@kth.se>2017-02-13 08:46:11 +0100
commitab273d8948d88df7269358973f8151513b00a40f (patch)
tree2a5695352cbf4615d78ea57dc994df5bb2d06bd8
parentupdate dist (diff)
downloadgpp-ab273d8948d88df7269358973f8151513b00a40f.tar.gz
gpp-ab273d8948d88df7269358973f8151513b00a40f.tar.bz2
gpp-ab273d8948d88df7269358973f8151513b00a40f.tar.xz
Fix -n and escaped symbols
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--COPYING2
-rw-r--r--doc/man/gpp.12
-rwxr-xr-xsrc/gpp.py12
3 files changed, 9 insertions, 7 deletions
diff --git a/COPYING b/COPYING
index 63a681e..0054035 100644
--- a/COPYING
+++ b/COPYING
@@ -1,6 +1,6 @@
gpp – Bash-based general-purpose preprocessor
-Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+Copyright © 2013, 2014, 2015, 2017 Mattias Andrée (maandree@member.fsf.org)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/doc/man/gpp.1 b/doc/man/gpp.1
index d64ef9d..d7ba2e5 100644
--- a/doc/man/gpp.1
+++ b/doc/man/gpp.1
@@ -123,7 +123,7 @@ Full documentation available locally via: info \(aq(gpp)\(aq
Principal author, Mattias Andrée. See the COPYING file for the full
list of authors.
.SH LICENSE
-Copyright \(co 2013, 2014, 2015 Mattias Andrée
+Copyright \(co 2013, 2014, 2015, 2017 Mattias Andrée
.br
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
.br
diff --git a/src/gpp.py b/src/gpp.py
index ce35380..7d537fe 100755
--- a/src/gpp.py
+++ b/src/gpp.py
@@ -3,7 +3,7 @@
copyright = '''
gpp – Bash-based general-purpose preprocessor
-Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+Copyright © 2013, 2014, 2015, 2017 Mattias Andrée (maandree@member.fsf.org)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -93,7 +93,7 @@ if iterations < 1:
data = None
with open(input_file, 'rb') as file:
data = file.read()
- with open(write_file, 'wb') as file:
+ with open(output_file, 'wb') as file:
file.write(data)
file.flush()
sys.exit(0)
@@ -178,6 +178,11 @@ def pp(line):
elif c == ord('\\'):
esc = True
rc.append(c)
+ elif line[i - 1 : i + symlen - 1] == symbol:
+ if symb:
+ rc += symbol
+ symb = not symb
+ i += symlen - 1
elif symb:
symb = False
if c in (ord('('), ord('{')):
@@ -192,9 +197,6 @@ def pp(line):
rc.append(ord('\\'))
rc.append(c)
rc.append(c)
- elif line[i - 1 : i + symlen - 1] == symbol:
- symb = True
- i += symlen - 1
elif c == ord('\''):
rc.append(c)
rc.append(ord('\\'))