Added Visual Basic function list + unittest case

Fix #3239, close #15953
This commit is contained in:
Christian Grasser 2024-12-15 12:32:36 +01:00 committed by Don Ho
parent f5f7c14853
commit d6a32d2f0c
4 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1,15 @@
Module Program
Public num1 As Integer
Public num2 As Integer
Public answer As Integer
Sub Main(args As String())
Console.Write("Type a number and press Enter")
num1 = Console.ReadLine()
Console.Write("Type another number to add to it and press Enter")
num2 = Console.ReadLine()
answer = num1 + num2
Console.WriteLine("The answer is " & answer)
Console.Write("Press any key to continue...")
Console.ReadKey(True)
End Sub
End Module

View File

@ -0,0 +1 @@
{"leaves":["Main"],"root":"unitTest"}

View File

@ -0,0 +1,50 @@
<?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>
<!-- ========================================================== [ VBS ] -->
<!--
| Based on:
| http://sourceforge.net/p/notepad-plus/patches/613/
\-->
<parser
displayName="Visual Basic (.NET|Script|for Applications)"
id ="vb_function"
commentExpr="(?m:((?&lt;=&apos;).*?$)|((?i:REM)([\t ].*?)?$))"
>
<classRange
mainExpr="(?s:(?&lt;SCOPE&gt;(?i:CLASS|TYPE)).*?(?i:END[\t ]\k&lt;SCOPE&gt;))"
displayMode="node" >
<className>
<nameExpr expr="(?i:CLASS|TYPE)[\t ]+(?:[A-Za-z_][\w]*\b)(?:.*?[\r\n])" />
<nameExpr expr="[\t ]+(?:[A-Za-z_][\w]*\b)" />
<nameExpr expr="[A-Za-z_][\w]*" />
</className>
<function
mainExpr="(?m:^[\t ]*(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:(?:STATIC|SHARED|SHADOWS|OVERRIDABLE|OVERRIDES|READONLY|WRITEONLY)[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$))" >
<functionName>
<funcNameExpr expr="(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:STATIC[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
<funcNameExpr expr="(?i:(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
<funcNameExpr expr="(?i:(?:GET|LET|SET)[\t ]+)?[A-Za-z_][\w]*(?=[\t ]*\()"/>
</functionName>
</function>
</classRange>
<function
mainExpr="^[\t ]*(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:(?:STATIC|(?:DECLARE(?:[\t ]+(ANSI|UNICODE|AUTO))?))[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"
displayMode="$functionName">
<functionName>
<nameExpr expr="(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:(?:STATIC|(?:DECLARE(?:[\t ]+(?:ANSI|UNICODE|AUTO))?))[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
<nameExpr expr="(?i:(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
<nameExpr expr="(?i:(?:GET|LET|SET)[\t ]+)?[A-Za-z_][\w]*(?i:[\t ]+(LIB|ALIAS)[\t ]+[\w&quot;\.]+)*(?=[\t ]*\()"/>
</functionName>
</function>
</parser>
</functionList>
</NotepadPlus>

View File

@ -218,6 +218,11 @@ SectionGroup "Function List Files" functionListComponent
File ".\functionList\latex.xml"
${MementoSectionEnd}
${MementoSection} "VisualBasic" VB_FL
SetOutPath "$INSTDIR\functionList"
File ".\functionList\vb.xml"
${MementoSectionEnd}
${MementoSection} "NppExecScript" NppExecScript_FL
SetOutPath "$INSTDIR\functionList"
File ".\functionList\nppexec.xml"
@ -397,6 +402,10 @@ SectionGroup un.functionListComponent
Delete "$INSTDIR\functionList\latex.xml"
SectionEnd
Section un.VB_FL
Delete "$INSTDIR\functionList\vb.xml"
SectionEnd
Section un.NppExecScript_FL
Delete "$INSTDIR\functionList\nppexec.xml"
SectionEnd