Possible bug with c++ syntax highlighting

I am unable to work out why the syntax highlighting is breaking for https://gitlab.com/n-ham-paper-files/lattice-path-algorithms/blob/master/algorithms.h on line 469, whatever is doing the syntax highlighting seems to be getting confused about what is and what is not a string. From what I can tell, the problem appears to begin in the middle of the string “) {$A_” on line 469 (even though exactly the same string is handled fine on line 467). Though the if on line 468 is in red too, which is weird, can anyone explain why that is happening?

I do not have any problems with the syntax highlighting locally in code::blocks, and have no problems compiling/running the code as part of a project. Though it’s also possible that there’s something wrong on my end causing the problem. I’m hoping someone on here might be able to identify what the problem is, whether there’s a bug with syntax highlighting, a problem on my end, or…

I have uploaded the same code to github (https://github.com/n-ham/testrep/blob/master/algorithms.h) and github has no problem with the syntax highlighting, making me think it is likely a problem with the syntax highlighting for gitlab. Does anyone know where to report bugs with syntax highlighting?

I am planning to reference this code online with a paper I’m a coauthor on, so having the syntax highlighting broken is quite undesirable. Being able to use LaTeX equations in the read me file for the repository is very useful too, so I can’t just use github (as I am pretty sure you cannot use LaTeX equations in read me files on github easily?).

Thanks for reporting this. In general terms, feel free to file any issues you encounter with GitLab here:

For this particular one, I’d suggest having a look at the documentation about syntax highlighting:

Two things from there:

  • GitLab provides syntax highlighting on all files and snippets through the Rouge rubygem. It might be a bug in Rouge, so perhaps you can raise it there too.
  • You can perhaps use the .gitattributes file to explicitly set the syntax of your files, in case they were not correctly detected as C++