#1824 LexCPP Incorrectly Handles Rawstrings and Line Continuations ('\')

Bug
closed-fixed
5
2016-04-26
2016-04-22
active-m
No

With lexer.cpp.backquoted.strings enabled and the following string:

1 `foo\
2  bar`
3 plain text

Line 3 will not highlight as plain text AFTER moving to the beginning of Line 2 and pressing the spacebar or inserting any other character. (It will highlight as a raw string instead.) This appears to be the case due to the line continuation handling not propagating the rawStringTerminator to the next line. The patch below (authored by ActiveState) fixes this.

Around line 758

        // Handle line continuation generically.
        if (sc.ch == '\\') {
            if (static_cast<int>((sc.currentPos+1)) >= lineEndNext) {
                lineCurrent++;
                lineEndNext = styler.LineEnd(lineCurrent);
                vlls.Add(lineCurrent, preproc);
+       if (rawStringTerminator != "") {
+           rawSTNew.Set(lineCurrent-1, rawStringTerminator);
+       }
                sc.Forward();
                if (sc.ch == '\r' && sc.chNext == '\n') {
                    // Even in UTF-8, \r and \n are separate
                    sc.Forward();
                }
                continuationLine = true;
                sc.Forward();
                continue;
            }
        }

Discussion

  • Neil Hodgson

    Neil Hodgson - 2016-04-22
    • labels: --> scintilla, lexer, cpp
    • status: open --> open-fixed
    • assigned_to: Neil Hodgson
     
  • Neil Hodgson

    Neil Hodgson - 2016-04-26
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks