ludwigpacifici / modern-cpp-font-lock

C++ font-lock for Emacs
https://melpa.org/#/modern-cpp-font-lock
GNU General Public License v3.0
168 stars 11 forks source link

trouble with string literals #25

Open kookjr opened 5 years ago

kookjr commented 5 years ago

I'm using stock Ubuntu 18.04. I creates a simple setup without any of my init, and I cannot get the color of this small c++ program to work correctly.

#include <string>
std::string a = R"raw(Hi there I'm a Qoute " guy)raw";
int main(){}

Everything after the end double quote on line 2 is colored as if it were inside a string. It does not seem to recognize the double quote before guy as being inside the string.

I'm running emacs like this:

emacs -q --load testinit.el

the contents of my init file (testinit.el) are:

(add-to-list 'load-path "/home/mat/tmp/cppfl/modern-cpp-font-lock")
(require 'modern-cpp-font-lock)
(modern-c++-font-lock-global-mode t)

I've cloned a copy or your repo here, at revision 02f104701b. The test directory, /home/mat/tmp/cppfl, looks like:

a.out
modern-cpp-font-lock/
t.cpp
t.cpp~
testinit.el

I'm on emacs 25.2.2.

oschonrock commented 4 years ago

Not sure if related, but similarly for this:

     constexpr auto operator""m(unsigned long long l) { return quantity<metre, std::int64_t>(l); }                                                                                                                                                                                                                                                                  

which is trying to define a UDL in this library

https://github.com/mpusz/units

ludwigpacifici commented 4 years ago

Hello,

Thanks for the detailed issue. I had a quick look and I see no issue (correct me if I am wrong):

str

I use recent version of Emacs 28.

Have a look at https://github.com/ludwigpacifici/modern-cpp-font-lock/issues/20. It seems a similar issue and should be fixed in recent Emacs version.