Skip to content

Commit

Permalink
[JavaScript] Minor update line continuation handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Oct 9, 2024
1 parent 957001c commit 2714853
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scintilla/lexers/LexCoffeeScript.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position lengthDoc, in
prevLineContinuation = (styler.GetLineState(sc.currentLine - 2) & PyLineStateLineContinuation) != 0;
lineState = styler.GetLineState(sc.currentLine - 1);
prevIndentCount = lineState >> 16;
lineContinuation= (lineState & PyLineStateLineContinuation) != 0;
lineContinuation = (lineState & PyLineStateLineContinuation) != 0;
lineState = 0;
}
if (startPos != 0 && IsSpaceEquiv(initStyle)) {
Expand Down
2 changes: 1 addition & 1 deletion scintilla/lexers/LexHaskell.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void ColouriseHaskellDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int ini
if (sc.currentLine > 0) {
lineState = styler.GetLineState(sc.currentLine - 1);
commentLevel = (lineState >> 8) & 0xff;
lineContinuation= (lineState & PyLineStateLineContinuation) != 0;
lineContinuation = (lineState & PyLineStateLineContinuation) != 0;
lineState &= HaskellLineStatePragma;
}

Expand Down
4 changes: 3 additions & 1 deletion scintilla/lexers/LexJavaScript.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ void ColouriseJsDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyl
}
if (sc.ch == '\\') {
if (IsEOLChar(sc.chNext)) {
lineContinuation = JsLineStateLineContinuation;
if (sc.state != SCE_JS_STRING_BT) {
lineContinuation = JsLineStateLineContinuation;
}
} else {
escSeq.resetEscapeState(sc.state, sc.chNext);
sc.SetState(SCE_JS_ESCAPECHAR);
Expand Down
2 changes: 1 addition & 1 deletion scintilla/lexers/LexOCaml.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void ColouriseOCamlDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int initS
if (sc.currentLine > 0) {
lineState = styler.GetLineState(sc.currentLine - 1);
commentLevel = (lineState >> 8) & 0xff;
lineContinuation= (lineState & PyLineStateLineContinuation) != 0;
lineContinuation = (lineState & PyLineStateLineContinuation) != 0;
lineState = 0;
}

Expand Down
6 changes: 4 additions & 2 deletions scintilla/lexers/LexPHP.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,9 @@ void PHPLexer::HighlightJsInnerString() {
}
if (sc.ch == '\\') {
if (IsEOLChar(sc.chNext)) {
lineContinuation = JsLineStateLineContinuation;
if (sc.state != js_style(SCE_JS_STRING_BT)) {
lineContinuation = JsLineStateLineContinuation;
}
} else {
escSeq.resetEscapeState(sc.state, sc.chNext);
sc.SetState(js_style(SCE_JS_ESCAPECHAR));
Expand Down Expand Up @@ -1339,7 +1341,7 @@ void ColourisePHPDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int initSty
docTagState = DocTagState::None;
const int chNext = sc.chNext;
sc.SetState((chNext == '*') ? js_style(SCE_JS_COMMENTBLOCK) : js_style(SCE_JS_COMMENTLINE));
if (chNext== '*') {
if (chNext == '*') {
sc.Forward(2);
if (sc.ch == '*' && sc.chNext != '*') {
sc.ChangeState(js_style(SCE_JS_COMMENTBLOCKDOC));
Expand Down
2 changes: 1 addition & 1 deletion scintilla/lexers/LexPython.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ void ColourisePyDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyl
lineState = styler.GetLineState(sc.currentLine - 1);
parenCount = (lineState >> 8) & 0xff;
prevIndentCount = lineState >> 16;
lineContinuation= (lineState & PyLineStateLineContinuation) != 0;
lineContinuation = (lineState & PyLineStateLineContinuation) != 0;
lineState = 0;
}
if (startPos != 0 && IsSpaceEquiv(initStyle)) {
Expand Down

0 comments on commit 2714853

Please sign in to comment.