#1454 R" stops syntax highlighting for C, C++

Bug
closed-fixed
Neil Hodgson
5
2014-08-25
2013-03-15
froschbrocken
No

The combination of characters R" (i.e. a capital R followed by a quote) prevents the rest of the file from being syntax highlighted in C and C++ language modes, as demonstrated in this short C program:

#include <stdio.h>

#define R "buggy"

int main()
{
printf("Hello, "R" world!\n");
// this comment is no longer syntax highlighted!

return 0;
}

This has been observed on SciTE v3.2.5.

Discussion

<< < 1 2 (Page 2 of 2)
  • froschbrocken
    froschbrocken
    2013-03-18

    The quote character has to be removed from the beginning, and I removed the end for clearness:

    [^\w](u|u8|U|L)?R"
    

    In plain words: The only allowed character sequences before the "R" are "u", "u8", "U" or "L". Everything else before it must not be an alphanumeric characer, otherwise it may not be treated as a raw string.

     
  • Neil Hodgson
    Neil Hodgson
    2013-03-18

    Is there an actual problem with the ABCR example with the updated Scintilla?

    There could be a C-only mode but that could hide potential bugs when a file is reused as C++. Particularly a problem for headers.

     
  • froschbrocken
    froschbrocken
    2013-03-18

    I cannot try since I haven't built Scintilla from source. Have you tried it?

     
    • Neil Hodgson
      Neil Hodgson
      2013-03-18

      Looks fine to me. I haven't been able to work out what the difference is to the current behaviour that you are trying to convey with the regex.

       
  • froschbrocken
    froschbrocken
    2013-03-18

    Oh, you are right! Didn't realize that the ABCR example already worked in the released version. Was confused, because in Notepad++ it did not work. However, thanks for the fix!

     
  • Neil Hodgson
    Neil Hodgson
    2013-04-01

    • status: open --> closed-fixed
     
<< < 1 2 (Page 2 of 2)