tex2lyx/Parser.cpp: fix bug #4468: single '\' are allowed in the special case of '+' as comment argument delimiter

This commit is contained in:
Uwe Stöhr 2012-06-23 20:00:49 +02:00
parent 46cdb3616c
commit 3943b887a8

View File

@ -398,7 +398,14 @@ Parser::Arg Parser::getFullArg(char left, char right)
if (c != left) { if (c != left) {
putback(); putback();
return make_pair(false, string()); 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()) { while ((c = getChar()) != right && good()) {
// Ignore comments // Ignore comments
if (curr_token().cat() == catComment) { if (curr_token().cat() == catComment) {
@ -408,7 +415,7 @@ Parser::Arg Parser::getFullArg(char left, char right)
else else
result += curr_token().asInput(); result += curr_token().asInput();
} }
}
return make_pair(true, result); return make_pair(true, result);
} }