Use an explicite function name

This commit is contained in:
Don Ho 2025-11-24 17:52:00 +01:00
parent 4184d7cbbb
commit a8dfadefe8
2 changed files with 28 additions and 28 deletions

View File

@ -970,7 +970,7 @@ void ScintillaEditView::setXmlLexer(LangType type)
keywordList = wstring2string(kwlW, CP_ACP); keywordList = wstring2string(kwlW, CP_ACP);
} }
execute(SCI_SETKEYWORDS, 5, reinterpret_cast<LPARAM>(getCompleteKeywordList(keywordList, L_XML, LANG_INDEX_INSTR))); execute(SCI_SETKEYWORDS, 5, reinterpret_cast<LPARAM>(concatToBuildKeywordList(keywordList, L_XML, LANG_INDEX_INSTR)));
// the XML portion of the lexer only allows substyles for attributes, not for tags (since it treats all tags the same), // the XML portion of the lexer only allows substyles for attributes, not for tags (since it treats all tags the same),
// so allocate all 8 substyles to attributes // so allocate all 8 substyles to attributes
@ -1007,7 +1007,7 @@ void ScintillaEditView::setHTMLLexer()
keywordList = wstring2string(kwlW, CP_ACP); keywordList = wstring2string(kwlW, CP_ACP);
} }
execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(getCompleteKeywordList(keywordList, L_HTML, LANG_INDEX_INSTR))); execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(concatToBuildKeywordList(keywordList, L_HTML, LANG_INDEX_INSTR)));
// DOCTYPE command keywords // DOCTYPE command keywords
std::string keywordList2; std::string keywordList2;
@ -1017,7 +1017,7 @@ void ScintillaEditView::setHTMLLexer()
keywordList2 = wstring2string(kwlW, CP_ACP); keywordList2 = wstring2string(kwlW, CP_ACP);
} }
execute(SCI_SETKEYWORDS, 5, reinterpret_cast<LPARAM>(getCompleteKeywordList(keywordList2, L_HTML, LANG_INDEX_INSTR2))); execute(SCI_SETKEYWORDS, 5, reinterpret_cast<LPARAM>(concatToBuildKeywordList(keywordList2, L_HTML, LANG_INDEX_INSTR2)));
// HTML allows substyle lists for both tags and attributes, so allocate four of each // HTML allows substyle lists for both tags and attributes, so allocate four of each
populateSubStyleKeywords(L_HTML, SCE_H_TAG, 4, LANG_INDEX_SUBSTYLE1, pKwArray); populateSubStyleKeywords(L_HTML, SCE_H_TAG, 4, LANG_INDEX_SUBSTYLE1, pKwArray);
@ -1036,7 +1036,7 @@ void ScintillaEditView::setEmbeddedJSLexer()
keywordList = wstring2string(kwlW, CP_ACP); keywordList = wstring2string(kwlW, CP_ACP);
} }
execute(SCI_SETKEYWORDS, 1, reinterpret_cast<LPARAM>(getCompleteKeywordList(keywordList, L_JS_EMBEDDED, LANG_INDEX_INSTR))); execute(SCI_SETKEYWORDS, 1, reinterpret_cast<LPARAM>(concatToBuildKeywordList(keywordList, L_JS_EMBEDDED, LANG_INDEX_INSTR)));
populateSubStyleKeywords(L_JS_EMBEDDED, SCE_HJ_WORD, 8, LANG_INDEX_SUBSTYLE1, pKwArray); populateSubStyleKeywords(L_JS_EMBEDDED, SCE_HJ_WORD, 8, LANG_INDEX_SUBSTYLE1, pKwArray);
execute(SCI_STYLESETEOLFILLED, SCE_HJ_DEFAULT, true); execute(SCI_STYLESETEOLFILLED, SCE_HJ_DEFAULT, true);
execute(SCI_STYLESETEOLFILLED, SCE_HJ_COMMENT, true); execute(SCI_STYLESETEOLFILLED, SCE_HJ_COMMENT, true);
@ -1067,8 +1067,8 @@ void ScintillaEditView::setJsonLexer(bool isJson5)
keywordList2 = wstring2string(kwlW, CP_ACP); keywordList2 = wstring2string(kwlW, CP_ACP);
} }
execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(getCompleteKeywordList(keywordList, L_JSON, LANG_INDEX_INSTR))); execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(concatToBuildKeywordList(keywordList, L_JSON, LANG_INDEX_INSTR)));
execute(SCI_SETKEYWORDS, 1, reinterpret_cast<LPARAM>(getCompleteKeywordList(keywordList2, L_JSON, LANG_INDEX_INSTR2))); execute(SCI_SETKEYWORDS, 1, reinterpret_cast<LPARAM>(concatToBuildKeywordList(keywordList2, L_JSON, LANG_INDEX_INSTR2)));
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold"), reinterpret_cast<LPARAM>("1")); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold"), reinterpret_cast<LPARAM>("1"));
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.compact"), reinterpret_cast<LPARAM>("0")); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("fold.compact"), reinterpret_cast<LPARAM>("0"));
@ -1091,7 +1091,7 @@ void ScintillaEditView::setEmbeddedPhpLexer()
keywordList = wstring2string(kwlW, CP_ACP); keywordList = wstring2string(kwlW, CP_ACP);
} }
execute(SCI_SETKEYWORDS, 4, reinterpret_cast<LPARAM>(getCompleteKeywordList(keywordList, L_PHP, LANG_INDEX_INSTR))); execute(SCI_SETKEYWORDS, 4, reinterpret_cast<LPARAM>(concatToBuildKeywordList(keywordList, L_PHP, LANG_INDEX_INSTR)));
populateSubStyleKeywords(L_PHP, SCE_HPHP_WORD, 8, LANG_INDEX_SUBSTYLE1, pKwArray); populateSubStyleKeywords(L_PHP, SCE_HPHP_WORD, 8, LANG_INDEX_SUBSTYLE1, pKwArray);
execute(SCI_STYLESETEOLFILLED, SCE_HPHP_DEFAULT, true); execute(SCI_STYLESETEOLFILLED, SCE_HPHP_DEFAULT, true);
@ -1112,7 +1112,7 @@ void ScintillaEditView::setEmbeddedAspLexer()
execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("asp.default.language"), reinterpret_cast<LPARAM>("2")); execute(SCI_SETPROPERTY, reinterpret_cast<WPARAM>("asp.default.language"), reinterpret_cast<LPARAM>("2"));
execute(SCI_SETKEYWORDS, 2, reinterpret_cast<LPARAM>(getCompleteKeywordList(keywordList, L_VB, LANG_INDEX_INSTR))); execute(SCI_SETKEYWORDS, 2, reinterpret_cast<LPARAM>(concatToBuildKeywordList(keywordList, L_VB, LANG_INDEX_INSTR)));
populateSubStyleKeywords(L_ASP, SCE_HB_WORD, 8, LANG_INDEX_SUBSTYLE1, pKwArray); populateSubStyleKeywords(L_ASP, SCE_HB_WORD, 8, LANG_INDEX_SUBSTYLE1, pKwArray);
@ -1278,7 +1278,7 @@ void ScintillaEditView::setExternalLexer(LangType typeDoc)
{ {
keywordList = wstring2string(style._keywords, CP_ACP); keywordList = wstring2string(style._keywords, CP_ACP);
} }
execute(SCI_SETKEYWORDS, style._keywordClass, reinterpret_cast<LPARAM>(getCompleteKeywordList(keywordList, typeDoc, style._keywordClass))); execute(SCI_SETKEYWORDS, style._keywordClass, reinterpret_cast<LPARAM>(concatToBuildKeywordList(keywordList, typeDoc, style._keywordClass)));
} }
} }
} }
@ -1319,21 +1319,21 @@ void ScintillaEditView::setCppLexer(LangType langType)
basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_INSTR]; basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_INSTR];
keywordListInstruction = wstring2string(kwlW, CP_ACP); keywordListInstruction = wstring2string(kwlW, CP_ACP);
} }
cppInstrs = getCompleteKeywordList(keywordListInstruction, langType, LANG_INDEX_INSTR); cppInstrs = concatToBuildKeywordList(keywordListInstruction, langType, LANG_INDEX_INSTR);
if (pKwArray[LANG_INDEX_TYPE]) if (pKwArray[LANG_INDEX_TYPE])
{ {
basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_TYPE]; basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_TYPE];
keywordListType = wstring2string(kwlW, CP_ACP); keywordListType = wstring2string(kwlW, CP_ACP);
} }
cppTypes = getCompleteKeywordList(keywordListType, langType, LANG_INDEX_TYPE); cppTypes = concatToBuildKeywordList(keywordListType, langType, LANG_INDEX_TYPE);
if (pKwArray[LANG_INDEX_INSTR2]) if (pKwArray[LANG_INDEX_INSTR2])
{ {
basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_INSTR2]; basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_INSTR2];
keywordListGlobalclass = wstring2string(kwlW, CP_ACP); keywordListGlobalclass = wstring2string(kwlW, CP_ACP);
} }
cppGlobalclass = getCompleteKeywordList(keywordListGlobalclass, langType, LANG_INDEX_INSTR2); cppGlobalclass = concatToBuildKeywordList(keywordListGlobalclass, langType, LANG_INDEX_INSTR2);
execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(cppInstrs)); execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(cppInstrs));
execute(SCI_SETKEYWORDS, 1, reinterpret_cast<LPARAM>(cppTypes)); execute(SCI_SETKEYWORDS, 1, reinterpret_cast<LPARAM>(cppTypes));
@ -1386,21 +1386,21 @@ void ScintillaEditView::setJsLexer()
basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_INSTR]; basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_INSTR];
keywordListInstruction = wstring2string(kwlW, CP_ACP); keywordListInstruction = wstring2string(kwlW, CP_ACP);
} }
const char *jsInstrs = getCompleteKeywordList(keywordListInstruction, L_JAVASCRIPT, LANG_INDEX_INSTR); const char *jsInstrs = concatToBuildKeywordList(keywordListInstruction, L_JAVASCRIPT, LANG_INDEX_INSTR);
if (pKwArray[LANG_INDEX_TYPE]) if (pKwArray[LANG_INDEX_TYPE])
{ {
basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_TYPE]; basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_TYPE];
keywordListType = wstring2string(kwlW, CP_ACP); keywordListType = wstring2string(kwlW, CP_ACP);
} }
const char *jsTypes = getCompleteKeywordList(keywordListType, L_JAVASCRIPT, LANG_INDEX_TYPE); const char *jsTypes = concatToBuildKeywordList(keywordListType, L_JAVASCRIPT, LANG_INDEX_TYPE);
if (pKwArray[LANG_INDEX_INSTR2]) if (pKwArray[LANG_INDEX_INSTR2])
{ {
basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_INSTR2]; basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_INSTR2];
keywordListInstruction2 = wstring2string(kwlW, CP_ACP); keywordListInstruction2 = wstring2string(kwlW, CP_ACP);
} }
const char *jsInstrs2 = getCompleteKeywordList(keywordListInstruction2, L_JAVASCRIPT, LANG_INDEX_INSTR2); const char *jsInstrs2 = concatToBuildKeywordList(keywordListInstruction2, L_JAVASCRIPT, LANG_INDEX_INSTR2);
execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(jsInstrs)); execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(jsInstrs));
execute(SCI_SETKEYWORDS, 1, reinterpret_cast<LPARAM>(jsTypes)); execute(SCI_SETKEYWORDS, 1, reinterpret_cast<LPARAM>(jsTypes));
@ -1451,7 +1451,7 @@ void ScintillaEditView::setJsLexer()
basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_INSTR]; basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_INSTR];
keywordListInstruction = wstring2string(kwlW, CP_ACP); keywordListInstruction = wstring2string(kwlW, CP_ACP);
} }
const char *jsEmbeddedInstrs = getCompleteKeywordList(keywordListInstruction, L_JS_EMBEDDED, LANG_INDEX_INSTR); const char *jsEmbeddedInstrs = concatToBuildKeywordList(keywordListInstruction, L_JS_EMBEDDED, LANG_INDEX_INSTR);
execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(jsEmbeddedInstrs)); execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(jsEmbeddedInstrs));
} }
@ -1487,14 +1487,14 @@ void ScintillaEditView::setTclLexer()
basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_INSTR]; basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_INSTR];
keywordListInstruction = wstring2string(kwlW, CP_ACP); keywordListInstruction = wstring2string(kwlW, CP_ACP);
} }
tclInstrs = getCompleteKeywordList(keywordListInstruction, L_TCL, LANG_INDEX_INSTR); tclInstrs = concatToBuildKeywordList(keywordListInstruction, L_TCL, LANG_INDEX_INSTR);
if (pKwArray[LANG_INDEX_TYPE]) if (pKwArray[LANG_INDEX_TYPE])
{ {
basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_TYPE]; basic_string<wchar_t> kwlW = pKwArray[LANG_INDEX_TYPE];
keywordListType = wstring2string(kwlW, CP_ACP); keywordListType = wstring2string(kwlW, CP_ACP);
} }
tclTypes = getCompleteKeywordList(keywordListType, L_TCL, LANG_INDEX_TYPE); tclTypes = concatToBuildKeywordList(keywordListType, L_TCL, LANG_INDEX_TYPE);
execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(tclInstrs)); execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(tclInstrs));
execute(SCI_SETKEYWORDS, 1, reinterpret_cast<LPARAM>(tclTypes)); execute(SCI_SETKEYWORDS, 1, reinterpret_cast<LPARAM>(tclTypes));
@ -1513,21 +1513,21 @@ void ScintillaEditView::setObjCLexer(LangType langType)
{ {
objcInstr1Kwl = wstring2string(pKwArray[LANG_INDEX_INSTR], CP_ACP); objcInstr1Kwl = wstring2string(pKwArray[LANG_INDEX_INSTR], CP_ACP);
} }
const char *objcInstrs = getCompleteKeywordList(objcInstr1Kwl, langType, LANG_INDEX_INSTR); const char *objcInstrs = concatToBuildKeywordList(objcInstr1Kwl, langType, LANG_INDEX_INSTR);
basic_string<char> objcInstr2Kwl(""); basic_string<char> objcInstr2Kwl("");
if (pKwArray[LANG_INDEX_INSTR2]) if (pKwArray[LANG_INDEX_INSTR2])
{ {
objcInstr2Kwl = wstring2string(pKwArray[LANG_INDEX_INSTR2], CP_ACP); objcInstr2Kwl = wstring2string(pKwArray[LANG_INDEX_INSTR2], CP_ACP);
} }
const char *objCDirective = getCompleteKeywordList(objcInstr2Kwl, langType, LANG_INDEX_INSTR2); const char *objCDirective = concatToBuildKeywordList(objcInstr2Kwl, langType, LANG_INDEX_INSTR2);
basic_string<char> objcTypeKwl(""); basic_string<char> objcTypeKwl("");
if (pKwArray[LANG_INDEX_TYPE]) if (pKwArray[LANG_INDEX_TYPE])
{ {
objcTypeKwl = wstring2string(pKwArray[LANG_INDEX_TYPE], CP_ACP); objcTypeKwl = wstring2string(pKwArray[LANG_INDEX_TYPE], CP_ACP);
} }
const char *objcTypes = getCompleteKeywordList(objcTypeKwl, langType, LANG_INDEX_TYPE); const char *objcTypes = concatToBuildKeywordList(objcTypeKwl, langType, LANG_INDEX_TYPE);
basic_string<char> objcType2Kwl(""); basic_string<char> objcType2Kwl("");
@ -1535,7 +1535,7 @@ void ScintillaEditView::setObjCLexer(LangType langType)
{ {
objcType2Kwl = wstring2string(pKwArray[LANG_INDEX_TYPE2], CP_ACP); objcType2Kwl = wstring2string(pKwArray[LANG_INDEX_TYPE2], CP_ACP);
} }
const char *objCQualifier = getCompleteKeywordList(objcType2Kwl, langType, LANG_INDEX_TYPE2); const char *objCQualifier = concatToBuildKeywordList(objcType2Kwl, langType, LANG_INDEX_TYPE2);
@ -1587,10 +1587,10 @@ void ScintillaEditView::setTypeScriptLexer()
}; };
std::string keywordListInstruction = getKeywordList(LANG_INDEX_INSTR); std::string keywordListInstruction = getKeywordList(LANG_INDEX_INSTR);
const char* tsInstructions = getCompleteKeywordList(keywordListInstruction, L_TYPESCRIPT, LANG_INDEX_INSTR); const char* tsInstructions = concatToBuildKeywordList(keywordListInstruction, L_TYPESCRIPT, LANG_INDEX_INSTR);
string keywordListType = getKeywordList(LANG_INDEX_TYPE); string keywordListType = getKeywordList(LANG_INDEX_TYPE);
const char* tsTypes = getCompleteKeywordList(keywordListType, L_TYPESCRIPT, LANG_INDEX_TYPE); const char* tsTypes = concatToBuildKeywordList(keywordListType, L_TYPESCRIPT, LANG_INDEX_TYPE);
execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(tsInstructions)); execute(SCI_SETKEYWORDS, 0, reinterpret_cast<LPARAM>(tsInstructions));
execute(SCI_SETKEYWORDS, 1, reinterpret_cast<LPARAM>(tsTypes)); execute(SCI_SETKEYWORDS, 1, reinterpret_cast<LPARAM>(tsTypes));
@ -1612,7 +1612,7 @@ void ScintillaEditView::setKeywords(LangType langType, const char *keywords, int
{ {
std::basic_string<char> wordList; std::basic_string<char> wordList;
wordList = (keywords)?keywords:""; wordList = (keywords)?keywords:"";
execute(SCI_SETKEYWORDS, index, reinterpret_cast<LPARAM>(getCompleteKeywordList(wordList, langType, index))); execute(SCI_SETKEYWORDS, index, reinterpret_cast<LPARAM>(concatToBuildKeywordList(wordList, langType, index)));
} }
void ScintillaEditView::populateSubStyleKeywords(LangType langType, int baseStyleID, int numSubStyles, int firstLangIndex, const wchar_t **pKwArray) void ScintillaEditView::populateSubStyleKeywords(LangType langType, int baseStyleID, int numSubStyles, int firstLangIndex, const wchar_t **pKwArray)
@ -1627,7 +1627,7 @@ void ScintillaEditView::populateSubStyleKeywords(LangType langType, int baseStyl
int ss = firstLangIndex + i; int ss = firstLangIndex + i;
int styleID = firstID + i; int styleID = firstID + i;
basic_string<char> userWords = pKwArray[ss] ? wmc.wchar2char(pKwArray[ss], CP_ACP) : ""; basic_string<char> userWords = pKwArray[ss] ? wmc.wchar2char(pKwArray[ss], CP_ACP) : "";
execute(SCI_SETIDENTIFIERS, styleID, reinterpret_cast<LPARAM>(getCompleteKeywordList(userWords, langType, ss))); execute(SCI_SETIDENTIFIERS, styleID, reinterpret_cast<LPARAM>(concatToBuildKeywordList(userWords, langType, ss)));
} }
} }
} }
@ -3678,7 +3678,7 @@ void ScintillaEditView::updateLineNumberWidth()
} }
const char * ScintillaEditView::getCompleteKeywordList(std::basic_string<char> & kwl, LangType langType, int keywordIndex) const char * ScintillaEditView::concatToBuildKeywordList(std::basic_string<char> & kwl, LangType langType, int keywordIndex)
{ {
kwl += " "; kwl += " ";
const wchar_t* defKwl_generic = NppParameters::getInstance().getWordList(langType, keywordIndex); const wchar_t* defKwl_generic = NppParameters::getInstance().getWordList(langType, keywordIndex);

View File

@ -703,7 +703,7 @@ protected:
//Lexers and Styling //Lexers and Styling
void restyleBuffer(); void restyleBuffer();
const char * getCompleteKeywordList(std::basic_string<char> & kwl, LangType langType, int keywordIndex); const char * concatToBuildKeywordList(std::basic_string<char> & kwl, LangType langType, int keywordIndex);
void setKeywords(LangType langType, const char *keywords, int index); void setKeywords(LangType langType, const char *keywords, int index);
void populateSubStyleKeywords(LangType langType, int baseStyleID, int numSubStyles, int firstLangIndex, const wchar_t **pKwArray); void populateSubStyleKeywords(LangType langType, int baseStyleID, int numSubStyles, int firstLangIndex, const wchar_t **pKwArray);
void setLexer(LangType langID, int whichList, int baseStyleID = STYLE_NOT_USED, int numSubStyles = 8); void setLexer(LangType langID, int whichList, int baseStyleID = STYLE_NOT_USED, int numSubStyles = 8);