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

Function ColouriseCoffeeScriptDoc

scintilla/lexers/LexCoffeeScript.cxx:87–424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
88 Accessor &styler) {
89
90 WordList &keywords = *keywordlists[0];
91 WordList &keywords2 = *keywordlists[1];
92 WordList &keywords3 = *keywordlists[2];
93 WordList &keywords4 = *keywordlists[3];
94
95 // property styling.within.preprocessor
96 // For C++ code, determines whether all preprocessor code is styled in the preprocessor style (0, the default)
97 // or only from the initial # to the end of the command word(1).
98 bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0;
99
100 CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-");
101 CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-");
102
103 CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]");
104
105 CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
106 CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
107
108 // property lexer.cpp.allow.dollars
109 // Set to 0 to disallow the '$' character in identifiers with the cpp lexer.
110 if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) {
111 setWordStart.Add('$');
112 setWord.Add('$');
113 }
114
115 int chPrevNonWhite = ' ';
116 int visibleChars = 0;
117 bool lastWordWasUUID = false;
118 int styleBeforeDCKeyword = SCE_C_DEFAULT;
119 bool continuationLine = false;
120 bool isIncludePreprocessor = false;
121
122 if (initStyle == SCE_C_PREPROCESSOR) {
123 // Set continuationLine if last character of previous line is '\'
124 int lineCurrent = styler.GetLine(startPos);
125 if (lineCurrent > 0) {
126 int chBack = styler.SafeGetCharAt(startPos-1, 0);
127 int chBack2 = styler.SafeGetCharAt(startPos-2, 0);
128 int lineEndChar = '!';
129 if (chBack2 == '\r' && chBack == '\n') {
130 lineEndChar = styler.SafeGetCharAt(startPos-3, 0);
131 } else if (chBack == '\n' || chBack == '\r') {
132 lineEndChar = chBack2;
133 }
134 continuationLine = lineEndChar == '\\';
135 }
136 }
137
138 // look back to set chPrevNonWhite properly for better regex colouring
139 int endPos = startPos + length;
140 if (startPos > 0) {
141 unsigned int back = startPos;
142 styler.Flush();
143 while (back > 0 && IsSpaceEquiv(styler.StyleAt(--back)))
144 ;

Callers

nothing calls this directly

Calls 15

IsASpaceFunction · 0.85
IsADigitFunction · 0.85
isoperatorFunction · 0.85
GetPropertyIntMethod · 0.80
GetLineMethod · 0.80
SafeGetCharAtMethod · 0.80
FlushMethod · 0.80
MoreMethod · 0.80
ForwardMethod · 0.80
SetStateMethod · 0.80
GetCurrentMethod · 0.80
InListMethod · 0.80

Tested by

no test coverage detected