MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / synchronizeDocStart

Function synchronizeDocStart

scintilla/lexers/LexRuby.cxx:607–655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605// multi-line construct
606
607static void synchronizeDocStart(unsigned int& startPos,
608 int &length,
609 int &initStyle,
610 Accessor &styler,
611 bool skipWhiteSpace=false) {
612
613 styler.Flush();
614 int style = actual_style(styler.StyleAt(startPos));
615 switch (style) {
616 case SCE_RB_STDIN:
617 case SCE_RB_STDOUT:
618 case SCE_RB_STDERR:
619 // Don't do anything else with these.
620 return;
621 }
622
623 int pos = startPos;
624 // Quick way to characterize each line
625 int lineStart;
626 for (lineStart = styler.GetLine(pos); lineStart > 0; lineStart--) {
627 // Now look at the style before the previous line's EOL
628 pos = styler.LineStart(lineStart) - 1;
629 if (pos <= 10) {
630 lineStart = 0;
631 break;
632 }
633 char ch = styler.SafeGetCharAt(pos);
634 char chPrev = styler.SafeGetCharAt(pos - 1);
635 if (ch == '\n' && chPrev == '\r') {
636 pos--;
637 }
638 if (styler.SafeGetCharAt(pos - 1) == '\\') {
639 // Continuation line -- keep going
640 } else if (actual_style(styler.StyleAt(pos)) != SCE_RB_DEFAULT) {
641 // Part of multi-line construct -- keep going
642 } else if (currLineContainsHereDelims(pos, styler)) {
643 // Keep going, with pos and length now pointing
644 // at the end of the here-doc delimiter
645 } else if (skipWhiteSpace && isEmptyLine(pos, styler)) {
646 // Keep going
647 } else {
648 break;
649 }
650 }
651 pos = styler.LineStart(lineStart);
652 length += (startPos - pos);
653 startPos = pos;
654 initStyle = SCE_RB_DEFAULT;
655}
656
657static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
658 WordList *keywordlists[], Accessor &styler) {

Callers 2

ColouriseRbDocFunction · 0.85
FoldRbDocFunction · 0.85

Calls 7

isEmptyLineFunction · 0.85
FlushMethod · 0.80
GetLineMethod · 0.80
SafeGetCharAtMethod · 0.80
StyleAtMethod · 0.45
LineStartMethod · 0.45

Tested by

no test coverage detected