| 605 | // multi-line construct |
| 606 | |
| 607 | static 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 | |
| 657 | static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, |
| 658 | WordList *keywordlists[], Accessor &styler) { |
no test coverage detected