diff --git a/.gitignore b/.gitignore index 8008f7a0..8c016ce4 100644 --- a/.gitignore +++ b/.gitignore @@ -69,6 +69,7 @@ PowerEditor/bin/backup/ PowerEditor/bin/localization/ PowerEditor/bin/plugins/ PowerEditor/bin/updater/ +PowerEditor/bin/functionList/ PowerEditor/bin64/ PowerEditor/bin/themes/ PowerEditor/installer/bin/wingup/ diff --git a/PowerEditor/Test/FunctionList/bash/unitTest b/PowerEditor/Test/FunctionList/bash/unitTest index a13d651b..b627d7b0 100644 --- a/PowerEditor/Test/FunctionList/bash/unitTest +++ b/PowerEditor/Test/FunctionList/bash/unitTest @@ -1,5 +1,8 @@ #!/bin/sh +# bash parser should be fixed so we can use the content of "unitTest.expected.result.correct". +# Check the bug here: +# https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9019 setenv() @@ -117,7 +120,6 @@ LIBIFSNAME="/QSYS.LIB/${TARGETLIB}.LIB" # exit 0 (succeeds) if some action has to be taken, else 1. action_needed() - { [ ! -e "${1}" ] && return 0 [ "${2}" ] || return 1 @@ -132,9 +134,7 @@ action_needed() # - Absolute # - No . or .. component. -canonicalize_path() - -{ +canonicalize_path(){ if expr "${1}" : '^/' > /dev/null then P="${1}" else P="`pwd`/${1}" @@ -167,9 +167,7 @@ canonicalize_path() # As side effect, append the module name to variable MODULES. # Set LINK to "YES" if the module has been compiled. -make_module() - -{ +make_module() { MODULES="${MODULES} ${1}" MODIFSNAME="${LIBIFSNAME}/${1}.MODULE" action_needed "${MODIFSNAME}" "${2}" || return 0; diff --git a/PowerEditor/Test/FunctionList/functionList.xsd b/PowerEditor/Test/FunctionList/functionList.xsd deleted file mode 100644 index 40db0474..00000000 --- a/PowerEditor/Test/FunctionList/functionList.xsd +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PowerEditor/Test/FunctionList/unitTest.ps1 b/PowerEditor/Test/FunctionList/unitTest.ps1 index 2de98e52..f7eb53ab 100644 --- a/PowerEditor/Test/FunctionList/unitTest.ps1 +++ b/PowerEditor/Test/FunctionList/unitTest.ps1 @@ -3,8 +3,10 @@ # .\unit-test.ps1 RELATIVE_PATH LANG # It return 0 if result is OK # -1 if result is KO +# -2 if exception # 1 if unitTest file not found + $testRoot = ".\" $dirName=$args[0] @@ -35,5 +37,5 @@ Try { } Catch { - return -1 -} \ No newline at end of file + return -2 +} diff --git a/PowerEditor/Test/FunctionList/unitTestLauncher.ps1 b/PowerEditor/Test/FunctionList/unitTestLauncher.ps1 index f9026528..996f8af2 100644 --- a/PowerEditor/Test/FunctionList/unitTestLauncher.ps1 +++ b/PowerEditor/Test/FunctionList/unitTestLauncher.ps1 @@ -6,7 +6,7 @@ Foreach-Object { $dirName = (Get-Item $testRoot$_).Name $langName = $dirName $sw = [Diagnostics.Stopwatch]::StartNew() - $result = &.\unitTest.ps1 $dirName $langName + $result = & ".\unitTest.ps1" $dirName $langName $sw.Stop() "Test: " + $sw.Elapsed.TotalMilliseconds + " ms" @@ -19,11 +19,21 @@ Foreach-Object { { "$dirName ... unitTest file not found. Test skipped." } - else + elseif ($result -eq -1) { "$dirName ... KO" - "" - "There are some problems in your functionList.xml" + "result = $result" + "There are some problems in your $dirName.xml" + exit -1 + } + elseif ($result -eq -2) + { + "Exception!" + exit -1 + } + else + { + "It should not happen - check your script." exit -1 } @@ -48,7 +58,7 @@ Foreach-Object { { "$dirName-$subDirName ... KO" "" - "There are some problems in your functionList.xml" + "There are some problems in your $dirName.xml" exit -1 } } diff --git a/PowerEditor/gcc/makefile b/PowerEditor/gcc/makefile index b043233a..a4b5fb03 100644 --- a/PowerEditor/gcc/makefile +++ b/PowerEditor/gcc/makefile @@ -217,7 +217,7 @@ SRC_RES = ./resources.rc OBJ_RES = $(patsubst %.rc,%.res,$(SRC_RES)) # XML config files -SRC_XMLCFG = $(addprefix $(NPP_DIR)/,langs.model.xml stylers.model.xml shortcuts.xml functionList.xml contextMenu.xml) +SRC_XMLCFG = $(addprefix $(NPP_DIR)/,langs.model.xml stylers.model.xml shortcuts.xml contextMenu.xml) DST_XMLCFG = $(subst $(NPP_DIR),../bin,$(SRC_XMLCFG)) DEPS = $(patsubst %.o,%.d,$(OBJS)) diff --git a/PowerEditor/installer/functionList/asm.xml b/PowerEditor/installer/functionList/asm.xml new file mode 100644 index 00000000..9a5d1b00 --- /dev/null +++ b/PowerEditor/installer/functionList/asm.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/autoit.xml b/PowerEditor/installer/functionList/autoit.xml new file mode 100644 index 00000000..33cf35fb --- /dev/null +++ b/PowerEditor/installer/functionList/autoit.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/baanc.xml b/PowerEditor/installer/functionList/baanc.xml new file mode 100644 index 00000000..603612f3 --- /dev/null +++ b/PowerEditor/installer/functionList/baanc.xml @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/bash.xml b/PowerEditor/installer/functionList/bash.xml new file mode 100644 index 00000000..f5e27177 --- /dev/null +++ b/PowerEditor/installer/functionList/bash.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/batch.xml b/PowerEditor/installer/functionList/batch.xml new file mode 100644 index 00000000..eaf027f5 --- /dev/null +++ b/PowerEditor/installer/functionList/batch.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/c.xml b/PowerEditor/installer/functionList/c.xml new file mode 100644 index 00000000..8eaeccba --- /dev/null +++ b/PowerEditor/installer/functionList/c.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/cobol-free.xml b/PowerEditor/installer/functionList/cobol-free.xml new file mode 100644 index 00000000..09506ab2 --- /dev/null +++ b/PowerEditor/installer/functionList/cobol-free.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/cobol.xml b/PowerEditor/installer/functionList/cobol.xml new file mode 100644 index 00000000..d1ec3409 --- /dev/null +++ b/PowerEditor/installer/functionList/cobol.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/cpp.xml b/PowerEditor/installer/functionList/cpp.xml new file mode 100644 index 00000000..b6fd2c99 --- /dev/null +++ b/PowerEditor/installer/functionList/cpp.xml @@ -0,0 +1,304 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/cs.xml b/PowerEditor/installer/functionList/cs.xml new file mode 100644 index 00000000..4ccba041 --- /dev/null +++ b/PowerEditor/installer/functionList/cs.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/ini.xml b/PowerEditor/installer/functionList/ini.xml new file mode 100644 index 00000000..f1c0efc6 --- /dev/null +++ b/PowerEditor/installer/functionList/ini.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/inno.xml b/PowerEditor/installer/functionList/inno.xml new file mode 100644 index 00000000..7b1cf4f9 --- /dev/null +++ b/PowerEditor/installer/functionList/inno.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/java.xml b/PowerEditor/installer/functionList/java.xml new file mode 100644 index 00000000..248e0fed --- /dev/null +++ b/PowerEditor/installer/functionList/java.xml @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/javascript.js.xml b/PowerEditor/installer/functionList/javascript.js.xml new file mode 100644 index 00000000..5b25b7f4 --- /dev/null +++ b/PowerEditor/installer/functionList/javascript.js.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/krl.xml b/PowerEditor/installer/functionList/krl.xml new file mode 100644 index 00000000..16f81118 --- /dev/null +++ b/PowerEditor/installer/functionList/krl.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/nsis.xml b/PowerEditor/installer/functionList/nsis.xml new file mode 100644 index 00000000..a912d577 --- /dev/null +++ b/PowerEditor/installer/functionList/nsis.xml @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/overrideMap.xml b/PowerEditor/installer/functionList/overrideMap.xml new file mode 100644 index 00000000..8ce88900 --- /dev/null +++ b/PowerEditor/installer/functionList/overrideMap.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/PowerEditor/installer/functionList/perl.xml b/PowerEditor/installer/functionList/perl.xml new file mode 100644 index 00000000..8cb430c8 --- /dev/null +++ b/PowerEditor/installer/functionList/perl.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/php.xml b/PowerEditor/installer/functionList/php.xml new file mode 100644 index 00000000..693df268 --- /dev/null +++ b/PowerEditor/installer/functionList/php.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/powershell.xml b/PowerEditor/installer/functionList/powershell.xml new file mode 100644 index 00000000..8cfee9e7 --- /dev/null +++ b/PowerEditor/installer/functionList/powershell.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/python.xml b/PowerEditor/installer/functionList/python.xml new file mode 100644 index 00000000..a0123534 --- /dev/null +++ b/PowerEditor/installer/functionList/python.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/ruby.xml b/PowerEditor/installer/functionList/ruby.xml new file mode 100644 index 00000000..14b8e8d1 --- /dev/null +++ b/PowerEditor/installer/functionList/ruby.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/sinumerik.xml b/PowerEditor/installer/functionList/sinumerik.xml new file mode 100644 index 00000000..b0443b43 --- /dev/null +++ b/PowerEditor/installer/functionList/sinumerik.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/sql.xml b/PowerEditor/installer/functionList/sql.xml new file mode 100644 index 00000000..567adc66 --- /dev/null +++ b/PowerEditor/installer/functionList/sql.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/universe_basic.xml b/PowerEditor/installer/functionList/universe_basic.xml new file mode 100644 index 00000000..04bac047 --- /dev/null +++ b/PowerEditor/installer/functionList/universe_basic.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/vhdl.xml b/PowerEditor/installer/functionList/vhdl.xml new file mode 100644 index 00000000..1b83ea56 --- /dev/null +++ b/PowerEditor/installer/functionList/vhdl.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/functionList/xml.xml b/PowerEditor/installer/functionList/xml.xml new file mode 100644 index 00000000..a0aea6c5 --- /dev/null +++ b/PowerEditor/installer/functionList/xml.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PowerEditor/installer/nppSetup.nsi b/PowerEditor/installer/nppSetup.nsi index b51a4ce1..718eced9 100644 --- a/PowerEditor/installer/nppSetup.nsi +++ b/PowerEditor/installer/nppSetup.nsi @@ -110,7 +110,7 @@ SectionEnd !include "nsisInclude\autoCompletion.nsh" - +!include "nsisInclude\functionList.nsh" !include "nsisInclude\binariesComponents.nsh" @@ -252,6 +252,7 @@ ${MementoSectionDone} !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${explorerContextMenu} 'Explorer context menu entry for Notepad++ : Open whatever you want in Notepad++ from Windows Explorer.' !insertmacro MUI_DESCRIPTION_TEXT ${autoCompletionComponent} 'Install the API files you need for the auto-completion feature (Ctrl+Space).' + !insertmacro MUI_DESCRIPTION_TEXT ${functionListComponent} 'Install the function list files you need for the function list feature (Ctrl+Space).' !insertmacro MUI_DESCRIPTION_TEXT ${Plugins} 'You may need these plugins to extend the capabilities of Notepad++.' !insertmacro MUI_DESCRIPTION_TEXT ${localization} 'To use Notepad++ in your favorite language(s), install all/desired language(s).' !insertmacro MUI_DESCRIPTION_TEXT ${Themes} 'The eye-candy to change visual effects. Use Theme selector to switch among them.' diff --git a/PowerEditor/installer/nsisInclude/autoCompletion.nsh b/PowerEditor/installer/nsisInclude/autoCompletion.nsh index 70062c59..1e6f6a41 100644 --- a/PowerEditor/installer/nsisInclude/autoCompletion.nsh +++ b/PowerEditor/installer/nsisInclude/autoCompletion.nsh @@ -30,151 +30,126 @@ SectionGroup "Auto-completion Files" autoCompletionComponent SetOverwrite off ${MementoSection} "C" C - Delete "$INSTDIR\plugins\APIs\c.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\c.xml" ${MementoSectionEnd} ${MementoSection} "C++" C++ - Delete "$INSTDIR\plugins\APIs\cpp.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\cpp.xml" ${MementoSectionEnd} ${MementoSection} "Java" Java - Delete "$INSTDIR\plugins\APIs\java.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\java.xml" ${MementoSectionEnd} ${MementoSection} "C#" C# - Delete "$INSTDIR\plugins\APIs\cs.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\cs.xml" ${MementoSectionEnd} ${MementoSection} "HTML" HTML - Delete "$INSTDIR\plugins\APIs\html.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\html.xml" ${MementoSectionEnd} ${MementoSection} "RC" RC - Delete "$INSTDIR\plugins\APIs\rc.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\rc.xml" ${MementoSectionEnd} ${MementoSection} "SQL" SQL - Delete "$INSTDIR\plugins\APIs\sql.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\sql.xml" ${MementoSectionEnd} ${MementoSection} "PHP" PHP - Delete "$INSTDIR\plugins\APIs\php.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\php.xml" ${MementoSectionEnd} ${MementoSection} "CSS" CSS - Delete "$INSTDIR\plugins\APIs\css.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\css.xml" ${MementoSectionEnd} ${MementoSection} "VB" VB - Delete "$INSTDIR\plugins\APIs\vb.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\vb.xml" ${MementoSectionEnd} ${MementoSection} "Perl" Perl - Delete "$INSTDIR\plugins\APIs\perl.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\perl.xml" ${MementoSectionEnd} ${MementoSection} "JavaScript" JavaScript - Delete "$INSTDIR\plugins\APIs\javascript.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\javascript.xml" ${MementoSectionEnd} ${MementoSection} "Python" Python - Delete "$INSTDIR\plugins\APIs\python.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\python.xml" ${MementoSectionEnd} ${MementoSection} "ActionScript" ActionScript - Delete "$INSTDIR\plugins\APIs\actionscript.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\actionscript.xml" ${MementoSectionEnd} ${MementoSection} "LISP" LISP - Delete "$INSTDIR\plugins\APIs\lisp.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\lisp.xml" ${MementoSectionEnd} ${MementoSection} "VHDL" VHDL - Delete "$INSTDIR\plugins\APIs\vhdl.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\vhdl.xml" ${MementoSectionEnd} ${MementoSection} "TeX" TeX - Delete "$INSTDIR\plugins\APIs\tex.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\tex.xml" ${MementoSectionEnd} ${MementoSection} "DocBook" DocBook - Delete "$INSTDIR\plugins\APIs\xml.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\xml.xml" ${MementoSectionEnd} ${MementoSection} "NSIS" NSIS - Delete "$INSTDIR\plugins\APIs\nsis.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\nsis.xml" ${MementoSectionEnd} ${MementoSection} "CMAKE" CMAKE - Delete "$INSTDIR\plugins\APIs\cmake.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\cmake.xml" ${MementoSectionEnd} ${MementoSection} "BATCH" BATCH - Delete "$INSTDIR\plugins\APIs\batch.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\batch.xml" ${MementoSectionEnd} ${MementoSection} "CoffeeScript" CoffeeScript - Delete "$INSTDIR\plugins\APIs\coffee.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\coffee.xml" ${MementoSectionEnd} ${MementoSection} "BaanC" BaanC - Delete "$INSTDIR\plugins\APIs\baanc.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\baanc.xml" ${MementoSectionEnd} ${MementoSection} "Lua" Lua - Delete "$INSTDIR\plugins\APIs\lua.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\lua.xml" ${MementoSectionEnd} ${MementoSection} "AutoIt" AutoIt - Delete "$INSTDIR\plugins\APIs\autoit.xml" SetOutPath "$INSTDIR\autoCompletion" File ".\APIs\autoit.xml" ${MementoSectionEnd} @@ -184,128 +159,102 @@ SectionGroupEnd SectionGroup un.autoCompletionComponent Section un.PHP - Delete "$INSTDIR\plugins\APIs\php.xml" Delete "$INSTDIR\autoCompletion\php.xml" SectionEnd Section un.CSS - Delete "$INSTDIR\plugins\APIs\css.xml" Delete "$INSTDIR\autoCompletion\css.xml" SectionEnd Section un.HTML - Delete "$INSTDIR\plugins\APIs\html.xml" Delete "$INSTDIR\autoCompletion\html.xml" SectionEnd Section un.SQL - Delete "$INSTDIR\plugins\APIs\sql.xml" Delete "$INSTDIR\autoCompletion\sql.xml" SectionEnd Section un.RC - Delete "$INSTDIR\plugins\APIs\rc.xml" Delete "$INSTDIR\autoCompletion\rc.xml" SectionEnd Section un.VB - Delete "$INSTDIR\plugins\APIs\vb.xml" Delete "$INSTDIR\autoCompletion\vb.xml" SectionEnd Section un.Perl - Delete "$INSTDIR\plugins\APIs\perl.xml" Delete "$INSTDIR\autoCompletion\perl.xml" SectionEnd Section un.C - Delete "$INSTDIR\plugins\APIs\c.xml" Delete "$INSTDIR\autoCompletion\c.xml" SectionEnd Section un.C++ - Delete "$INSTDIR\plugins\APIs\cpp.xml" Delete "$INSTDIR\autoCompletion\cpp.xml" SectionEnd Section un.Java - Delete "$INSTDIR\plugins\APIs\java.xml" Delete "$INSTDIR\autoCompletion\java.xml" SectionEnd Section un.C# - Delete "$INSTDIR\plugins\APIs\cs.xml" Delete "$INSTDIR\autoCompletion\cs.xml" SectionEnd Section un.JavaScript - Delete "$INSTDIR\plugins\APIs\javascript.xml" Delete "$INSTDIR\autoCompletion\javascript.xml" SectionEnd Section un.Python - Delete "$INSTDIR\plugins\APIs\python.xml" Delete "$INSTDIR\autoCompletion\python.xml" SectionEnd Section un.ActionScript - Delete "$INSTDIR\plugins\APIs\actionscript.xml" Delete "$INSTDIR\autoCompletion\actionscript.xml" SectionEnd Section un.LISP - Delete "$INSTDIR\plugins\APIs\lisp.xml" Delete "$INSTDIR\autoCompletion\lisp.xml" SectionEnd Section un.VHDL - Delete "$INSTDIR\plugins\APIs\vhdl.xml" Delete "$INSTDIR\autoCompletion\vhdl.xml" SectionEnd Section un.TeX - Delete "$INSTDIR\plugins\APIs\tex.xml" Delete "$INSTDIR\autoCompletion\tex.xml" SectionEnd Section un.DocBook - Delete "$INSTDIR\plugins\APIs\xml.xml" Delete "$INSTDIR\autoCompletion\xml.xml" SectionEnd Section un.NSIS - Delete "$INSTDIR\plugins\APIs\nsis.xml" Delete "$INSTDIR\autoCompletion\nsis.xml" SectionEnd Section un.CMAKE - Delete "$INSTDIR\plugins\APIs\cmake.xml" Delete "$INSTDIR\autoCompletion\cmake.xml" SectionEnd Section un.BATCH - Delete "$INSTDIR\plugins\APIs\batch.xml" Delete "$INSTDIR\autoCompletion\batch.xml" SectionEnd Section un.CoffeeScript - Delete "$INSTDIR\plugins\APIs\coffee.xml" Delete "$INSTDIR\autoCompletion\coffee.xml" SectionEnd Section un.BaanC - Delete "$INSTDIR\plugins\APIs\baanc.xml" Delete "$INSTDIR\autoCompletion\baanc.xml" SectionEnd Section un.Lua - Delete "$INSTDIR\plugins\APIs\lua.xml" Delete "$INSTDIR\autoCompletion\lua.xml" SectionEnd - Section un.autoit - Delete "$INSTDIR\plugins\APIs\autoit.xml" Delete "$INSTDIR\autoCompletion\autoit.xml" SectionEnd diff --git a/PowerEditor/installer/nsisInclude/functionList.nsh b/PowerEditor/installer/nsisInclude/functionList.nsh new file mode 100644 index 00000000..2681c63e --- /dev/null +++ b/PowerEditor/installer/nsisInclude/functionList.nsh @@ -0,0 +1,281 @@ +; this file is part of installer for Notepad++ +; Copyright (C)2016 Don HO +; +; This program is free software; you can redistribute it and/or +; modify it under the terms of the GNU General Public License +; as published by the Free Software Foundation; either +; version 2 of the License, or (at your option) any later version. +; +; Note that the GPL places important restrictions on "derived works", yet +; it does not provide a detailed definition of that term. To avoid +; misunderstandings, we consider an application to constitute a +; "derivative work" for the purpose of this license if it does any of the +; following: +; 1. Integrates source code from Notepad++. +; 2. Integrates/includes/aggregates Notepad++ into a proprietary executable +; installer, such as those produced by InstallShield. +; 3. Links to a library or executes a program that does any of the above. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +SectionGroup "Function List Files" functionListComponent + SetOverwrite off + + ; UPDATE_PATH: the value is $UPDATE_PATH if doLocalConf.xml exit, + ; otherwise the value is $APPDATA\${APPNAME} + ${MementoSection} "C" C_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\c.xml" + ${MementoSectionEnd} + + ${MementoSection} "C++" C++_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\cpp.xml" + ${MementoSectionEnd} + + ${MementoSection} "Java" Java_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\java.xml" + ${MementoSectionEnd} + + ${MementoSection} "C#" C#_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\cs.xml" + ${MementoSectionEnd} + + ${MementoSection} "Assembly" Assembly_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\asm.xml" + ${MementoSectionEnd} + + ${MementoSection} "Bash" Bash_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\bash.xml" + ${MementoSectionEnd} + + ${MementoSection} "SQL" SQL_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\sql.xml" + ${MementoSectionEnd} + + ${MementoSection} "PHP" PHP_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\php.xml" + ${MementoSectionEnd} + + ${MementoSection} "COBOL section free" COBOL-section-free + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\cobol-free.xml" + ${MementoSectionEnd} + + ${MementoSection} "COBOL" COBOL_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\cobol.xml" + ${MementoSectionEnd} + + ${MementoSection} "Perl" Perl_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\perl.xml" + ${MementoSectionEnd} + + ${MementoSection} "JavaScript" JavaScript_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\javascript.js.xml" + ${MementoSectionEnd} + + ${MementoSection} "Python" Python_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\python.xml" + ${MementoSectionEnd} + + ${MementoSection} "ini" ini_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\ini.xml" + ${MementoSectionEnd} + + ${MementoSection} "Inno Setup" Innosetup_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\inno.xml" + ${MementoSectionEnd} + + ${MementoSection} "VHDL" VHDL_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\vhdl.xml" + ${MementoSectionEnd} + + ${MementoSection} "KRL" KRL_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\krl.xml" + ${MementoSectionEnd} + + ${MementoSection} "Override Map" OverrideMap_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\overrideMap.xml" + ${MementoSectionEnd} + + ${MementoSection} "NSIS" NSIS_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\nsis.xml" + ${MementoSectionEnd} + + ${MementoSection} "PowerShell" PowerShell_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\powershell.xml" + ${MementoSectionEnd} + + ${MementoSection} "BATCH" BATCH_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\batch.xml" + ${MementoSectionEnd} + + ${MementoSection} "Ruby" Ruby_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\ruby.xml" + ${MementoSectionEnd} + + ${MementoSection} "BaanC" BaanC_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\baanc.xml" + ${MementoSectionEnd} + + ${MementoSection} "Sinumerik" Sinumerik_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\sinumerik.xml" + ${MementoSectionEnd} + + ${MementoSection} "AutoIt" AutoIt_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\autoit.xml" + ${MementoSectionEnd} + + ${MementoSection} "UniVerse BASIC" UniVerseBASIC_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\universe_basic.xml" + ${MementoSectionEnd} + + ${MementoSection} "XML" XML_FL + SetOutPath "$UPDATE_PATH\functionList" + File ".\functionList\xml.xml" + ${MementoSectionEnd} +SectionGroupEnd + + + +SectionGroup un.functionListComponent + Section un.PHP_FL + Delete "$UPDATE_PATH\functionList\php.xml" + SectionEnd + + Section un.Assembly_FL + Delete "$UPDATE_PATH\functionList\asm.xml" + SectionEnd + + Section un.SQL_FL + Delete "$UPDATE_PATH\functionList\sql.xml" + SectionEnd + + Section un.Bash_FL + Delete "$UPDATE_PATH\functionList\bash.xml" + SectionEnd + + Section un.COBOL-section-free_FL + Delete "$UPDATE_PATH\functionList\cobol-free.xml" + SectionEnd + + Section un.Perl_FL + Delete "$UPDATE_PATH\functionList\perl.xml" + SectionEnd + + Section un.C_FL + Delete "$UPDATE_PATH\functionList\c.xml" + SectionEnd + + Section un.C++_FL + Delete "$UPDATE_PATH\functionList\cpp.xml" + SectionEnd + + Section un.Java_FL + Delete "$UPDATE_PATH\functionList\java.xml" + SectionEnd + + Section un.C#_FL + Delete "$UPDATE_PATH\functionList\cs.xml" + SectionEnd + + Section un.JavaScript_FL + Delete "$UPDATE_PATH\functionList\javascript.js.xml" + SectionEnd + + Section un.Python_FL + Delete "$UPDATE_PATH\functionList\python.xml" + SectionEnd + + Section un.COBOL_FL + Delete "$UPDATE_PATH\functionList\cobol.xml" + SectionEnd + + Section un.ini_FL + Delete "$UPDATE_PATH\functionList\ini.xml" + SectionEnd + + Section un.VHDL_FL + Delete "$UPDATE_PATH\functionList\vhdl.xml" + SectionEnd + + Section un.Innosetup_FL + Delete "$UPDATE_PATH\functionList\inno.xml" + SectionEnd + + Section un.XML_FL + Delete "$UPDATE_PATH\functionList\xml.xml" + SectionEnd + + Section un.NSIS_FL + Delete "$UPDATE_PATH\functionList\nsis.xml" + SectionEnd + + Section un.KRL_FL + Delete "$UPDATE_PATH\functionList\krl.xml" + SectionEnd + + Section un.BATCH_FL + Delete "$UPDATE_PATH\functionList\batch.xml" + SectionEnd + + Section un.OverrideMap_FL + Delete "$UPDATE_PATH\functionList\overrideMap.xml" + SectionEnd + + Section un.BaanC_FL + Delete "$UPDATE_PATH\functionList\baanc.xml" + SectionEnd + + Section un.PowerShell_FL + Delete "$UPDATE_PATH\functionList\powershell.xml" + SectionEnd + + Section un.AutoIt_FL + Delete "$UPDATE_PATH\functionList\autoit.xml" + SectionEnd + + Section un.Ruby_FL + Delete "$UPDATE_PATH\functionList\ruby.xml" + SectionEnd + + Section un.UniVerseBASIC_FL + Delete "$UPDATE_PATH\functionList\universe_basic.xml" + SectionEnd + + Section un.Sinumerik_FL + Delete "$UPDATE_PATH\functionList\sinumerik.xml" + SectionEnd + +SectionGroupEnd diff --git a/PowerEditor/installer/nsisInclude/mainSectionFuncs.nsh b/PowerEditor/installer/nsisInclude/mainSectionFuncs.nsh index 45823989..cadb83e2 100644 --- a/PowerEditor/installer/nsisInclude/mainSectionFuncs.nsh +++ b/PowerEditor/installer/nsisInclude/mainSectionFuncs.nsh @@ -85,14 +85,12 @@ Function copyCommonFiles SetOverwrite off SetOutPath "$UPDATE_PATH\" File "..\bin\contextMenu.xml" - File "..\bin\functionList.xml" SetOverwrite on SetOutPath "$INSTDIR\" File "..\bin\langs.model.xml" File "..\bin\stylers.model.xml" File "..\bin\contextMenu.xml" - File "..\bin\functionList.xml" SetOverwrite off File "..\bin\shortcuts.xml" diff --git a/PowerEditor/installer/packageAll.bat b/PowerEditor/installer/packageAll.bat index e2edaabf..4ddb3622 100644 --- a/PowerEditor/installer/packageAll.bat +++ b/PowerEditor/installer/packageAll.bat @@ -129,6 +129,7 @@ mkdir .\zipped.package.release\updater mkdir .\zipped.package.release\localization mkdir .\zipped.package.release\themes mkdir .\zipped.package.release\autoCompletion +mkdir .\zipped.package.release\functionList mkdir .\zipped.package.release\userDefineLangs mkdir .\zipped.package.release\plugins mkdir .\zipped.package.release\plugins\NppExport @@ -146,6 +147,7 @@ mkdir .\zipped.package.release64\updater mkdir .\zipped.package.release64\localization mkdir .\zipped.package.release64\themes mkdir .\zipped.package.release64\autoCompletion +mkdir .\zipped.package.release64\functionList mkdir .\zipped.package.release64\userDefineLangs mkdir .\zipped.package.release64\plugins mkdir .\zipped.package.release64\plugins\NppExport @@ -169,8 +171,6 @@ copy /Y ..\src\contextMenu.xml .\zipped.package.release\ If ErrorLevel 1 goto End copy /Y ..\src\shortcuts.xml .\zipped.package.release\ If ErrorLevel 1 goto End -copy /Y ..\src\functionList.xml .\zipped.package.release\ -If ErrorLevel 1 goto End copy /Y ..\bin\doLocalConf.xml .\zipped.package.release\ If ErrorLevel 1 goto End copy /Y ..\bin\"notepad++.exe" .\zipped.package.release\ @@ -194,8 +194,6 @@ copy /Y ..\src\contextMenu.xml .\zipped.package.release64\ If ErrorLevel 1 goto End copy /Y ..\src\shortcuts.xml .\zipped.package.release64\ If ErrorLevel 1 goto End -copy /Y ..\src\functionList.xml .\zipped.package.release64\ -If ErrorLevel 1 goto End copy /Y ..\bin\doLocalConf.xml .\zipped.package.release64\ If ErrorLevel 1 goto End copy /Y ..\bin64\"notepad++.exe" .\zipped.package.release64\ @@ -232,6 +230,12 @@ If ErrorLevel 1 goto End copy /Y ".\APIs\*.xml" .\zipped.package.release64\autoCompletion\ If ErrorLevel 1 goto End +rem FunctionList files: Copy all files into Notepad++ 32-bit/64-bit package folders +copy /Y ".\functionList\*.xml" .\zipped.package.release\functionList\ +If ErrorLevel 1 goto End +copy /Y ".\functionList\*.xml" .\zipped.package.release64\functionList\ +If ErrorLevel 1 goto End + rem Markdown as UserDefineLanguge: Markdown syntax highlighter into Notepad++ 32-bit/64-bit package folders copy /Y "..\bin\userDefineLangs\userDefinedLang-markdown.default.modern.xml" .\zipped.package.release\userDefineLangs\ If ErrorLevel 1 goto End diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp index db0776f6..1db9b073 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp @@ -478,12 +478,12 @@ void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **pp if (!doLocalConf) { generic_string funcListXmlPath = (NppParameters::getInstance()).getUserPath(); - PathAppend(funcListXmlPath, TEXT("functionList.xml")); + PathAppend(funcListXmlPath, TEXT("functionList")); if (!PathFileExists(funcListXmlPath.c_str())) { generic_string funcListDefaultXmlPath = (NppParameters::getInstance()).getNppPath(); - PathAppend(funcListDefaultXmlPath, TEXT("functionList.xml")); + PathAppend(funcListDefaultXmlPath, TEXT("functionList")); if (PathFileExists(funcListDefaultXmlPath.c_str())) { ::CopyFile(funcListDefaultXmlPath.c_str(), funcListXmlPath.c_str(), TRUE); @@ -498,7 +498,7 @@ void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **pp else { generic_string funcListDefaultXmlPath = (NppParameters::getInstance()).getNppPath(); - PathAppend(funcListDefaultXmlPath, TEXT("functionList.xml")); + PathAppend(funcListDefaultXmlPath, TEXT("functionList")); if (PathFileExists(funcListDefaultXmlPath.c_str())) { _funcParserMgr.init(funcListDefaultXmlPath, ppEditView); diff --git a/PowerEditor/src/WinControls/FunctionList/functionParser.cpp b/PowerEditor/src/WinControls/FunctionList/functionParser.cpp index c173a55f..85e738bc 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionParser.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionParser.cpp @@ -34,30 +34,19 @@ using namespace std; FunctionParsersManager::~FunctionParsersManager() { - for (size_t i = 0, len = _parsers.size(); i < len; ++i) + for (size_t i = 0, len = L_EXTERNAL + nbMaxUserDefined; i < len; ++i) { - delete _parsers[i]; + if (_parsers[i] != nullptr) + delete _parsers[i]; } - - delete _pXmlFuncListDoc; } -bool FunctionParsersManager::init(const generic_string& xmlPath, ScintillaEditView ** ppEditView) +bool FunctionParsersManager::init(const generic_string& xmlDirPath, ScintillaEditView ** ppEditView) { _ppEditView = ppEditView; - bool loadOkay = false; + _xmlDirPath = xmlDirPath; - if (PathFileExists(xmlPath.c_str())) - { - _pXmlFuncListDoc = new TiXmlDocument(xmlPath); - loadOkay = _pXmlFuncListDoc->LoadFile(); - if (loadOkay) - { - loadOkay = getFuncListFromXmlTree(); - } - } - - return loadOkay; + return getOverrideMapFromXmlTree(); } bool FunctionParsersManager::getZonePaserParameters(TiXmlNode *classRangeParser, generic_string &mainExprStr, generic_string &openSymboleStr, generic_string &closeSymboleStr, std::vector &classNameExprArray, generic_string &functionExprStr, std::vector &functionNameExprArray) @@ -153,20 +142,121 @@ bool FunctionParsersManager::getUnitPaserParameters(TiXmlNode *functionParser, g return true; } -void FunctionParsersManager::writeFunctionListXml(const TCHAR *destFoder) const + +bool FunctionParsersManager::loadFuncListFromXmlTree(LangType lType, const generic_string& overrideId, int udlIndex) { - generic_string dest = destFoder; - PathAppend(dest, TEXT("functionList.xml")); - if (_pXmlFuncListDoc) - _pXmlFuncListDoc->SaveFile(dest.c_str()); + generic_string funcListRulePath = _xmlDirPath; + funcListRulePath += TEXT("\\"); + int index = -1; + if (lType == L_USER) // UDL + { + if (overrideId.empty()) + return false; + + if (udlIndex == -1) + return false; + + index = udlIndex; + funcListRulePath += overrideId; + } + else // Supported Language + { + index = lType; + if (overrideId.empty()) + { + generic_string lexerName = ScintillaEditView::langNames[lType].lexerName; + funcListRulePath += lexerName; + funcListRulePath += TEXT(".xml"); + } + else + { + funcListRulePath += overrideId; + } + } + + if (index > _currentUDIndex) + return false; + + if (_parsers[index] == nullptr) + return false; + + TiXmlDocument xmlFuncListDoc(funcListRulePath); + bool loadOK = xmlFuncListDoc.LoadFile(); + + if (!loadOK) + return false; + + TiXmlNode *root = xmlFuncListDoc.FirstChild(TEXT("NotepadPlus")); + if (!root) + return false; + + root = root->FirstChild(TEXT("functionList")); + if (!root) + return false; + + TiXmlNode *parserRoot = root->FirstChild(TEXT("parser")); + if (!parserRoot) + return false; + + const TCHAR *id = (parserRoot->ToElement())->Attribute(TEXT("id")); + if (!id || !id[0]) + return false; + + generic_string commentExpr(TEXT("")); + const TCHAR *pCommentExpr = (parserRoot->ToElement())->Attribute(TEXT("commentExpr")); + if (pCommentExpr && pCommentExpr[0]) + commentExpr = pCommentExpr; + + std::vector classNameExprArray; + std::vector functionNameExprArray; + + const TCHAR *displayName = (parserRoot->ToElement())->Attribute(TEXT("displayName")); + if (!displayName || !displayName[0]) + displayName = id; + + TiXmlNode *classRangeParser = parserRoot->FirstChild(TEXT("classRange")); + TiXmlNode *functionParser = parserRoot->FirstChild(TEXT("function")); + if (classRangeParser && functionParser) + { + generic_string mainExpr, openSymbole, closeSymbole, functionExpr; + getZonePaserParameters(classRangeParser, mainExpr, openSymbole, closeSymbole, classNameExprArray, functionExpr, functionNameExprArray); + + generic_string mainExpr2; + std::vector classNameExprArray2; + std::vector functionNameExprArray2; + getUnitPaserParameters(functionParser, mainExpr2, functionNameExprArray2, classNameExprArray2); + FunctionUnitParser *funcUnitPaser = new FunctionUnitParser(id, displayName, commentExpr.c_str(), mainExpr2.c_str(), functionNameExprArray2, classNameExprArray2); + + _parsers[index]->_parser = new FunctionMixParser(id, displayName, commentExpr.c_str(), mainExpr.c_str(), openSymbole.c_str(), closeSymbole.c_str(), classNameExprArray, functionExpr.c_str(), functionNameExprArray, funcUnitPaser); + } + else if (classRangeParser) + { + generic_string mainExpr, openSymbole, closeSymbole, functionExpr; + getZonePaserParameters(classRangeParser, mainExpr, openSymbole, closeSymbole, classNameExprArray, functionExpr, functionNameExprArray); + _parsers[index]->_parser = new FunctionZoneParser(id, displayName, commentExpr.c_str(), mainExpr.c_str(), openSymbole.c_str(), closeSymbole.c_str(), classNameExprArray, functionExpr.c_str(), functionNameExprArray); + } + else if (functionParser) + { + generic_string mainExpr; + getUnitPaserParameters(functionParser, mainExpr, functionNameExprArray, classNameExprArray); + _parsers[index]->_parser = new FunctionUnitParser(id, displayName, commentExpr.c_str(), mainExpr.c_str(), functionNameExprArray, classNameExprArray); + } + + return true; } -bool FunctionParsersManager::getFuncListFromXmlTree() +bool FunctionParsersManager::getOverrideMapFromXmlTree() { - if (!_pXmlFuncListDoc) + generic_string funcListRulePath = _xmlDirPath; + funcListRulePath += TEXT("\\overrideMap.xml"); + + TiXmlDocument xmlFuncListDoc(funcListRulePath); + bool loadOK = xmlFuncListDoc.LoadFile(); + + if (!loadOK) return false; - TiXmlNode *root = _pXmlFuncListDoc->FirstChild(TEXT("NotepadPlus")); + TiXmlNode *root = xmlFuncListDoc.FirstChild(TEXT("NotepadPlus")); if (!root) return false; @@ -174,61 +264,6 @@ bool FunctionParsersManager::getFuncListFromXmlTree() if (!root) return false; - TiXmlNode *parserRoot = root->FirstChild(TEXT("parsers")); - if (!parserRoot) - return false; - - - for (TiXmlNode *childNode = parserRoot->FirstChildElement(TEXT("parser")); - childNode; - childNode = childNode->NextSibling(TEXT("parser")) ) - { - const TCHAR *id = (childNode->ToElement())->Attribute(TEXT("id")); - if (!id || !id[0]) - continue; - - generic_string commentExpr(TEXT("")); - const TCHAR *pCommentExpr = (childNode->ToElement())->Attribute(TEXT("commentExpr")); - if (pCommentExpr && pCommentExpr[0]) - commentExpr = pCommentExpr; - - - std::vector classNameExprArray; - std::vector functionNameExprArray; - - const TCHAR *displayName = (childNode->ToElement())->Attribute(TEXT("displayName")); - if (!displayName || !displayName[0]) - displayName = id; - - TiXmlNode *classRangeParser = childNode->FirstChild(TEXT("classRange")); - TiXmlNode *functionParser = childNode->FirstChild(TEXT("function")); - if (classRangeParser && functionParser) - { - generic_string mainExpr, openSymbole, closeSymbole, functionExpr; - getZonePaserParameters(classRangeParser, mainExpr, openSymbole, closeSymbole, classNameExprArray, functionExpr, functionNameExprArray); - - generic_string mainExpr2; - std::vector classNameExprArray2; - std::vector functionNameExprArray2; - getUnitPaserParameters(functionParser, mainExpr2, functionNameExprArray2, classNameExprArray2); - FunctionUnitParser *funcUnitPaser = new FunctionUnitParser(id, displayName, commentExpr.c_str(), mainExpr2.c_str(), functionNameExprArray2, classNameExprArray2); - - _parsers.push_back(new FunctionMixParser(id, displayName, commentExpr.c_str(), mainExpr.c_str(), openSymbole.c_str(), closeSymbole.c_str(), classNameExprArray, functionExpr.c_str(), functionNameExprArray, funcUnitPaser)); - } - else if (classRangeParser) - { - generic_string mainExpr, openSymbole, closeSymbole, functionExpr; - getZonePaserParameters(classRangeParser, mainExpr, openSymbole, closeSymbole, classNameExprArray, functionExpr, functionNameExprArray); - _parsers.push_back(new FunctionZoneParser(id, displayName, commentExpr.c_str(), mainExpr.c_str(), openSymbole.c_str(), closeSymbole.c_str(), classNameExprArray, functionExpr.c_str(), functionNameExprArray)); - } - else if (functionParser) - { - generic_string mainExpr; - getUnitPaserParameters(functionParser, mainExpr, functionNameExprArray, classNameExprArray); - _parsers.push_back(new FunctionUnitParser(id, displayName, commentExpr.c_str(), mainExpr.c_str(), functionNameExprArray, classNameExprArray)); - } - } - TiXmlNode *associationMapRoot = root->FirstChild(TEXT("associationMap")); if (associationMapRoot) { @@ -238,24 +273,29 @@ bool FunctionParsersManager::getFuncListFromXmlTree() { int langID; const TCHAR *langIDStr = (childNode->ToElement())->Attribute(TEXT("langID"), &langID); - const TCHAR *exts = (childNode->ToElement())->Attribute(TEXT("ext")); const TCHAR *id = (childNode->ToElement())->Attribute(TEXT("id")); const TCHAR *userDefinedLangName = (childNode->ToElement())->Attribute(TEXT("userDefinedLangName")); - if (((langIDStr && langIDStr[0]) || (exts && exts[0]) || (userDefinedLangName && userDefinedLangName[0])) && (id && id[0])) + + if (!(id && id[0])) + continue; + + if (langIDStr && langIDStr[0]) { - for (size_t i = 0, len = _parsers.size(); i < len; ++i) + _parsers[langID] = new ParserInfo(id); + } + else if (userDefinedLangName && userDefinedLangName[0]) + { + if (_currentUDIndex < L_EXTERNAL + nbMaxUserDefined) { - if (_parsers[i]->_id == id) - { - _associationMap.push_back(AssociationInfo(static_cast(i), langIDStr ? langID : -1, exts ? exts : TEXT(""), userDefinedLangName ? userDefinedLangName : TEXT(""))); - break; - } + ++_currentUDIndex; + _parsers[_currentUDIndex] = new ParserInfo(id, userDefinedLangName); + } } } } - return (_parsers.size() != 0); + return true; } FunctionParser * FunctionParsersManager::getParser(const AssociationInfo & assoInfo) @@ -263,7 +303,6 @@ FunctionParser * FunctionParsersManager::getParser(const AssociationInfo & assoI const unsigned char doNothing = 0; const unsigned char checkLangID = 1; const unsigned char checkUserDefined = 2; - const unsigned char checkExt = 3; unsigned char choice = doNothing; // langID != -1 && langID != L_USER @@ -272,39 +311,66 @@ FunctionParser * FunctionParsersManager::getParser(const AssociationInfo & assoI // langID == L_USER, we chack the userDefinedLangName else if (assoInfo._langID == L_USER && assoInfo._userDefinedLangName != TEXT("")) choice = checkUserDefined; - // langID == -1, we chack the ext - else if (assoInfo._langID == -1 && assoInfo._ext != TEXT("")) - choice = checkExt; else return NULL; - for (size_t i = 0, len = _associationMap.size(); i < len; ++i) + switch (choice) { - switch (choice) + case checkLangID: { - case checkLangID: + if (_parsers[assoInfo._langID] != nullptr) { - if (assoInfo._langID == _associationMap[i]._langID) - return _parsers[_associationMap[i]._id]; + if (_parsers[assoInfo._langID]->_parser != nullptr) + return _parsers[assoInfo._langID]->_parser; + else + { + // load it + if (loadFuncListFromXmlTree(static_cast(assoInfo._langID), _parsers[assoInfo._langID]->_id)) + return _parsers[assoInfo._langID]->_parser; + } } - break; - - case checkUserDefined: + else { - if (assoInfo._userDefinedLangName == _associationMap[i]._userDefinedLangName) - return _parsers[_associationMap[i]._id]; - } - break; + _parsers[assoInfo._langID] = new ParserInfo; + // load it + if (loadFuncListFromXmlTree(static_cast(assoInfo._langID), _parsers[assoInfo._langID]->_id)) + return _parsers[assoInfo._langID]->_parser; - case checkExt: - { - if (assoInfo._ext == _associationMap[i]._ext) - return _parsers[_associationMap[i]._id]; + return nullptr; } - break; - } + break; + + case checkUserDefined: + { + if (_currentUDIndex == L_EXTERNAL) // no User Defined Language parser + return nullptr; + + for (int i = L_EXTERNAL + 1; i <= _currentUDIndex; ++i) + { + if (_parsers[i]->_userDefinedLangName == assoInfo._userDefinedLangName) + { + if (_parsers[i]->_parser) + { + return _parsers[i]->_parser; + } + else + { + // load it + if (loadFuncListFromXmlTree(static_cast(assoInfo._langID), _parsers[i]->_id, i)) + return _parsers[i]->_parser; + } + + break; + } + } + + return nullptr; + } + break; + } + return NULL; } @@ -427,9 +493,6 @@ generic_string FunctionParser::parseSubLevel(size_t begin, size_t end, std::vect bool FunctionParsersManager::parse(std::vector & foundInfos, const AssociationInfo & assoInfo) { - if (!_pXmlFuncListDoc) - return false; - // Serch the right parser from the given ext in the map FunctionParser *fp = getParser(assoInfo); if (!fp) diff --git a/PowerEditor/src/WinControls/FunctionList/functionParser.h b/PowerEditor/src/WinControls/FunctionList/functionParser.h index b694fc18..78768767 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionParser.h +++ b/PowerEditor/src/WinControls/FunctionList/functionParser.h @@ -139,6 +139,19 @@ struct AssociationInfo final }; }; +const int nbMaxUserDefined = 25; + +struct ParserInfo +{ + generic_string _id; // xml parser rule file name - if empty, then we use default name. Mandatory if _userDefinedLangName is not empty + FunctionParser* _parser = nullptr; + generic_string _userDefinedLangName; + + ParserInfo() {}; + ParserInfo(const generic_string& id): _id(id) {}; + ParserInfo(const generic_string& id, const generic_string& userDefinedLangName): _id(id), _userDefinedLangName(userDefinedLangName) {}; + ~ParserInfo() { if (_parser) delete _parser; } +}; class FunctionParsersManager final { @@ -147,16 +160,16 @@ public: bool init(const generic_string& xmlPath, ScintillaEditView ** ppEditView); bool parse(std::vector & foundInfos, const AssociationInfo & assoInfo); - void writeFunctionListXml(const TCHAR *destFoder) const; private: ScintillaEditView **_ppEditView = nullptr; - std::vector _parsers; - std::vector _associationMap; - TiXmlDocument *_pXmlFuncListDoc = nullptr; + generic_string _xmlDirPath; + ParserInfo* _parsers[L_EXTERNAL + nbMaxUserDefined] = {nullptr}; + int _currentUDIndex = L_EXTERNAL; - bool getFuncListFromXmlTree(); + bool getOverrideMapFromXmlTree(); + bool loadFuncListFromXmlTree(LangType lType, const generic_string& overrideId, int udlIndex = -1); bool getZonePaserParameters(TiXmlNode *classRangeParser, generic_string &mainExprStr, generic_string &openSymboleStr, generic_string &closeSymboleStr, std::vector &classNameExprArray, generic_string &functionExprStr, std::vector &functionNameExprArray); bool getUnitPaserParameters(TiXmlNode *functionParser, generic_string &mainExprStr, std::vector &functionNameExprArray, std::vector &classNameExprArray); FunctionParser * getParser(const AssociationInfo & assoInfo); diff --git a/PowerEditor/src/functionList.xml b/PowerEditor/src/functionList.xml deleted file mode 100644 index 08d6fd95..00000000 --- a/PowerEditor/src/functionList.xml +++ /dev/null @@ -1,1738 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PowerEditor/visual.net/notepadPlus.vcxproj b/PowerEditor/visual.net/notepadPlus.vcxproj index f784003b..b2cb466a 100755 --- a/PowerEditor/visual.net/notepadPlus.vcxproj +++ b/PowerEditor/visual.net/notepadPlus.vcxproj @@ -217,7 +217,6 @@ copy ..\src\langs.model.xml ..\bin\langs.model.xml copy ..\src\stylers.model.xml ..\bin\stylers.model.xml copy ..\src\shortcuts.xml ..\bin\shortcuts.xml -copy ..\src\functionList.xml ..\bin\functionList.xml copy ..\src\contextMenu.xml ..\bin\contextMenu.xml @@ -270,7 +269,6 @@ copy ..\src\contextMenu.xml ..\bin\contextMenu.xml copy ..\src\langs.model.xml ..\bin64\langs.model.xml copy ..\src\stylers.model.xml ..\bin64\stylers.model.xml copy ..\src\shortcuts.xml ..\bin64\shortcuts.xml -copy ..\src\functionList.xml ..\bin64\functionList.xml copy ..\src\contextMenu.xml ..\bin64\contextMenu.xml @@ -679,7 +677,6 @@ copy ..\src\contextMenu.xml ..\bin64\contextMenu.xml - diff --git a/appveyor.yml b/appveyor.yml index d72f7ddf..b988aa43 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 7.8.{build} +version: 7.9.{build} image: Visual Studio 2017 @@ -62,8 +62,8 @@ after_build: if ($env:PLATFORM_INPUT -eq "Win32" -and $env:CONFIGURATION -eq "Unicode Debug") { Push-AppveyorArtifact "PowerEditor\visual.net\Unicode Debug\Notepad++.exe" -FileName "$nppFileName" - Start-FileDownload 'https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.8.9/npp.7.8.9.bin.minimalist.7z' - 7z x -y npp.7.8.9.bin.minimalist.7z | Out-Null + Start-FileDownload 'https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.9/npp.7.9.portable.minimalist.7z' + 7z x -y npp.7.9.portable.minimalist.7z | Out-Null #take SciLexer.dll from downloaded version due to dependency of the functionlist tests on a version build with boost regex #what is not the case for the dll build on appveyor CI (would either need a very time consuming boost build or usage of nuget packages) Copy-Item "$env:APPVEYOR_BUILD_FOLDER\SciLexer.dll" -Destination "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\bin" @@ -71,8 +71,8 @@ after_build: Copy-Item "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\src\langs.model.xml" -Destination "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\bin" Copy-Item "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\src\stylers.model.xml" -Destination "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\bin" Copy-Item "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\src\shortcuts.xml" -Destination "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\bin" - Copy-Item "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\src\functionList.xml" -Destination "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\bin" Copy-Item "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\src\contextMenu.xml" -Destination "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\bin" + Copy-Item "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\installer\functionList" -Destination "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\bin" -Recurse cd .\PowerEditor\Test\FunctionList\ .\unitTestLauncher.ps1 .\unitTestLauncher.ps1