From 477b082c859a0fae754ea6d2181525853c632879 Mon Sep 17 00:00:00 2001 From: Seth Heeren Date: Fri, 14 Dec 2012 23:55:42 +0100 Subject: [PATCH] Fix escape removal in SubstituteLexer This fixes subsitutions like :s/\\/\\\\/g :s/\\t/\\t/g --- vex/parsers/s_cmd.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vex/parsers/s_cmd.py b/vex/parsers/s_cmd.py index e218456..2538beb 100644 --- a/vex/parsers/s_cmd.py +++ b/vex/parsers/s_cmd.py @@ -36,13 +36,13 @@ def _match_pattern(self): if self.c == '\\': buf.append(self.c) self.consume() - if self.c in '\\': - # Don't store anything, we're escaping \. - self.consume() - elif self.c == self.delimiter: + if self.c == self.delimiter: # Overwrite the \ we've just stored. buf[-1] = self.delimiter self.consume() + if self.c in '\\': + buf.append(self.c) # BUGFIXED: still need to escape \ in python regex! + self.consume() if self.c == EOF: break