[geany/geany] 5a279f: c++: Fix parsing of prefixed C++11 raw string literals

Colomban Wendling git-noreply at xxxxx
Thu Feb 11 14:36:05 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sun, 24 Jan 2016 16:33:32 UTC
Commit:      5a279f0bf6cb94eccaadc8b6a947c4553ff1e634
             https://github.com/geany/geany/commit/5a279f0bf6cb94eccaadc8b6a947c4553ff1e634

Log Message:
-----------
c++: Fix parsing of prefixed C++11 raw string literals

See http://en.cppreference.com/w/cpp/language/string_literal


Modified Paths:
--------------
    tagmanager/ctags/get.c
    tests/ctags/cxx11-raw-strings.cpp
    tests/ctags/cxx11-raw-strings.cpp.tags

Modified: tagmanager/ctags/get.c
6 lines changed, 5 insertions(+), 1 deletions(-)
===================================================================
@@ -802,8 +802,12 @@ extern int cppGetc (void)
 					 *
 					 * which is perfectly valid (yet probably very unlikely). */
 					int prev = fileGetNthPrevC (1, 0);
+					int prev2 = fileGetNthPrevC (2, 0);
+					int prev3 = fileGetNthPrevC (3, 0);
 
-					if (! isident (prev))
+					if (! isident (prev) ||
+					    (! isident (prev2) && (prev == 'L' || prev == 'u' || prev == 'U')) ||
+					    (! isident (prev3) && (prev2 == 'u' && prev == '8')))
 					{
 						int next = fileGetc ();
 						if (next != DOUBLE_QUOTE)


Modified: tests/ctags/cxx11-raw-strings.cpp
13 lines changed, 13 insertions(+), 0 deletions(-)
===================================================================
@@ -19,3 +19,16 @@ struct typ2 { int memb2; };
 static const char* str3 = FOUR"f(iv)e";
 
 struct typ3 { int memb3; };
+
+/* check for prefixes */
+static const char* str4 = LR"blah(";int bug4;)blah";
+struct typ4 { int memb4; };
+
+static const char* str5 = u8R"blah(";int bug5;)blah";
+struct typ5 { int memb5; };
+
+static const char* str6 = uR"blah(";int bug6;)blah";
+struct typ6 { int memb6; };
+
+static const char* str7 = UR"blah(";int bug7;)blah";
+struct typ7 { int memb7; };


Modified: tests/ctags/cxx11-raw-strings.cpp.tags
12 lines changed, 12 insertions(+), 0 deletions(-)
===================================================================
@@ -3,9 +3,21 @@ FOUR
 memb1�64�typ1�0�int
 memb2�64�typ2�0�int
 memb3�64�typ3�0�int
+memb4�64�typ4�0�int
+memb5�64�typ5�0�int
+memb6�64�typ6�0�int
+memb7�64�typ7�0�int
 str1�16384�0�char
 str2�16384�0�char
 str3�16384�0�char
+str4�16384�0�char
+str5�16384�0�char
+str6�16384�0�char
+str7�16384�0�char
 typ1�2048�0
 typ2�2048�0
 typ3�2048�0
+typ4�2048�0
+typ5�2048�0
+typ6�2048�0
+typ7�2048�0



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list