aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKåre Särs <[email protected]>2015-07-17 08:12:08 +0300
committerKåre Särs <[email protected]>2015-07-17 08:18:58 +0300
commitc76f452b8a913860ea6a26c18c23a3ef90db2e99 (patch)
tree08d54117ab63a2c9f7f6f59392a7a4ec08bb16f4
parent95d13839393a6b9eb23852bc753610b487499b3c (diff)
Fix symbolviewer cpp_parser failing on escaped quote in string.
Thanks to [email protected] for the KDE 4 patch. + add a test case in the test file. BUG: 350252
-rw-r--r--addons/symbolviewer/cpp_parser.cpp5
-rw-r--r--addons/symbolviewer/testfile.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/addons/symbolviewer/cpp_parser.cpp b/addons/symbolviewer/cpp_parser.cpp
index 1ba4070..362b5e0 100644
--- a/addons/symbolviewer/cpp_parser.cpp
+++ b/addons/symbolviewer/cpp_parser.cpp
@@ -187,7 +187,10 @@ void KatePluginSymbolViewerView::parseCppSymbols(void)
{
if ( ((j+1) < cl.length()) && (cl.at(j) == QLatin1Char('/') && (cl.at(j + 1) == QLatin1Char('*')) && comment != 3)) comment = 2;
if ( ((j+1) < cl.length()) && (cl.at(j) == QLatin1Char('*') && (cl.at(j + 1) == QLatin1Char('/')) && comment != 3) )
- { comment = 0; j+=2; if (j>=cl.length()) break;}
+ { comment = 0; j+=2; if (j>=cl.length()) break;}
+ if ( ((j+1) < cl.length()) && (cl.at(j) == QLatin1Char('\\') && (cl.at(j + 1) == QLatin1Char('"')) && comment == 3) )
+ { j+=2; if (j>=cl.length()) break;}
+
// Handles a string. Those are freaking evilish !
if (cl.at(j) == QLatin1Char('"') && comment == 3) { comment = 0; j++; if (j>=cl.length()) break;}
else if (cl.at(j) == QLatin1Char('"') && comment == 0) comment = 3;
diff --git a/addons/symbolviewer/testfile.c b/addons/symbolviewer/testfile.c
index 4944f20..8bc4cc0 100644
--- a/addons/symbolviewer/testfile.c
+++ b/addons/symbolviewer/testfile.c
@@ -56,4 +56,6 @@ RockType *
}
}
- }
+// Test escaped quote
+void test() { printf("foo \"\n"); }
+void test2() { printf("foo \"\n"); }