From e72d4855de13d8f6c56c1bf2c8b6a81c77918469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Baptiste=20Th=C3=A9mine?= Date: Sat, 29 Dec 2018 18:58:00 +0100 Subject: [PATCH] Update functionList.xml C++ parser Improvements : - add templated classes (and template-nested templated classes) - add namespaced classes - add classes which inherits another class without the accessibility keyword (private is optional for example) - add classes with virtual inheritance - add functions defined with the following keywords - (left) consteval|constexpr|friend|inline|static|virtual - (right) const|final|noexcept|override - add functions defined with templated types (and template-nested templated types) - add operator definitions Close #5175 --- .../FunctionList/cpp/unitTest.expected.result | 1 - .../FunctionList/cpp/{unitTest => unitTest1} | 0 .../cpp/unitTest1.expected.result | 1 + PowerEditor/Test/FunctionList/cpp/unitTest2 | 840 ++++++++++++++++++ .../cpp/unitTest2.expected.result | 1 + PowerEditor/Test/FunctionList/unitTest.ps1 | 26 + .../Test/FunctionList/unitTestLauncher.ps1 | 21 +- PowerEditor/src/functionList.xml | 277 +++++- 8 files changed, 1136 insertions(+), 31 deletions(-) delete mode 100644 PowerEditor/Test/FunctionList/cpp/unitTest.expected.result rename PowerEditor/Test/FunctionList/cpp/{unitTest => unitTest1} (100%) create mode 100644 PowerEditor/Test/FunctionList/cpp/unitTest1.expected.result create mode 100644 PowerEditor/Test/FunctionList/cpp/unitTest2 create mode 100644 PowerEditor/Test/FunctionList/cpp/unitTest2.expected.result create mode 100644 PowerEditor/Test/FunctionList/unitTest.ps1 diff --git a/PowerEditor/Test/FunctionList/cpp/unitTest.expected.result b/PowerEditor/Test/FunctionList/cpp/unitTest.expected.result deleted file mode 100644 index b2bd51851..000000000 --- a/PowerEditor/Test/FunctionList/cpp/unitTest.expected.result +++ /dev/null @@ -1 +0,0 @@ -{"leaves":["strVal","decStrVal","hexStrVal","getKwClassFromName","getAsciiLenFromBase64Len","base64ToAscii","cutString","EnumFontFamExProc","RGB2int","convertIntToFormatType"],"nodes":[{"leaves":["addLanguageFromXml","switchToLang"],"name":"LocalizationSwitcher"},{"leaves":["getThemeFromXmlFileName"],"name":"ThemeSwitcher"},{"leaves":["getWindowsVersion","reloadStylers","reloadLang","getSpecialFolderLocation","getSettingsFolder","load","destroyInstance","saveConfig_xml","setWorkSpaceFilePath","removeTransparent","SetTransparent","isExistingExternalLangName","getUserDefinedLangNameFromExt","getExternalLangIndexFromName","getULCFromName","getCurLineHilitingColour","setCurLineHilitingColour","setFontList","isInFontList","getLangKeywordsFromXmlTree","getExternalLexerFromXmlTree","addExternalLangToEnd","getUserStylersFromXmlTree","getUserParametersFromXmlTree","getUserDefineLangsFromXmlTree","getShortcutsFromXmlTree","getMacrosFromXmlTree","getUserCmdsFromXmlTree","getPluginCmdsFromXmlTree","getScintKeysFromXmlTree","getBlackListFromXmlTree","initMenuKeys","initScintillaKeys","reloadContextMenuFromXmlTree","getCmdIdFromMenuEntryItemName","getPluginCmdIdFromMenuEntryItemName","getContextMenuFromXmlTree","setWorkingDir","loadSession","getSessionFromXmlTree","feedFileListParameters","feedProjectPanelsParameters","feedFileBrowserParameters","feedFindHistoryParameters","feedShortcut","feedMacros","getActions","feedUserCmds","feedPluginCustomizedCmds","feedScintKeys","feedBlacklist","getShortcuts","feedUserLang","importUDLFromFile","exportUDLToFile","getLangFromExt","setCloudChoice","removeCloudChoice","isCloudPathChanged","writeSettingsFilesOnCloudForThe1stTime","writeUserDefinedLang","insertCmd","insertMacro","insertUserCmd","insertPluginCmd","insertScintKey","writeSession","writeShortcuts","addUserLangToEnd","removeUserLang","feedUserSettings","feedUserKeywordList","feedUserStyles","feedStylerArray","writeRecentFileHistorySettings","writeProjectPanelsSettings","writeFileBrowserSettings","writeHistory","getChildElementByAttribut","getLangIDFromStr","getLocPathFromStr","feedKeyWordsParameters","feedGUIParameters","feedScintillaParam","feedDockingManager","writeScintillaParams","createXmlTreeFromGUIParams","writeFindHistory","insertDockingParamNode","writePrintSetting","writeExcludedLangList","insertGUIConfigBoolNode","langTypeToCommandID","getWinVerBitStr","writeStyles","insertTabInfo","writeStyle2Element","insertUserLang2Tree","stylerStrOp","addUserModifiedIndex","addPluginModifiedIndex","addScintillaModifiedIndex","safeWow64EnableWow64FsRedirection"],"name":"NppParameters"},{"leaves":["addLexerStyler","eraseAll"],"name":"LexerStylerArray"},{"leaves":["addStyler"],"name":"StyleArray"},{"leaves":["now"],"name":"Date"}],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/cpp/unitTest b/PowerEditor/Test/FunctionList/cpp/unitTest1 similarity index 100% rename from PowerEditor/Test/FunctionList/cpp/unitTest rename to PowerEditor/Test/FunctionList/cpp/unitTest1 diff --git a/PowerEditor/Test/FunctionList/cpp/unitTest1.expected.result b/PowerEditor/Test/FunctionList/cpp/unitTest1.expected.result new file mode 100644 index 000000000..caa0acbb1 --- /dev/null +++ b/PowerEditor/Test/FunctionList/cpp/unitTest1.expected.result @@ -0,0 +1 @@ +{"leaves":["strVal","decStrVal","hexStrVal","getKwClassFromName","getAsciiLenFromBase64Len","base64ToAscii","cutString","RGB2int","convertIntToFormatType"],"nodes":[{"leaves":["getLangFromXmlFileName","getXmlFilePathFromLangName","addLanguageFromXml","switchToLang"],"name":"LocalizationSwitcher"},{"leaves":["getThemeFromXmlFileName"],"name":"ThemeSwitcher"},{"leaves":["getWindowsVersion","reloadStylers","reloadLang","getSpecialFolderLocation","getSettingsFolder","load","destroyInstance","saveConfig_xml","setWorkSpaceFilePath","removeTransparent","SetTransparent","isExistingExternalLangName","getUserDefinedLangNameFromExt","getExternalLangIndexFromName","getULCFromName","getCurLineHilitingColour","setCurLineHilitingColour","setFontList","isInFontList","getLangKeywordsFromXmlTree","getExternalLexerFromXmlTree","addExternalLangToEnd","getUserStylersFromXmlTree","getUserParametersFromXmlTree","getUserDefineLangsFromXmlTree","getShortcutsFromXmlTree","getMacrosFromXmlTree","getUserCmdsFromXmlTree","getPluginCmdsFromXmlTree","getScintKeysFromXmlTree","getBlackListFromXmlTree","initMenuKeys","initScintillaKeys","reloadContextMenuFromXmlTree","getCmdIdFromMenuEntryItemName","getPluginCmdIdFromMenuEntryItemName","getContextMenuFromXmlTree","setWorkingDir","loadSession","getSessionFromXmlTree","feedFileListParameters","feedProjectPanelsParameters","feedFileBrowserParameters","feedFindHistoryParameters","feedShortcut","feedMacros","getActions","feedUserCmds","feedPluginCustomizedCmds","feedScintKeys","feedBlacklist","getShortcuts","feedUserLang","importUDLFromFile","exportUDLToFile","getLangFromExt","setCloudChoice","removeCloudChoice","isCloudPathChanged","writeSettingsFilesOnCloudForThe1stTime","writeUserDefinedLang","insertCmd","insertMacro","insertUserCmd","insertPluginCmd","insertScintKey","writeSession","writeShortcuts","addUserLangToEnd","removeUserLang","feedUserSettings","feedUserKeywordList","feedUserStyles","feedStylerArray","writeRecentFileHistorySettings","writeProjectPanelsSettings","writeFileBrowserSettings","writeHistory","getChildElementByAttribut","getLangIDFromStr","getLocPathFromStr","feedKeyWordsParameters","feedGUIParameters","feedScintillaParam","feedDockingManager","writeScintillaParams","createXmlTreeFromGUIParams","writeFindHistory","insertDockingParamNode","writePrintSetting","writeExcludedLangList","insertGUIConfigBoolNode","langTypeToCommandID","getWinVersionStr","getWinVerBitStr","writeStyles","insertTabInfo","writeStyle2Element","insertUserLang2Tree","stylerStrOp","addUserModifiedIndex","addPluginModifiedIndex","addScintillaModifiedIndex","safeWow64EnableWow64FsRedirection"],"name":"NppParameters"},{"leaves":["addLexerStyler","eraseAll"],"name":"LexerStylerArray"},{"leaves":["addStyler"],"name":"StyleArray"},{"leaves":["now"],"name":"Date"}],"root":"unitTest1"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/cpp/unitTest2 b/PowerEditor/Test/FunctionList/cpp/unitTest2 new file mode 100644 index 000000000..a2b6b712a --- /dev/null +++ b/PowerEditor/Test/FunctionList/cpp/unitTest2 @@ -0,0 +1,840 @@ +#include +using namespace std; + +/* -------------------- Namespaces -------------------- */ + +namespace test { + typedef const int type; + static constexpr type n = 0; + + //Template functions + template constexpr LType coalesce(const LType &left, const RType &right); + #if __cplusplus >= 201103L + template + constexpr LType coalesce(const LType &left, const RType &right, const Args &...args); + #endif + template constexpr test::type compare(const LType &left, const RType &right); + template constexpr Type divide(const Type &left, const Type &right); + template constexpr bool equals(const LType &left, const RType &right); + template constexpr Return cast(const Type &val); + template constexpr Type minus(const Type &left, const Type &right); + template constexpr Type modulus(const Type &left, const Type &right); + template constexpr Type multiply(const Type &left, const Type &right); + template constexpr Type negate(const Type &val); + template constexpr bool isnot(const Type &val); + template constexpr bool isnull(const Type &val); + template constexpr Type plus(const Type &left, const Type &right); + template void print(const Type &val); + + //Classes + class TestA2; + class TestA12; + template struct TestB3; + struct TestD3; + class TestH3; +} +using test::coalesce; + +/* -------------------- Template functions -------------------- */ + +template constexpr LType test::coalesce(const LType &left, const RType &right){ + return (left)? left : right; +} + +#if __cplusplus >= 201103L +template constexpr LType test::coalesce(const LType &left, const RType &right, const Args &...args){ + return (left)? left : coalesce(right,args...); +} +#endif + +template constexpr test::type test::compare(const LType &left, const RType &right){ + return (left constexpr Type test::divide(const Type &left, const Type &right){ return left/right; } + +template constexpr bool test::equals(const LType &left, const RType &right){ return (left==right); } + +template constexpr Return test::cast(const Type &val){ return (Return)val; } + +template constexpr Type test::minus(const Type &left, const Type &right){ return left-right; } + +template constexpr Type test::modulus(const Type &left, const Type &right){ return left%right; } + +template constexpr Type test::multiply(const Type &left, const Type &right){ return left*right; } + +template constexpr Type test::negate(const Type &val){ return -val; } + +template constexpr bool test::isnot(const Type &val){ return !val; } + +template constexpr bool test::isnull(const Type &val){ return (val==NULL); } + +template constexpr Type test::plus(const Type &left, const Type &right){ return left+right; } + +template void test::print(const Type &val){ std::cout << val << std::endl; } + +template constexpr Type test42() noexcept { return coalesce(N,42); } + +/* -------------------- Classes -------------------- */ + +struct TestA1 { + int test(){ return 42; } +}; + +class test::TestA2 { + int test(){ return 42; } +}; + +struct TestA3 : TestA1 { + int test(){ return 42; } +}; + +class TestA4 : private TestA1 { + int test(){ return 42; } +}; + +struct TestA5 : protected TestA1 { + int test(){ return 42; } +}; + +class TestA6 : public TestA1 { + int test(){ return 42; } +}; + +struct TestA7 final : virtual TestA1 { + int test(){ return 42; } +}; + +class TestA8 : public virtual TestA1 { + int test(){ return 42; } +}; + +struct TestA9 final : virtual public TestA1 { + int test(){ return 42; } +}; + +class TestA10 : TestA1, test::TestA2, TestA3 { + int test(){ return 42; } +}; + +struct TestA11 : private TestA1, protected test::TestA2, public TestA3 { + int test(){ return 42; } +}; + +class test::TestA12 : TestA1, protected test::TestA2, public virtual TestA3 { + int test(){ return 42; } +}; + +struct TestA13 final : public virtual TestA1, protected test::TestA2, TestA3 { + int test(){ return 42; } +}; + +/* -------------------- Template classes -------------------- */ + +template struct TestB1 { + int test(){ return 42; } +}; + +template class TestB2 { + int test(){ return 42; } +}; + +template struct test::TestB3 { + int test(){ return 42; } +}; + +template class TestB4 { + int test(){ return 42; } +}; + +template struct TestB5 { + int test(){ return 42; } +}; + +template struct TestB6 { + int test(){ return 42; } +}; + +template > struct TestB7 { + int test(){ return 42; } +}; + +template class TestB8 { + int test(){ return 42; } +}; + +template struct TestB9 { + int test(){ return 42; } +}; + +template