Sublime Forum

C++ Syntax Bug: Breaking syntax parser on specific string characters

#1

Hello,

I have encountered the following bug. If >> characters are inside a string literal, the C++ syntax parser breaks and the list of functions (Ctrl+R) is not available anymore.

try {

} catch (const std::exception& er) {
std::cerr << ">> Caught exception \n";
} catch (...) {
std::cerr << ">> Caught wildcard exception \n";
}
0 Likes

#2

Which version of Sublime Text are you using? Are you using the default C++ syntax?

0 Likes

#3

I am using version 3.2.2, Build 3211. Yes, the default C++ syntax AFAIK.

0 Likes

#4

This seems to have already been fixed for Sublime Text 4, see https://github.com/sublimehq/Packages/issues/2042. You should be able to override the default C++ syntax with the updated one from that repository if you require the fix.

0 Likes

#5

Thanks for your reply.

What is the syntax file I have to replace? I can see that I have cache and rcache files on my drive but I don’t have any sublime-syntax file (without .cache extension)

~/.config/sublime-text-3/Cache/C++/C++.sublime-syntax.cache
~/.config/sublime-text-3/Cache/C++/C++.sublime-syntax.rcache

0 Likes

#6

~/.config/sublime-text-3/Packages/C++/C++.sublime-syntax create it if it doesn’t exist.

Or via PackageResourceViewer: Edit Package Resource provided by PackageResourceViewer.

0 Likes