]> git.lyx.org Git - features.git/commitdiff
tex2lyx/Parser.cpp: fix bug #4468: single '\' are allowed in the special case of...
authorUwe Stöhr <uwestoehr@lyx.org>
Sat, 23 Jun 2012 18:00:49 +0000 (20:00 +0200)
committerUwe Stöhr <uwestoehr@lyx.org>
Sat, 23 Jun 2012 18:00:49 +0000 (20:00 +0200)
src/tex2lyx/Parser.cpp

index 20f5058901e163d9ab7f54eece6a73b0b31e1cd3..5d0335ac82143e61fff34a4aaf99c1e172ab56fa 100644 (file)
@@ -398,7 +398,14 @@ Parser::Arg Parser::getFullArg(char left, char right)
        if (c != left) {
                putback();
                return make_pair(false, string());
-       } else
+       } else {
+               // in case of the '+' as delimiter single a '\' is allowed
+               // as content, for example "\verb+\+" (reported as bug #4468)
+               // we need special handling because single \ are normally ignored
+               // or taken as start of a command
+               if (c == '+')
+                       if (next_token().cat() == catEscape)
+                               result += '\\';
                while ((c = getChar()) != right && good()) {
                        // Ignore comments
                        if (curr_token().cat() == catComment) {
@@ -408,7 +415,7 @@ Parser::Arg Parser::getFullArg(char left, char right)
                        else
                                result += curr_token().asInput();
                }
-
+       }
        return make_pair(true, result);
 }