Skip to content

Commit

Permalink
Split functionList.xml into multifile in "functionList" Folder
Browse files Browse the repository at this point in the history
New "functionList" will be added beside of notepad++.exe or "%APPDATA%\Notepad++\", according the installation mode. If the portable package is used, after removing "doLocalConf.xml", the "functionList" folder should be copied manually from Notepad++ installed directory to "%APPDATA%\Notepad++\" to make function list work again.

All splited files are localized in this folder with the explicit language name.

"overrideMap.xml" is optional for overriding the default functionList parse rule files, and for adding UDL parse rule files.

Close #4896
  • Loading branch information
donho committed Oct 21, 2020
1 parent 0a20939 commit c0c070a
Show file tree
Hide file tree
Showing 44 changed files with 2,551 additions and 2,051 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -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/
Expand Down
12 changes: 5 additions & 7 deletions 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()

Expand Down Expand Up @@ -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
Expand All @@ -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}"
Expand Down Expand Up @@ -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;
Expand Down
117 changes: 0 additions & 117 deletions PowerEditor/Test/FunctionList/functionList.xsd

This file was deleted.

6 changes: 4 additions & 2 deletions PowerEditor/Test/FunctionList/unitTest.ps1
Expand Up @@ -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]
Expand Down Expand Up @@ -35,5 +37,5 @@ Try {
}
Catch
{
return -1
}
return -2
}
20 changes: 15 additions & 5 deletions PowerEditor/Test/FunctionList/unitTestLauncher.ps1
Expand Up @@ -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"

Expand All @@ -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
}

Expand All @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion PowerEditor/gcc/makefile
Expand Up @@ -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))
Expand Down
30 changes: 30 additions & 0 deletions PowerEditor/installer/functionList/asm.xml
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- ==========================================================================\
|
| To learn how to make your own language parser, please check the following
| link:
| https://npp-user-manual.org/docs/function-list/
|
\=========================================================================== -->
<NotepadPlus>
<functionList>
<!-- ==================================================== [ Assembly ] -->

<parser
displayName="Assembly"
id ="assembly_subroutine"
commentExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
(?m-s:;.*$) # Single Line Comment
"
>
<function
mainExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
(?m)^\h* # optional leading whitespace
\K # keep the text matched so far, out of the overall match
[A-Za-z_$][\w$]* # valid character combination for labels
(?=:) # up till the colon
"
/>
</parser>
</functionList>
</NotepadPlus>
41 changes: 41 additions & 0 deletions PowerEditor/installer/functionList/autoit.xml
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- ==========================================================================\
|
| To learn how to make your own language parser, please check the following
| link:
| https://npp-user-manual.org/docs/function-list/
|
\=========================================================================== -->
<NotepadPlus>
<functionList>
<!-- ===================================================== [ AutoIt3 ] -->

<!--
| Based on:
| https://sourceforge.net/p/notepad-plus/discussion/331753/thread/5d9bb881/#e86e
\-->
<parser
displayName="AutoIt3"
id ="autoit3_function"
commentExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
(?is:\x23cs.*?\x23ce) # Multi Line Comment
| (?m-s:^\h*;.*?$) # Single Line Comment
"
>
<function
mainExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
(?m)^\h* # optional leading whitespace
(?i:FUNC\s+) # start-of-function indicator
\K # keep the text matched so far, out of the overall match
[A-Za-z_]\w* # valid character combination for identifiers
\s*\([^()]*?\) # parentheses required, parameters optional
"
>
<!-- comment out the following node to display the function with its parameters -->
<functionName>
<nameExpr expr="[A-Za-z_]\w*" />
</functionName>
</function>
</parser>
</functionList>
</NotepadPlus>

0 comments on commit c0c070a

Please sign in to comment.