From e3e439dda5ffbcb6557e7e1825f0ecb33ccf2636 Mon Sep 17 00:00:00 2001 From: zufuliu Date: Mon, 11 Nov 2024 21:54:01 +0800 Subject: [PATCH] Add script to generate API for VB.NET, VBA and VBScript, issue #735. --- scintilla/lexers/LexVB.cxx | 51 ++-- src/EditLexers/stlHTML.cpp | 14 +- src/EditLexers/stlVB.cpp | 169 +++++++----- src/EditLexers/stlVBS.cpp | 116 ++++---- tools/KeywordCore.py | 68 ++++- tools/KeywordUpdate.py | 4 +- tools/lang/JavaScript.js | 11 +- tools/lang/VB.NET.vb | 536 +++++++++++++++++++++++++++++++++++++ tools/lang/VBA.bas | 500 ++++++++++++++++++++++++++++++++++ tools/lang/VBScript.vbs | 334 +++++++++++++++++++++++ 10 files changed, 1649 insertions(+), 154 deletions(-) create mode 100644 tools/lang/VB.NET.vb create mode 100644 tools/lang/VBA.bas create mode 100644 tools/lang/VBScript.vbs diff --git a/scintilla/lexers/LexVB.cxx b/scintilla/lexers/LexVB.cxx index 515c7804f5..e76e2569e5 100644 --- a/scintilla/lexers/LexVB.cxx +++ b/scintilla/lexers/LexVB.cxx @@ -49,9 +49,24 @@ enum { VBLineType_VB6TypeLine = 4, VBLineStateLineContinuation = 1 << 3, VBLineStateStringInterpolation = 1 << 4, - MaxKeywordSize = 64, }; +//KeywordIndex++Autogenerated -- start of section automatically generated +enum { + KeywordIndex_Keyword = 0, + KeywordIndex_TypeKeyword = 1, + KeywordIndex_VbaKeyword = 2, + KeywordIndex_Preprocessor = 3, + KeywordIndex_Attribute = 4, + KeywordIndex_Class = 5, + KeywordIndex_Interface = 6, + KeywordIndex_Enumeration = 7, + KeywordIndex_Constant = 8, + KeywordIndex_BasicFunction = 9, + MaxKeywordSize = 32, +}; +//KeywordIndex--Autogenerated -- end of section automatically generated + #define LexCharAt(pos) styler.SafeGetCharAt(pos) // https://learn.microsoft.com/en-us/dotnet/visual-basic/reference/language-specification/lexical-grammar#type-characters @@ -103,13 +118,6 @@ inline bool IsInterpolatedStringEnd(const StyleContext &sc) noexcept { } void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, LexerWordList keywordLists, Accessor &styler) { - const WordList &keywords = keywordLists[0]; - const WordList &keywords2 = keywordLists[1]; - const WordList &keywords3 = keywordLists[2]; - const WordList &keywords4 = keywordLists[3]; - const WordList &keywords5 = keywordLists[4]; - const WordList &keywords6 = keywordLists[5]; - KeywordType kwType = KeywordType::None; int lineState = 0; int parenCount = 0; @@ -169,7 +177,7 @@ void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyl const KeywordType kwPrev = kwType; kwType = KeywordType::None; if (s[0] == '#') { - if (keywords4.InList(s + 1)) { + if (keywordLists[KeywordIndex_Preprocessor].InList(s + 1)) { sc.ChangeState(SCE_VB_PREPROCESSOR); if (StrEqualsAny(s + 1, "if", "end", "elseif")) { kwType = KeywordType::Preprocessor; @@ -183,7 +191,7 @@ void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyl } else { const int chNext = sc.GetLineNextChar(); if (s[0] != '[') { - if (keywords.InList(s)) { + if (keywordLists[KeywordIndex_Keyword].InListPrefixed(s, '(')) { sc.ChangeState(SCE_VB_KEYWORD3); if (!skipType && chBefore != '.') { sc.ChangeState(SCE_VB_KEYWORD); @@ -209,14 +217,25 @@ void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyl kwType = KeywordType::AccessModifier; } } - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_VB_KEYWORD2); - } else if (keywords3.InList(s)) { + } else if (keywordLists[KeywordIndex_VbaKeyword].InList(s)) { sc.ChangeState(SCE_VB_KEYWORD3); - } else if (keywords5.InList(s)) { + if (language == Language::VBA && !skipType && chBefore != '.') { + sc.ChangeState(SCE_VB_KEYWORD); + } + } else if (keywordLists[KeywordIndex_TypeKeyword].InList(s)) { + sc.ChangeState(SCE_VB_KEYWORD2); + } else if (keywordLists[KeywordIndex_Class].InList(s)) { + sc.ChangeState(SCE_VB_CLASS); + } else if (keywordLists[KeywordIndex_Interface].InList(s)) { + sc.ChangeState(SCE_VB_INTERFACE); + } else if (keywordLists[KeywordIndex_Enumeration].InList(s)) { + sc.ChangeState(SCE_VB_ENUM); + } else if (keywordLists[KeywordIndex_Attribute].InListPrefixed(s, '(')) { sc.ChangeState(SCE_VB_ATTRIBUTE); - } else if (keywords6.InList(s)) { + } else if (keywordLists[KeywordIndex_Constant].InList(s)) { sc.ChangeState(SCE_VB_CONSTANT); + } else if (keywordLists[KeywordIndex_BasicFunction].InListPrefixed(s, '(')) { + sc.ChangeState(SCE_VB_BASIC_FUNCTION); } } if (sc.state == SCE_VB_IDENTIFIER) { @@ -583,7 +602,7 @@ void FoldVBDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, Le if (isEnd) isEnd = false; } } - else if (style == SCE_VB_PREPROCESSOR && ch == '#') { + else if (style == SCE_VB_PREPROCESSOR && stylePrev != SCE_VB_PREPROCESSOR) { if (VBMatch("#if") || VBMatch("#region") || VBMatch("#externalsource")) levelNext++; else if (VBMatch("#end")) diff --git a/src/EditLexers/stlHTML.cpp b/src/EditLexers/stlHTML.cpp index 9f6a717a0a..5a2577d177 100644 --- a/src/EditLexers/stlHTML.cpp +++ b/src/EditLexers/stlHTML.cpp @@ -26,12 +26,14 @@ static KEYWORDLIST Keywords_HTML = {{ "this throw true try typeof undefined var void while with yield " , // 2 VBScript -"Alias And As Attribute Begin Boolean ByRef Byte ByVal Call Case Class Compare Const Continue " -"Currency Date Declare Dim Do Double Each Else ElseIf Empty End Enum Eqv Erase Error Event Exit " -"Explicit False For Friend Function Get Global GoSub Goto If Imp Implement In Integer Is Let Lib " -"Load Long Loop LSet Me Mid Mod Module New Next Not Nothing Null Object On Option Optional Or " -"Preserve Private Property Public RaiseEvent ReDim Rem Resume Return RSet Select Set Single " -"Static Stop String Sub Then To True Type Unload Until Variant WEnd While With WithEvents Xor" +"Alias And As Attribute Begin Boolean ByRef Byte ByVal Call Case Char Class Compare Const Continue Currency " +"Decimal Declare Default Dim Do Double " +"Each Else ElseIf Empty End EndIf Enum Eqv Erase Error Event Execute ExecuteGlobal Exit Explicit " +"False For Friend Function Get Global GoSub GoTo If Imp Implements In Integer Is " +"Let Lib Like Load Long LongLong LongPtr Loop LSet Me Mod Module New Next Not Nothing Null Object On Option Optional Or " +"ParamArray Preserve Private Property Public RaiseEvent Randomize ReDim Rem Resume Return RSet " +"Select Set Shared Single Static Step Stop String Sub Then To True Type TypeOf Unload Until Variant " +"Wend While With WithEvents Xor " , // 3 Python nullptr diff --git a/src/EditLexers/stlVB.cpp b/src/EditLexers/stlVB.cpp index 0a617adb05..92318125f2 100644 --- a/src/EditLexers/stlVB.cpp +++ b/src/EditLexers/stlVB.cpp @@ -1,74 +1,104 @@ #include "EditLexer.h" #include "EditStyleX.h" -// Visual Basic Language Reference -// https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/ -// https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/keywords/ -// https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/runtime-library-members - static KEYWORDLIST Keywords_VB = {{ -"AddHandler AddressOf Alias And AndAlso As ByRef ByVal Call Case Catch Class Const Continue " -"Declare Default Delegate Dim DirectCast Do Each Else ElseIf End Enum Erase Error Event Exit " -"False Finally For Friend Function Get GetType GetXMLNamespace Global Goto Handles If Implements " -"Imports In Inherits Interface Is IsNot Let Lib Like Loop Me Mod Module MustInherit MustOverride " -"My MyBase MyClass NameOf Namespace Narrowing New Next Not Nothing NotInheritable NotOverridable Of On " -"Operator Option Optional Or OrElse Out Overloads Overridable Overrides ParamArray Partial Private " -"Property Protected Public RaiseEvent Readonly ReDim Rem RemoveHandler Resume Return Select Set " -"Shadows Shared Static Step Stop Structure Sub SyncLock Then Throw To True Try TryCast TypeOf Using " -"When While Widening With WithEvents WriteOnly Xor " -// Unreserved Keyword -"Aggregate Ansi Assembly Async Attribute Auto Await Binary By Compare Custom Distinct Equals Explicit " -"From Group Into IsFalse IsTrue Iterator Join Key Mid Off Order Preserve Skip Strict Take Text Unicode Until Where Yield " +//++Autogenerated -- start of section automatically generated +"AddHandler AddHandler( AddressOf Aggregate Alias And AndAlso Ansi As Assembly Async Auto Await Binary By ByRef ByVal " +"Call Case Catch Class Compare Const Continue Custom Declare Default Delegate Dim DirectCast Distinct Do " +"Each Else ElseIf End Enum Equals Erase Error Event Exit Explicit False Finally For Friend From Function " +"Get GetType( GetXMLNamespace( Global GoTo Group Handles " +"If If( Implements Imports In Infer Inherits Interface Into Is IsFalse( IsNot IsTrue( Iterator Join Key " +"Let Lib Like Loop Me Mod Module MustInherit MustOverride My MyBase MyClass " +"NameOf( Namespace Narrowing New Next Not Nothing NotInheritable NotOverridable " +"Of Off On Operator Option Optional Or Order OrElse Out Overloads Overridable Overrides " +"ParamArray Partial Preserve Private Property Protected Public " +"RaiseEvent RaiseEvent( ReadOnly ReDim Rem RemoveHandler RemoveHandler( Resume Return " +"Select Set Set( Shadows Shared Skip Static Step Stop Strict Structure Sub SyncLock " +"Take Text Then Throw To True Try TryCast( TypeOf Unicode Until Using " +"When Where While Widening With WithEvents WriteOnly Xor Yield " + +, // 1 type keyword +"Any Boolean Byte Char Currency Date Decimal Double Integer Long LongLong LongPtr Object SByte Short Single String " +"UInteger ULong UShort Variant " + +, // 2 vba keyword +"Access Attribute Base Begin BeginProperty Close " +"Database DefBool DefByte DefCur DefDate DefDbl DefDec DefInt DefLng DefLngLng DefLngPtr DefObj DefSng DefStr DefVar " +"Empty EndIf EndProperty Eqv GoSub Imp Line Load Name Null Open PtrSafe Put SavePicture SendKeys Type Unload Version " +"Wend Width " + +, // 3 preprocessor +"Const Disable Else ElseIf Enable End EndIf ExternalChecksum ExternalSource If Region " -"Array Any Count GroupBy OrderBy " -// VB6 -"Begin BeginProperty EndProperty Type" +, // 4 attribute +"AttributeUsage( ComClass( Conditional( DllImport( HideModuleName( MarshalAs( MyGroupCollection( Obsolete( " +"Serializable( StructLayout( VBFixedArray( VBFixedString( " -, // 1 Type Keyword -"Boolean Byte CBool CByte CChar CDate CDbl CDec Char CInt CLng CObj CSByte CShort CSng CStr CType CUInt " -"CULng CUShort Date Decimal Double Integer Long Object SByte Short Single String UInteger ULong UShort " -"Currency LongLong LongPtr Variant Empty Null CCur CLngLng CLngPtr CVar CVDate CVErr " +, // 5 class +"Collection Console ControlChars Conversion DateAndTime Debug Dictionary Drive Err ErrObject " +"File FileSystem FileSystemObject Financial Folder Information Interaction Math Strings TextStream VBMath " -, // 2 not used keyword, used in VBScript -"EndIf GoSub Wend " +, // 6 interface +nullptr -, // 3 Preprocessor -"If Else ElseIf End Const Region ExternalChecksum ExternalSource Disable Enable " +, // 7 enumeration +"AppWinStyle AttributeTargets CallType CompareMethod DateFormat DateInterval DueDate " +"FileAttribute FirstDayOfWeek FirstWeekOfYear LayoutKind MsgBoxResult MsgBoxStyle OpenAccess OpenMode OpenShare TriState " +"VariantType VbStrConv " -, // 4 Attribute -"ComClass HideModuleName WebMethod Serializable MarshalAs AttributeUsage DllImport StructLayout VBFixedString VBFixedArray" +, // 8 constant +"vbAbort vbAbortRetryIgnore vbAlias vbApplicationModal vbAppTaskManager vbAppWindows vbArchive vbArray " +"vbBack vbBinaryCompare vbBlack vbBlue vbBoolean vbByte " +"vbCalGreg vbCalHijri vbCancel vbChar vbCr vbCritical vbCrLf vbCurrency vbCyan vbDatabaseCompare vbDataObject vbDate " +"vbDecimal vbDefaultButton1 vbDefaultButton2 vbDefaultButton3 vbDefaultButton4 vbDirectory vbDouble " +"vbEmpty vbError vbExclamation " +"vbFalse vbFirstFourDays vbFirstFullWeek vbFirstJan1 vbFormCode vbFormControlMenu vbFormFeed vbFriday vbFromUnicode " +"vbGeneralDate vbGet vbGreen vbHidden vbHide vbHiragana vbIgnore vbInformation vbInteger vbKatakana " +"vbLet vbLf vbLinguisticCasing vbLong vbLongDate vbLongLong vbLongTime vbLowerCase vbMagenta vbMaximizedFocus vbMethod " +"vbMinimizedFocus vbMinimizedNoFocus vbModal vbModeless vbMonday " +"vbMsgBoxHelp vbMsgBoxHelpButton vbMsgBoxRight vbMsgBoxRtlReading VbMsgBoxSetForeground " +"vbNarrow vbNewLine vbNo vbNormal vbNormalFocus vbNormalNoFocus vbNull vbNullChar vbNullString " +"vbObject vbObjectError vbOK vbOKCancel vbOKOnly vbProperCase vbQuestion vbReadOnly vbRed vbRetry vbRetryCancel " +"vbSaturday vbSet vbShortDate vbShortTime vbSimplifiedChinese vbSingle vbString vbSunday vbSystem vbSystemModal " +"vbTab vbTextCompare vbThursday vbTraditionalChinese vbTrue vbTuesday " +"vbUnicode vbUpperCase vbUseCompareOption vbUseDefault vbUserDefinedType vbUseSystem vbUseSystemDayOfWeek " +"vbVariant vbVerticalTab vbVolume vbWednesday vbWhite vbWide vbYellow vbYes vbYesNo vbYesNoCancel " -, // 5 VB Const -// String -"vbCr VbCrLf vbFormFeed vbLf vbNewLine vbNullChar vbNullString vbTab vbVerticalTab " -// MsgBox -"vbOK vbCancel vbAbort vbRetry vbIgnore vbYes vbNo " -"vbOKOnly vbOKCancel vbAbortRetryIgnore vbYesNoCancel vbYesNo vbRetryCancel " -"vbCritical vbQuestion vbExclamation vbInformation vbDefaultButton1 vbDefaultButton2 " -"vbDefaultButton3 vbApplicationModal vbSystemModal " -"vbMsgBoxHelp vbMsgBoxRight vbMsgBoxRtlReading vbMsgBoxSetForeground " -// Comparison -"vbBinaryCompare vbTextCompare " -// Date and Time -"vbSunday vbMonday vbTuesday vbWednesday vbThursday vbFriday vbSaturday " -"vbUseSystemDayOfWeek vbFirstJan1 vbFirstFourDays vbFirstFullWeek " -// Date Format -"vbGeneralDate vbLongDate vbShortDate vbLongTime vbShortTime " -// Tristate -"vbUseDefault vbTrue vbFalse " -// VarType -"vbEmpty vbNull vbInteger vbLong vbSingle vbDouble vbCurrency vbDate vbString " -"vbObject vbBoolean vbVariant vbDecimal vbByte vbArray vbDirectory " -// Miscellaneous -"vbObjectError vbArchive vbBack vbGet vbHidden vbHide vbLet vbLinguisticCasing " -"vbLowerCase vbMaximizedFocus vbMethod vbMinimizedFocus vbMinimizedNoFocus " -"vbNarrow vbNormal vbNormalFocus vbNormalNoFocus vbProperCase vbReadOnly vbSet " -"vbSystem vbUpperCase vbUserDefinedType vbUseSystem vbVolume vbWide " -"vbHiragana vbKatakana vbSimplifiedChinese vbTraditionalChinese " +, // 9 basic function +"Abs( AppActivate( Array( Asc( AscB( AscW( Atn( Beep( " +"CallByName( CBool( CByte( CChar( CCur( CDate( CDbl( CDec( ChDir( ChDrive( Choose( Chr( ChrB( ChrW( CInt( " +"CLng( CLngLng( CLngPtr( CObj( Command( Cos( CreateObject( CSByte( CShort( CSng( CStr( CType( CTypeDynamic( " +"CUInt( CULng( CurDir( CUShort( CVar( CVDate( CVErr( " +"DateAdd( DateDiff( DatePart( DateSerial( DateString DateValue( Day( DDB( DeleteSetting( Dir( DoEvents( " +"Environ( EOF( Erl( Error( ErrorToString( Exp( " +"FileAttr( FileClose( FileCopy( FileDateTime( FileGet( FileGetObject( FileLen( FileOpen( FilePut( FilePutObject( " +"FileWidth( Filter( Fix( Format( FormatCurrency( FormatDateTime( FormatNumber( FormatPercent( FreeFile( FV( " +"GetAllSettings( GetAttr( GetChar( GetObject( GetSetting( Hex( Hour( " +"IIf( Input( InputB( InputBox( InputString( InStr( InStrB( InStrRev( Int( IPmt( IRR( " +"IsArray( IsDate( IsDBNull( IsEmpty( IsError( IsMissing( IsNothing( IsNull( IsNumeric( IsObject( IsReference( " +"Join( Kill( LBound( LCase( Left( LeftB( Len( LenB( LineInput( Loc( Lock( LOF( Log( LSet( LTrim( " +"Mid( MidB( Minute( MIRR( MkDir( Month( MonthName( MsgBox( Now NPer( NPV( Oct( " +"Partition( Pmt( PPmt( Print( PrintLine( PV( QBColor( " +"Randomize( Rate( Rename( Replace( Reset( RGB( Right( RightB( RmDir( Rnd( Round( RSet( RTrim( " +"SaveSetting( Second( Seek( SetAttr( Sgn( Shell( Sin( SLN( Space( Spc( Split( Sqr( " +"Str( StrComp( StrConv( StrDup( String( StrReverse( Switch( SYD( SystemTypeName( " +"Tab( Tan( Time TimeOfDay Timer TimeSerial( TimeString TimeValue( Today Trim( TypeName( UBound( UCase( Unlock( " +"Val( VarType( VbTypeName( Weekday( WeekdayName( Write( WriteLine( Year( " -, nullptr, nullptr, nullptr +, // 10 misc +"Add( Assert( AtEndOfLine AtEndOfStream Attributes AvailableSpace BuildPath( " +"Clear( Close( Column CompareMode Copy( CopyFile( CopyFolder( Count CreateFolder( CreateTextFile( " +"DateCreated DateLastAccessed DateLastModified Delete( DeleteFile( DeleteFolder( Description " +"DriveExists( DriveLetter DriveType Drives " +"Exists( FileExists( Files FolderExists( FreeSpace " +"GetAbsolutePathName( GetBaseName( GetDrive( GetDriveName( GetExtensionName( GetFile( GetFileName( GetFolder( " +"GetParentFolderName( GetSpecialFolder( GetTempName( " +"HelpContext HelpFile IsReady IsRootFolder Item( Items( Key( Keys( Move( MoveFile( MoveFolder( Number " +"OpenAsTextStream( OpenTextFile( ParentFolder Path Raise( Read( ReadAll( ReadLine( Remove( RemoveAll( RootFolder " +"SerialNumber ShareName ShortName ShortPath Size Skip( SkipLine( Source SubFolders TotalSize VolumeName WriteBlankLines( " -, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr +, nullptr, nullptr, nullptr, nullptr, nullptr +//--Autogenerated -- end of section automatically generated }}; static EDITSTYLE Styles_VB[] = { @@ -77,6 +107,10 @@ static EDITSTYLE Styles_VB[] = { { SCE_VB_KEYWORD2, NP2StyleX_TypeKeyword, L"fore:#0000FF" }, { MULTI_STYLE(SCE_VB_PREPROCESSOR, SCE_VB_PREPROCESSOR_WORD, 0, 0), NP2StyleX_Preprocessor, L"fore:#FF8000" }, { SCE_VB_ATTRIBUTE, NP2StyleX_Attribute, L"fore:#FF8000" }, + { SCE_VB_CLASS, NP2StyleX_Class, L"bold; fore:#007F7F" }, + { SCE_VB_INTERFACE, NP2StyleX_Interface, L"bold; fore:#1E90FF" }, + { SCE_VB_ENUM, NP2StyleX_Enumeration, L"fore:#FF8000" }, + { SCE_VB_BASIC_FUNCTION, NP2StyleX_BasicFunction, L"fore:#0080C0" }, { SCE_VB_FUNCTION_DEFINITION, NP2StyleX_FunctionDefinition, L"bold; fore:#A46000" }, { SCE_VB_CONSTANT, NP2StyleX_Constant, L"fore:#B000B0" }, { SCE_VB_COMMENTLINE, NP2StyleX_Comment, L"fore:#608060" }, @@ -100,12 +134,17 @@ EDITLEXER lexVisualBasic = { 0, 0, SCE_VB_COMMENTLINE, SCE_VB_OPERATOR, SCE_VB_OPERATOR2 - , KeywordAttr32(0, KeywordAttr_MakeLower) // keywords - | KeywordAttr32(1, KeywordAttr_MakeLower) // type keyword - | KeywordAttr32(2, KeywordAttr_MakeLower) // demoted keyword - | KeywordAttr32(3, KeywordAttr_MakeLower | KeywordAttr_NoAutoComp) // preprocessor - | KeywordAttr32(4, KeywordAttr_MakeLower) // attribute - | KeywordAttr32(5, KeywordAttr_MakeLower) // constant + , KeywordAttr32(0, KeywordAttr_MakeLower | KeywordAttr_PreSorted) // keywords + | KeywordAttr32(1, KeywordAttr_MakeLower | KeywordAttr_PreSorted) // type keyword + | KeywordAttr32(2, KeywordAttr_MakeLower | KeywordAttr_PreSorted) // vba keyword + | KeywordAttr32(3, KeywordAttr_MakeLower | KeywordAttr_PreSorted | KeywordAttr_NoAutoComp) // preprocessor + | KeywordAttr32(4, KeywordAttr_MakeLower | KeywordAttr_PreSorted) // attribute + | KeywordAttr32(5, KeywordAttr_MakeLower | KeywordAttr_PreSorted) // class + | KeywordAttr32(6, KeywordAttr_MakeLower) // interface + | KeywordAttr64(7, KeywordAttr_MakeLower | KeywordAttr_PreSorted) // enumeration + | KeywordAttr64(8, KeywordAttr_MakeLower | KeywordAttr_PreSorted) // constant + | KeywordAttr64(9, KeywordAttr_MakeLower | KeywordAttr_PreSorted) // basic function + | KeywordAttr64(10, KeywordAttr_NoLexer) // misc , SCE_VB_COMMENTLINE, SCE_VB_STRING, SCE_VB_PLACEHOLDER, //Settings--Autogenerated -- end of section automatically generated diff --git a/src/EditLexers/stlVBS.cpp b/src/EditLexers/stlVBS.cpp index e54445cfb3..b79714a4b5 100644 --- a/src/EditLexers/stlVBS.cpp +++ b/src/EditLexers/stlVBS.cpp @@ -1,64 +1,79 @@ #include "EditLexer.h" #include "EditStyleX.h" -// VBScript Language Reference -// https://docs.microsoft.com/en-us/previous-versions//d1wf56tt(v=vs.85) -// https://docs.microsoft.com/en-us/previous-versions//ydz4cfk3(v=vs.85) - static KEYWORDLIST Keywords_VBS = {{ -"Alias And As Attribute Array Begin ByRef ByVal Call Case Class Compare Const Continue " -"Declare Dim Do Each Else ElseIf Empty End Enum Eqv Erase Error Event Exit " -"Explicit False For Friend Function Get Global GoSub Goto If Imp Implement In Is Let Lib " -"Load Loop LSet Me Mid Mod Module New Next Not Nothing Null On Option Optional Or " -"Preserve Private Property Public RaiseEvent ReDim Rem Resume Return RSet Select Set " -"Static Stop Sub Then To True Type Unload Until Wend While With WithEvents Xor" +//++Autogenerated -- start of section automatically generated +"Alias And As Attribute Begin Boolean ByRef Byte ByVal Call Case Char Class Compare Const Continue Currency " +"Decimal Declare Default Dim Do Double " +"Each Else ElseIf Empty End EndIf Enum Eqv Erase Error Event Execute ExecuteGlobal Exit Explicit " +"False For Friend Function Get Global GoSub GoTo If Imp Implements In Integer Is " +"Let Lib Like Load Long LongLong LongPtr Loop LSet Me Mod Module New Next Not Nothing Null Object On Option Optional Or " +"ParamArray Preserve Private Property Public RaiseEvent Randomize ReDim Rem Resume Return RSet " +"Select Set Shared Single Static Step Stop String Sub Then To True Type TypeOf Unload Until Variant " +"Wend While With WithEvents Xor " + +, // 1 type keyword +nullptr + +, // 2 vba keyword +nullptr -, // 1 Type Keyword -"Boolean Byte Char Currency Date Decimal Double Integer Long LongLong LongPtr Object Single String Variant " -"RegExp " +, // 3 preprocessor +nullptr + +, // 4 attribute +nullptr -, // 2 not used keyword -"Err WScript" +, // 5 class +"ActiveXObject Debug Dictionary Err FileSystemObject RegExp TextStream WScript " -, // 3 Preprocessor +, // 6 interface nullptr -, // 4 Attribute/Property + +, // 7 enumeration nullptr -, // 5 VB Const -// String -"vbCr vbCrLf vbFormFeed vbLf vbNewLine vbNullChar vbNullString vbTab vbVerticalTab " -// MsgBox -"vbOK vbCancel vbAbort vbRetry vbIgnore vbYes vbNo " -"vbOKOnly vbOKCancel vbAbortRetryIgnore vbYesNoCancel vbYesNo vbRetryCancel " -"vbCritical vbQuestion vbExclamation vbInformation vbDefaultButton1 vbDefaultButton2 " -"vbDefaultButton3 vbDefaultButton4 vbApplicationModal vbSystemModal " -// Color -"vbBlack vbRed vbGreen vbYellow vbBlue vbMagenta vbCyan vbWhite " -// Comparison -"vbBinaryCompare vbTextCompare " -// Date and Time -"vbSunday vbMonday vbTuesday vbWednesday vbThursday vbFriday vbSaturday " -"vbUseSystemDayOfWeek vbFirstJan1 vbFirstFourDays vbFirstFullWeek " -// Date Format -"vbGeneralDate vbLongDate vbShortDate vbLongTime vbShortTime " -// Tristate -"vbUseDefault vbTrue vbFalse " -// VarType -"vbEmpty vbNull vbInteger vbLong vbSingle vbDouble vbCurrency vbDate vbString " -"vbObject vbError vbBoolean vbVariant vbDataObject vbDecimal vbByte vbArray " -// Miscellaneous -"vbObjectError" +, // 8 constant +"vbAbort vbAbortRetryIgnore vbApplicationModal vbArray vbBinaryCompare vbBlack vbBlue vbBoolean vbByte " +"vbCancel vbCr vbCritical vbCrLf vbCurrency vbCyan " +"vbDataObject vbDate vbDecimal vbDefaultButton1 vbDefaultButton2 vbDefaultButton3 vbDefaultButton4 vbDouble " +"vbEmpty vbError vbExclamation vbFalse vbFirstFourDays vbFirstFullWeek vbFirstJan1 vbFormFeed vbFriday " +"vbGeneralDate vbGreen vbIgnore vbInformation vbInteger vbLf vbLong vbLongDate vbLongTime vbMagenta vbMonday " +"vbNewLine vbNo vbNull vbNullChar vbNullString vbObject vbObjectError vbOK vbOKCancel vbOKOnly vbQuestion " +"vbRed vbRetry vbRetryCancel vbSaturday vbShortDate vbShortTime vbSingle vbString vbSunday vbSystemModal " +"vbTab vbTextCompare vbThursday vbTrue vbTuesday vbUseDefault vbUseSystemDayOfWeek vbVariant vbVerticalTab " +"vbWednesday vbWhite vbYellow vbYes vbYesNo vbYesNoCancel " + +, // 9 basic function +"Abs( Array( Asc( Atn( CBool( CByte( CCur( CDate( CDbl( Chr( CInt( CLng( Cos( CreateObject( CSng( CStr( " +"Date DateAdd( DateDiff( DatePart( DateSerial( DateValue( Day( Escape( Eval( Exp( " +"Filter( Fix( FormatCurrency( FormatDateTime( FormatNumber( FormatPercent( GetLocale( GetObject( GetRef( Hex( Hour( " +"InputBox( InStr( InStrRev( Int( IsArray( IsDate( IsEmpty( IsNull( IsNumeric( IsObject( Join( " +"LBound( LCase( Left( Len( LoadPicture( Log( LTrim( Mid( Minute( Month( MonthName( MsgBox( Now Oct( " +"Replace( RGB( Right( Rnd Round( RTrim( " +"ScriptEngine ScriptEngineBuildVersion ScriptEngineMajorVersion ScriptEngineMinorVersion Second( SetLocale( Sgn( Sin( " +"Space( Split( Sqr( StrComp( String( StrReverse( " +"Tan( Time Timer TimeSerial( TimeValue( Trim( TypeName( UBound( UCase( Unescape( VarType( Weekday( WeekdayName( Year( " -, nullptr, nullptr, nullptr +, // 10 misc +"Add( AtEndOfLine AtEndOfStream BuildPath( " +"Clear( Close( Column CompareMode CopyFile( CopyFolder( Count CreateFolder( CreateTextFile( " +"DeleteFile( DeleteFolder( Description DriveExists( Drives Execute( Exists( FileExists( FirstIndex FolderExists( " +"GetAbsolutePathName( GetBaseName( GetDrive( GetDriveName( GetExtensionName( " +"GetFile( GetFileName( GetFileVersion( GetFolder( GetParentFolderName( GetSpecialFolder( GetStandardStream( GetTempName( " +"HelpContext HelpFile IgnoreCase Item( Items( Key( Keys( Length Line MoveFile( MoveFolder( Number " +"OpenAsTextStream( OpenTextFile( Pattern Raise( Read( ReadAll( ReadLine( Remove( RemoveAll( Skip( SkipLine( Source Test( " +"Value Write( WriteBlankLines( WriteLine( " -, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr +, nullptr, nullptr, nullptr, nullptr, nullptr +//--Autogenerated -- end of section automatically generated }}; static EDITSTYLE Styles_VBS[] = { EDITSTYLE_DEFAULT, - { MULTI_STYLE(SCE_VB_KEYWORD, SCE_VB_KEYWORD3, 0, 0), NP2StyleX_Keyword, L"fore:#0000FF" }, - { SCE_VB_KEYWORD2, NP2StyleX_TypeKeyword, L"fore:#0000FF" }, + { MULTI_STYLE(SCE_VB_KEYWORD, SCE_VB_KEYWORD2, SCE_VB_KEYWORD3, 0), NP2StyleX_Keyword, L"fore:#0000FF" }, + { SCE_VB_CLASS, NP2StyleX_Class, L"bold; fore:#007F7F" }, + { SCE_VB_BASIC_FUNCTION, NP2StyleX_BasicFunction, L"fore:#0080C0" }, { SCE_VB_FUNCTION_DEFINITION, NP2StyleX_FunctionDefinition, L"bold; fore:#A46000" }, { SCE_VB_CONSTANT, NP2StyleX_Constant, L"fore:#B000B0" }, { SCE_VB_COMMENTLINE, NP2StyleX_Comment, L"fore:#608060" }, @@ -80,12 +95,17 @@ EDITLEXER lexVBScript = { 0, 0, SCE_VB_COMMENTLINE, SCE_VB_OPERATOR, SCE_VB_OPERATOR2 - , KeywordAttr32(0, KeywordAttr_MakeLower) // keywords + , KeywordAttr32(0, KeywordAttr_MakeLower | KeywordAttr_PreSorted) // keywords | KeywordAttr32(1, KeywordAttr_MakeLower) // type keyword - | KeywordAttr32(2, KeywordAttr_MakeLower) // demoted keyword + | KeywordAttr32(2, KeywordAttr_MakeLower) // vba keyword | KeywordAttr32(3, KeywordAttr_MakeLower | KeywordAttr_NoAutoComp) // preprocessor | KeywordAttr32(4, KeywordAttr_MakeLower) // attribute - | KeywordAttr32(5, KeywordAttr_MakeLower) // constant + | KeywordAttr32(5, KeywordAttr_MakeLower | KeywordAttr_PreSorted) // class + | KeywordAttr32(6, KeywordAttr_MakeLower) // interface + | KeywordAttr64(7, KeywordAttr_MakeLower) // enumeration + | KeywordAttr64(8, KeywordAttr_MakeLower | KeywordAttr_PreSorted) // constant + | KeywordAttr64(9, KeywordAttr_MakeLower | KeywordAttr_PreSorted) // basic function + | KeywordAttr64(10, KeywordAttr_NoLexer) // misc , SCE_VB_COMMENTLINE, SCE_VB_STRING, SCE_VB_PLACEHOLDER, //Settings--Autogenerated -- end of section automatically generated diff --git a/tools/KeywordCore.py b/tools/KeywordCore.py index 03992be3ec..b09f669e3c 100644 --- a/tools/KeywordCore.py +++ b/tools/KeywordCore.py @@ -2549,14 +2549,66 @@ def parse_vim_api_file(path): ('commands', keywordMap['commands'], KeywordAttr.Default), ] -def parse_visual_basic_api_file(path): - return [ - ('keywords', [], KeywordAttr.MakeLower), - ('type keyword', [], KeywordAttr.MakeLower), - ('demoted keyword', [], KeywordAttr.MakeLower), - ('preprocessor', [], KeywordAttr.MakeLower | KeywordAttr.NoAutoComp | KeywordAttr.Special), - ('attribute', [], KeywordAttr.MakeLower), - ('constant', [], KeywordAttr.MakeLower), +def parse_visual_basic_api_file(pathList): + keywordMap = { + 'types': [], + 'vba keywords': [], + 'directives': [], + 'enumeration': [], + 'attributes': [], + 'misc': [], + } + for path in pathList: + name = os.path.basename(path) + sections = read_api_file(path, "'") + for key, doc in sections: + items = [] + if key in ('keywords', 'vba keywords', 'types', 'enumeration', 'constants'): + items = doc.replace('()', '(').split() + elif key == 'attributes': + items = re.findall(r'(\w+\()', doc) + elif key == 'directives': + items = re.findall(r'#(\w+)', doc) + elif key == 'objects': + items = re.findall(r'^\s+(\w+\(?)', doc, re.MULTILINE) + keywordMap['misc'] = items + items = re.findall(r'^(\w+)\s*\{', doc, re.MULTILINE) + elif key == 'functions': + items = re.findall(r'^(\w+\(?)', doc, re.MULTILINE) + else: + print(key, name) + if key in keywordMap: + keywordMap[key].extend(items) + else: + keywordMap[key] = items + + items = keywordMap['vba keywords'] + if items: + functions = keywordMap['functions'] + items = [word for word in items if f'{word}(' not in functions] + keywordMap['vba keywords'] = items + + RemoveDuplicateKeyword(keywordMap, [ + 'types', + 'functions', + 'keywords', + 'objects', + 'enumeration', + 'vba keywords', + 'misc', + ]) + return [ + ('keywords', keywordMap['keywords'], KeywordAttr.MakeLower), + ('type keyword', keywordMap['types'], KeywordAttr.MakeLower), + ('vba keyword', keywordMap['vba keywords'], KeywordAttr.MakeLower), + ('preprocessor', keywordMap['directives'], KeywordAttr.MakeLower | KeywordAttr.NoAutoComp | KeywordAttr.Special), + ('attribute', keywordMap['attributes'], KeywordAttr.MakeLower), + ('class', keywordMap['objects'], KeywordAttr.MakeLower), + ('interface', [], KeywordAttr.MakeLower), + ('enumeration', keywordMap['enumeration'], KeywordAttr.MakeLower), + ('constant', keywordMap['constants'], KeywordAttr.MakeLower), + ('basic function', keywordMap['functions'], KeywordAttr.MakeLower), + ('misc', keywordMap['misc'], KeywordAttr.NoLexer), ] def parse_verilog_api_file(pathList): diff --git a/tools/KeywordUpdate.py b/tools/KeywordUpdate.py index f605145ade..dee1b61e48 100644 --- a/tools/KeywordUpdate.py +++ b/tools/KeywordUpdate.py @@ -102,11 +102,11 @@ ('NP2LEX_TEXINFO', 'stlTexinfo.cpp', 'LexTexinfo.cxx', 'Texinfo.texi', 0, parse_texinfo_api_file), ('NP2LEX_TOML', 'stlTOML.cpp', 'LexTOML.cxx', '', 0, parse_toml_api_file), - ('NP2LEX_VBSCRIPT', 'stlVBS.cpp', 'LexVB.cxx', '', 0, parse_visual_basic_api_file), + ('NP2LEX_VBSCRIPT', 'stlVBS.cpp', 'LexVB.cxx', ['VBScript.vbs'], 0, parse_visual_basic_api_file), ('NP2LEX_VERILOG', 'stlVerilog.cpp', 'LexVerilog.cxx', ['Verilog.v', 'SystemVerilog.sv'], 0, parse_verilog_api_file), ('NP2LEX_VHDL', 'stlVHDL.cpp', 'LexVHDL.cxx', 'VHDL.vhdl', 0, parse_vhdl_api_file), ('NP2LEX_VIM', 'stlVim.cpp', 'LexVim.cxx', 'Vim.vim', 0, parse_vim_api_file), - ('NP2LEX_VISUALBASIC', 'stlVB.cpp', 'LexVB.cxx', '', 0, parse_visual_basic_api_file), + ('NP2LEX_VISUALBASIC', 'stlVB.cpp', 'LexVB.cxx', ['VB.NET.vb', 'VBA.bas'], 0, parse_visual_basic_api_file), # https://github.com/WebAssembly/wabt/blob/main/src/lexer-keywords.txt ('NP2LEX_WASM', 'stlWASM.cpp', 'LexWASM.cxx', 'wasm-lexer-keywords.txt', 0, parse_wasm_lexer_keywords), diff --git a/tools/lang/JavaScript.js b/tools/lang/JavaScript.js index 67041342c6..2a312fed8d 100644 --- a/tools/lang/JavaScript.js +++ b/tools/lang/JavaScript.js @@ -679,8 +679,8 @@ Proxy(target, handler) { revocable(target, handler) } -// JScript -// https://docs.microsoft.com/en-us/previous-versions/ms950396(v=msdn.10) +// Windows Script Host +// https://learn.microsoft.com/en-us/previous-versions/ms950396(v=msdn.10) // https://developer.mozilla.org/en-US/docs/Archive/Web/JavaScript/Microsoft_Extensions ActiveXObject(servername.typename[, location]) Debug { @@ -700,14 +700,7 @@ VBArray { toArray() ubound(dimension) } -// Windows Script Host -// https://msdn.microsoft.com/en-us/library/9bbdkx3k(v=msdn.10) WScript { - //CreateObject(strProgID[,strPrefix]) - //Echo() - //Exec(strCommand) - //GetObject(strPathname [,strProgID], [strPrefix]) - //Quit() } // https://developer.mozilla.org/en-US/docs/Web/API diff --git a/tools/lang/VB.NET.vb b/tools/lang/VB.NET.vb new file mode 100644 index 0000000000..bd61ff69f3 --- /dev/null +++ b/tools/lang/VB.NET.vb @@ -0,0 +1,536 @@ +' Visual Basic Language Reference +' https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/ +' Visual Basic language specification +' https://learn.microsoft.com/en-us/dotnet/visual-basic/reference/language-specification/ + +'! keywords ======================================================= +' https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/ +AddHandler AddressOf +Call + Public Protected Friend Private Shadows MustInherit NotInheritable Partial +Class Of + Inherits + Implements +End Class +Const + Shadows Overloads +Declare Ansi Unicode Auto Sub Lib Alias +Declare Function Lib Alias As + Shared Shadows Static ReadOnly +Delegate Sub Of As +Delegate Function Of As +Dim WithEvents As New With +Do + Continue Do + Exit Do + Do While + Loop + Do Until + Loop + Do + Loop While + Do + Loop Until +Loop +Enum As +End Enum +Erase +Error +Shared Shadows Event As Implements +Custom Event As Implements + AddHandler() + End AddHandler + RemoveHandler() + End RemoveHandler + RaiseEvent() + End RaiseEvent +End Event +For Each As In + Continue For + Exit For +Next +For As To Step +Next + Shared Shadows Async Iterator +Function Of As Implements Handles + Optional ByVal ByRef ParamArray + Exit Function +End Function +GoTo + Default Shared Shadows ReadOnly WriteOnly Iterator +If Then +ElseIf Then +Else +End If +If Then Else +Imports +Interface Of + ' Property + ' Function + ' Sub + ' Event + ' Interface + ' Class + ' Structure +End Interface +Mid() +Module +End Module +Namespace Global +End Namespace +On Error GoTo Resume Next + Public Overloads Shared Shadows Widening Narrowing +Operator As + Return +End Operator +Option Compare Binary Text +Option Explicit On Off +Option Infer On Off +Option Strict On Off +Property + Get + End Get + Set() + End Set +End Property +Property As Implements +RaiseEvent +ReDim Preserve +Rem +RemoveHandler AddressOf +Select Case + Case Else +End Select +Stop +Structure Of + Implements +End Structure +Sub + Exit Sub +End Sub +SyncLock +End SyncLock +Throw New +Try + Exit Try +Catch As When +Catch +Finally +End Try +Using +End Using +While + Continue While + Exit While +End While +With +End With +Yield + +' https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/queries/ +Aggregate As In Into +Distinct +From As In +Group By Into +Group Join As In On Equals And Equals Into +Let +Order By +Select +Skip While +Take While +Where + +' https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/operators/ +AddressOf And AndAlso Await +DirectCast +GetType() GetXMLNamespace() +Is If() IsFalse() IsNot IsTrue() +Like +Mod +NameOf() New Not +Or OrElse +TryCast() TypeOf Is IsNot +Xor + +' https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/modifiers/ +Ansi Assembly Async Auto +ByRef ByVal +Default +Friend +In Iterator +Key +MustInherit MustOverride +Narrowing NotInheritable NotOverridable +Optional Out Overloads Overridable Overrides +ParamArray Partial Private Protected Friend Public +ReadOnly +Shadows Shared Static +Unicode +Widening WithEvents WriteOnly + +' https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/keywords/ +Me My MyBase MyClass +False True Nothing + +'! types ======================================================= +' https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/data-types/ +Boolean Byte +Char +Date Decimal Double +Integer Long +Object +SByte Short Single String +UInteger ULong UShort + +Variant + +'! attributes ======================================================= +' https://learn.microsoft.com/en-us/dotnet/visual-basic/programming-guide/concepts/attributes/ + + + + + + + +' https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/attributes + + + + + + +'! directives ======================================================= +' https://learn.microsoft.com/en-us/dotnet/visual-basic/reference/language-specification/preprocessing-directives +#If Then +#ElseIf Then +#Else +#End If +#Const +#ExternalChecksum +#ExternalSource +#End ExternalSource +#Region +#End Region +#Disable +#Enable + +'! objects ======================================================= +' https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualbasic?view=net-8.0 +Collection { + Count + Item() + + Add() + Clear() + Contains() + GetEnumerator() + Remove() +} + +ControlChars {} +Conversion {} +DateAndTime {} + +ErrObject { + Description + HelpContext + HelpFile + LastDllError + Number + Source + + Clear() + GetException() + Raise() +} +Err {} + +FileSystem {} +Financial {} +Information {} +Interaction {} +Strings {} +VBMath {} + +' https://learn.microsoft.com/en-us/dotnet/api/system?view=net-8.0 +Console {} +Math { + Abs() + Acos() + Asin() + Atan() + Atan2() + BigMul() + Ceiling() + Cos() + Cosh() + DivRem() + Exp() + Floor() + IEEERemainder() + Log() + Log10() + Max() + Min() + Pow() + Round() + Sign() + Sin() + Sinh() + Sqrt() + Tan() + Tanh() + Truncate() + + Acosh() + Asinh() + Atanh() + BitDecrement() + BitIncrement() + Cbrt() + Clamp() + CopySign() + FusedMultiplyAdd() + ILogB() + Log2() + MaxMagnitude() + MinMagnitude() + ScaleB() +} + +'! functions ======================================================= +' https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/functions/ +' Type Conversion Functions +CBool(expression) +CByte(expression) +CChar(expression) +CDate(expression) +CDbl(expression) +CDec(expression) +CInt(expression) +CLng(expression) +CObj(expression) +CSByte(expression) +CShort(expression) +CSng(expression) +CStr(expression) +CUInt(expression) +CULng(expression) +CUShort(expression) +CType() + +' Conversion Class +CTypeDynamic() +ErrorToString() +Fix() +Hex() +Int() +Oct() +Str() +Val() + +' DateAndTime Class +DateString +Now +TimeOfDay +Timer +TimeString +Today + +DateAdd() +DateDiff() +DatePart() +DateSerial() +DateValue() +Day() +Hour() +Minute() +Month() +MonthName() +Second() +TimeSerial() +TimeValue() +Weekday() +WeekdayName() +Year() + +' FileSystem Class +ChDir() +ChDrive() +CurDir() +Dir() +EOF() +FileAttr() +FileClose() +FileCopy() +FileDateTime() +FileGet() +FileGetObject() +FileLen() +FileOpen() +FilePut() +FilePutObject() +FileWidth() +FreeFile() +GetAttr() +Input() +InputString() +Kill() +LineInput() +Loc() +Lock() +LOF() +MkDir() +Print() +PrintLine() +Rename() +Reset() +RmDir() +Seek() +SetAttr() +Spc() +Tab() +Unlock() +Write() +WriteLine() + +' Financial Class +DDB() +FV() +IPmt() +IRR() +MIRR() +NPer() +NPV() +Pmt() +PPmt() +PV() +Rate() +SLN() +SYD() + +' Information Class +Erl() +IsArray() +IsDate() +IsDBNull() +IsError() +IsNothing() +IsNumeric() +IsReference() +LBound() +QBColor() +RGB() +SystemTypeName() +TypeName() +UBound() +VarType() +VbTypeName() + +' Interaction Class +AppActivate() +Beep() +CallByName() +Choose() +Command() +CreateObject() +DeleteSetting() +Environ() +GetAllSettings() +GetObject() +GetSetting() +IIf() +InputBox() +MsgBox() +Partition() +SaveSetting() +Shell() +Switch() + +' Strings Class +Asc() +AscW() +Chr() +ChrW() +Filter() +Format() +FormatCurrency() +FormatDateTime() +FormatNumber() +FormatPercent() +GetChar() +InStr() +InStrRev() +Join() +LCase() +Left() +Len() +LSet() +LTrim() +Mid() +Replace() +Right() +RSet() +RTrim() +Space() +Split() +StrComp() +StrConv() +StrDup() +StrReverse() +Trim() +UCase() + +' VBMath Class +Randomize() +Rnd() + +'! enumeration ======================================================= +AppWinStyle +CallType CompareMethod +DateFormat DateInterval DueDate +FileAttribute FirstDayOfWeek FirstWeekOfYear +MsgBoxStyle MsgBoxResult +OpenAccess OpenMode OpenShare +TriState +VariantType VbStrConv + +AttributeTargets LayoutKind + +'! constants ======================================================= +' https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/constants-and-enumerations +vbNullString vbObjectError +' https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.constants?view=net-8.0 +' AppWinStyle +vbHide vbNormalFocus vbMinimizedFocus vbMaximizedFocus vbNormalNoFocus vbMinimizedNoFocus +' CallType +vbMethod vbGet vbLet vbSet +' CompareMethod +vbBinaryCompare vbTextCompare +' ControlChars +vbBack vbCr vbCrLf vbFormFeed vbLf vbNewLine vbNullChar vbTab vbVerticalTab +' DateFormat +vbGeneralDate vbLongDate vbShortDate vbLongTime vbShortTime +' FileAttribute +vbNormal vbReadOnly vbHidden vbSystem vbVolume vbDirectory vbArchive +' FirstDayOfWeek +vbUseSystemDayOfWeek vbSunday vbMonday vbTuesday vbWednesday vbThursday vbFriday vbSaturday +' FirstWeekOfYear +vbUseSystem vbFirstJan1 vbFirstFourDays vbFirstFullWeek +' MsgBoxStyle +vbOKOnly vbOKCancel vbAbortRetryIgnore vbYesNoCancel vbYesNo vbRetryCancel +vbCritical vbQuestion vbExclamation vbInformation +vbDefaultButton1 vbDefaultButton2 vbDefaultButton3 +vbApplicationModal vbSystemModal +VbMsgBoxSetForeground vbMsgBoxHelp vbMsgBoxRight vbMsgBoxRtlReading +' MsgBoxResult +vbOK vbCancel vbAbort vbRetry vbIgnore vbYes vbNo +' TriState +vbUseDefault vbTrue vbFalse +' VariantType +vbEmpty vbNull vbInteger vbSingle vbDouble vbCurrency vbDate vbString vbObject +vbBoolean vbVariant vbDecimal vbByte vbChar vbLong vbUserDefinedType vbArray +' VbStrConv +vbUpperCase vbLowerCase vbProperCase vbWide vbNarrow vbKatakana vbHiragana +vbSimplifiedChinese vbTraditionalChinese vbLinguisticCasing diff --git a/tools/lang/VBA.bas b/tools/lang/VBA.bas new file mode 100644 index 0000000000..0dd7cc0b57 --- /dev/null +++ b/tools/lang/VBA.bas @@ -0,0 +1,500 @@ +' Office VBA Reference +' https://learn.microsoft.com/en-us/office/vba/api/overview/language-reference +' [MS-VBAL]: VBA Language Specification +' https://learn.microsoft.com/en-us/openspecs/microsoft_general_purpose_programming_languages/ms-vbal/ +' https://msopenspecs.azureedge.net/files/MS-VBAL/[MS-VBAL].pdf +' Visual Basic 6.0 Documentation +' https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-basic-6/visual-basic-6.0-documentation +' FreeBASIC Manual +' https://www.freebasic.net/wiki/DocToc + +'! VBA keywords ======================================================= +' https://learn.microsoft.com/en-us/office/vba/language/reference/statements +AppActivate +Beep +Call +ChDir +ChDrive +Close +Const As +Declare PtrSafe Sub Lib Alias +Declare PtrSafe Function Lib Alias As +DefBool DefByte DefInt DefLng DefLngLng DefLngPtr +DefCur DefSng DefDbl DefDec DefDate DefStr DefObj DefVar +DeleteSetting +Dim As New WithEvents +Do + Exit Do + Do While + Loop + Do Until + Loop + Do + Loop While + Do + Loop Until +Loop +Enum +End Enum +Erase +Error +Public Event +FileCopy +For Each In + Exit For +Next +For To Step +Next +Public Private Friend Static Function As + Optional ByVal ByRef ParamArray As + Exit Function +End Function +Get +GoSub Return +GoTo +If Then +ElseIf Then +Else +End If +If Then Else +Implements +Input +Kill +Let +Line Input +Load +Lock +Unlock +LSet +Mid() +MkDir +Name As +On Error GoTo +On Error Resume Next +On GoSub +On GoTo +Open For Access As Len +Option Base +Option Compare Binary Text Database +Option Explicit +Option Private +Print +Private WithEvents As New +Property Get As + Exit Property +End Property +Property Let +End Property +Property Set +End Property +Public WithEvents As New +Put +RaiseEvent +Randomize +ReDim Preserve As +Rem +Reset +Resume Next +RmDir +RSet +SavePicture ' VB6 +SaveSetting +Seek +Select Case +Case Else +End Select +SendKeys +Set New Nothing +SetAttr +Static As New +Stop +Sub + Exit Sub +End Sub +Time +Private Public Type +End Type +Unload +While +Wend +Width +With +End With +Write + +' https://learn.microsoft.com/en-us/office/vba/language/reference/keywords-visual-basic-for-applications +Me +Empty Null +False True + +' https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/operator-summary +AddressOf And Eqv Imp Is Like Mod Not Or Xor + +' VB6 +Attribute Version +Begin + BeginProperty + EndProperty +End +If +EndIf + +'! types ======================================================= +' https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/data-type-summary +Boolean Byte +Currency +Date Decimal Double +Integer +Long LongLong LongPtr +Object +Single String +Variant +Any + +'! directives ======================================================= +' https://learn.microsoft.com/en-us/office/vba/language/reference/directives +#Const +#If Then +#ElseIf Then +#Else +#End If +#If +#EndIf + +'! objects ======================================================= +Collection { + Add() + Item(index) + Remove(index) + Count +} + +Debug { + Assert() + Print() +} + +Dictionary { + Add() + Exists(key) + Items() + Keys() + Remove(key) + RemoveAll() + + CompareMode + Count + Item(key) + Key(key) +} + +Drive { + AvailableSpace + DriveLetter + DriveType + FileSystem + FreeSpace + IsReady + RootFolder + SerialNumber + ShareName + TotalSize + VolumeName +} + +Err { + Clear() + Raise() + + Description + HelpContext + HelpFile + Number + Source +} + +File { + Copy() + Delete() + Move() + OpenAsTextStream([iomode, [format]]) + + Attributes + DateCreated + DateLastAccessed + DateLastModified + Drive + Name + ParentFolder + Path + ShortName + ShortPath + Size + ' Type +} + +FileSystemObject { + BuildPath(path, name) + CopyFile() + CopyFolder() + CreateFolder(foldername) + CreateTextFile(filename, [overwrite, [unicode]]) + DeleteFile() + DeleteFolder() + DriveExists(drivespec) + FileExists(filespec) + FolderExists(folderspec) + GetAbsolutePathName(pathspec) + GetBaseName(path) + GetDrive(drivespec) + GetDriveName(path) + GetExtensionName(path) + GetFile(filespec) + GetFileName(pathspec) + GetFolder(folderspec) + GetParentFolderName(path) + GetSpecialFolder(folderspec) + GetTempName() + MoveFile() + MoveFolder(source, destination) + OpenTextFile(filename, [iomode, [create, [format]]]) + + Drives +} + +Folder { + Add() + + Files + IsRootFolder + SubFolders +} + +TextStream { + Close() + Read(characters) + ReadAll() + ReadLine() + Skip(characters) + SkipLine() + Write(string) + WriteBlankLines(lines) + WriteLine([string]) + + AtEndOfLine + AtEndOfStream + Column + Line +} + +'! functions ======================================================= +' https://learn.microsoft.com/en-us/office/vba/language/reference/functions-visual-basic-for-applications +' https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/returning-strings-from-functions +' Conversion functions +Asc(string) +AscB(string) +AscW(string) +Chr(charcode) +ChrB(charcode) +ChrW(charcode) +CVErr(errornumber) +Format(Expression, [Format], [FirstDayOfWeek], [FirstWeekOfYear]) +Hex(number) +Oct(number) +Str(number) +Val(string) + +' Type conversion functions +CBool(expression) +CByte(expression) +CCur(expression) +CDate(expression) +CVDate(expression) +CDbl(expression) +CDec(expression) +CInt(expression) +CLng(expression) +CLngLng(expression) +CLngPtr(expression) +CSng(expression) +CStr(expression) +CVar(expression) + +' Math functions +Abs(number) +Atn(number) +Cos(number) +Exp(number) +Int(number) +Fix(number) +Log(number) +Rnd(Number) +Sgn(number) +Sin(number) +Sqr(number) +Tan(number) + +' Other functions +Array(arglist) +CallByName(object, procname, calltype, [args]) +Choose(index, choice) +Command() +CreateObject(name, [servername]) +CurDir(drive) + +Date +DateAdd(interval, number, date) +DateDiff(interval, date1, date2, [firstdayofweek, [firstweekofyear]]) +DatePart(interval, date, [firstdayofweek, [firstweekofyear]]) +DateSerial(year, month, day) +DateValue(date) +Day(date) +DDB(cost, salvage, life, period, [factor]) +Dir(pathname, [attributes]) +DoEvents() +Environ({ envstring | number }) +EOF(filenumber) +Error(errornumber) + +FileAttr(filenumber, returntype) +FileDateTime(pathname) +FileLen(pathname) +Filter(sourcearray, match, [include, [compare]]) +FormatCurrency(Expression, [NumDigitsAfterDecimal, [IncludeLeadingDigit, [UseParensForNegativeNumbers, [GroupDigits]]]]) +FormatDateTime(Date, [NamedFormat]) +FormatNumber(Expression, [NumDigitsAfterDecimal, [IncludeLeadingDigit, [UseParensForNegativeNumbers, [GroupDigits]]]]) +FormatPercent(Expression, [NumDigitsAfterDecimal, [IncludeLeadingDigit, [UseParensForNegativeNumbers, [GroupDigits]]]]) +FreeFile(rangenumber) +FV(rate, nper, pmt, [pv, [type]]) + +GetAllSettings(appname, section) +GetAttr(pathname) +GetObject([pathname], [class]) +GetSetting(appname, section, key, [default]) +Hour(time) + +IIf(expr, truepart, falsepart) +Input(number, filenumber) +InputB(number, filenumber) +InputBox(prompt, [title], [default], [xpos], [ypos], [helpfile, context]) +InStr([start], string1, string2, [compare]) +InStrB([start], string1, string2, [compare]) +InStrRev(stringcheck, stringmatch, [start, [compare]]) +IPmt(rate, per, nper, pv, [fv, [type]]) +IRR(values(), [guess]) +IsArray(varname) +IsDate(expression) +IsEmpty(expression) +IsError(expression) +IsMissing(argname) +IsNull(expression) +IsNumeric(expression) +IsObject(identifier) + +Join(sourcearray, [delimiter]) +LBound(arrayname, [dimension]) +LCase(string) +Left(string, length) +LeftB(string, length) +Len(string | varname) +LenB(string | varname) +Loc(filenumber) +LOF(filenumber) +LTrim(string) +RTrim(string) +Trim(string) + +Mid(string, start, [length]) +MidB(string, start, [length]) +Minute(time) +MIRR(values( ), finance_rate, reinvest_rate) +Month(date) +MonthName(month, [abbreviate]) +MsgBox(prompt, [buttons,] [title,] [helpfile, context]) +Now +NPer(rate, pmt, pv, [fv, [type]]) +NPV(rate, values( )) +Partition(number, start, stop, interval) +Pmt(rate, nper, pv, [fv, [type]]) +PPmt(rate, per, nper, pv, [fv, [type]]) +PV(rate, nper, pmt, [fv, [type]]) +QBColor(color) + +Rate(nper, pmt, pv, [fv, [type, [guess]]]) +Replace(expression, find, replace, [start, [count, [compare]]]) +RGB(red, green, blue) +Right(string, length) +RightB(string, length) +Round(expression, [numdecimalplaces]) +Second(time) +Seek(filenumber) +Shell(pathname, [windowstyle]) +SLN(cost, salvage, life) +Space(number) +Spc(n) +Split(expression, [delimiter, [limit, [compare]]]) +StrComp(string1, string2, [compare]) +StrConv(string, conversion, [LCID]) +String(number, character) +StrReverse(expression) +Switch(expr-1, value-1, [expr-2, value-2…, [expr-n, value-n]]) +SYD(cost, salvage, life, period) + +Tab(n) +Time +Timer +TimeSerial(hour, minute, second) +TimeValue(time) +TypeName(varname) +UBound(arrayname, [dimension]) +UCase(string) +VarType(varname) +Weekday(date, [firstdayofweek]) +WeekdayName(weekday, abbreviate, firstdayofweek) +Year(date) + +'! constants ======================================================= +' https://learn.microsoft.com/en-us/office/vba/language/reference/constants-visual-basic-for-applications +' Calendar constants +vbCalGreg vbCalHijri +' CallType constants +vbMethod vbGet vbLet vbSet +' Color constants +vbBlack vbRed vbGreen vbYellow vbBlue vbMagenta vbCyan vbWhite +' Comparison constants +vbUseCompareOption vbBinaryCompare vbTextCompare vbDatabaseCompare +' Date constants +vbUseSystem vbSunday vbMonday vbTuesday vbWednesday vbThursday vbFriday vbSaturday +vbUseSystemDayOfWeek vbFirstJan1 vbFirstFourDays vbFirstFullWeek +' Date Format constants +vbGeneralDate vbLongDate vbShortDate vbLongTime vbShortTime +' Dir, GetAttr, and SetAttr constants +vbNormal vbReadOnly vbHidden vbSystem vbVolume vbDirectory vbArchive vbAlias +' DriveType constants +' File Attribute constants +' File Input/Output constants +' Form constants +vbModeless vbModal +' Keycode constants +' Miscellaneous constants +vbCrLf vbCr vbLf vbNewLine vbNullChar vbNullString vbObjectError vbTab vbBack vbFormFeed vbVerticalTab +' MsgBox constants +vbOKOnly vbOKCancel vbAbortRetryIgnore vbYesNoCancel vbYesNo vbRetryCancel +vbCritical vbQuestion vbExclamation vbInformation +vbDefaultButton1 vbDefaultButton2 vbDefaultButton3 vbDefaultButton4 +vbApplicationModal vbSystemModal +vbMsgBoxHelpButton VbMsgBoxSetForeground vbMsgBoxRight vbMsgBoxRtlReading +vbOK vbCancel vbAbort vbRetry vbIgnore vbYes vbNo +' QueryClose constants +vbFormControlMenu vbFormCode vbAppWindows vbAppTaskManager +' Shell constants +vbHide vbNormalFocus vbMinimizedFocus vbMaximizedFocus vbNormalNoFocus vbMinimizedNoFocus +' SpecialFolder constants +' StrConv constants +vbUpperCase vbLowerCase vbProperCase vbWide vbNarrow vbKatakana vbHiragana vbUnicode vbFromUnicode +' System Color constants +' Tristate constants +vbTrue vbFalse vbUseDefault +' VarType constants +vbEmpty vbNull vbInteger vbLong vbSingle vbDouble vbCurrency vbDate vbString vbObject vbError +vbBoolean vbVariant vbDataObject vbDecimal vbByte vbLongLong vbUserDefinedType vbArray diff --git a/tools/lang/VBScript.vbs b/tools/lang/VBScript.vbs new file mode 100644 index 0000000000..5c09f7d898 --- /dev/null +++ b/tools/lang/VBScript.vbs @@ -0,0 +1,334 @@ +' VBScript Language Reference +' https://learn.microsoft.com/en-us/previous-versions/d1wf56tt(v=vs.85) +' VBScript +' https://learn.microsoft.com/en-us/previous-versions/t0aew7h6(v=vs.85) +' https://documentation.help/MS-Office-VBScript/VBSTOC.htm + +'! keywords ======================================================= +' Statements https://learn.microsoft.com/en-us/previous-versions/7aw9cadb(v=vs.85) +Call +Class + Public Property Get + Set + Exit Property + End Property + Default Property Let + End Property + Private Property Set + End Property +End Class +Const +Dim +Do + Do While + Loop + Do Until + Loop + Do + Loop While + Do + Loop Until + Exit Do +Loop +Erase +Execute +ExecuteGlobal +For Each In + Exit For +Next +For To Step +Next +Default Function ByVal ByRef + Exit Function +End Function +If +ElseIf Then +Else +End If +If Then Else +On Error Resume Next +On Error GoTo +Option Explicit +Randomize +ReDim Preserve +Rem +Select Case + Case Else +End Select +Set New Nothing +Stop +Sub ByVal ByRef + Exit Sub +End Sub +While +Wend +With +End With + +' Operators https://learn.microsoft.com/en-us/previous-versions/1cbft50a(v=vs.85) +Not And Or Xor Eqv Imp Is Mod + +' Keywords https://learn.microsoft.com/en-us/previous-versions/f8tbc79x(v=vs.85) +Empty False Nothing Null True + +' types +Boolean Byte Char Currency Date Decimal Double Integer Long LongLong LongPtr Object Single String Variant + +' others +Alias As Attribute Begin +Compare Continue +Declare +EndIf Enum Event +Friend +Global GoSub +Implements +Lib Like Load LSet +Me Module +Optional +ParamArray +RaiseEvent Return RSet +Shared Static +Type TypeOf +Unload +WithEvents + +'! objects ======================================================= +' https://learn.microsoft.com/en-us/previous-versions/22h7a6k8(v=vs.85) +Debug { + Write([str1 [, str2 [, ... [, strN]]]]) + WriteLine([str1 [, str2 [, ... [, strN]]]]) +} + +Err { + Description + HelpContext + HelpFile + Number + Source + + Clear() + Raise(number, source, description, helpfile, helpcontext) +} + +RegExp { + Global + IgnoreCase + Pattern + + Execute(string) + Replace(string1, string2) + Test(string) + + ' Match Object + FirstIndex + Length + Value +} + +Dictionary { + Count + Item(key) + Key(key) + CompareMode + + Add(key, item) + Exists(key) + Items() + Keys() + Remove(key) + RemoveAll() +} + +FileSystemObject { + Drives + + BuildPath(path, name) + CopyFile(source, destination[, overwrite]) + CopyFolder(source, destination[, overwrite]); + CreateFolder(foldername) + CreateTextFile(filename[, overwrite[, unicode]]) + DeleteFile(filespec[, force]); + DeleteFolder(folderspec[, force]); + DriveExists(drivespec) + FileExists(filespec) + FolderExists(folderspec) + GetAbsolutePathName(pathspec) + GetBaseName(path) + GetDrive(drivespec) + GetDriveName(path) + GetExtensionName(path) + GetFile(filespec) + GetFileVersion(pathspec) + GetFileName(pathspec) + GetFolder(folderspec) + GetParentFolderName(path) + GetSpecialFolder(folderspec) + GetStandardStream(standardStreamType [, unicode]) + GetTempName() + MoveFile(source, destination); + MoveFolder(source, destination); + OpenTextFile(filename[, iomode[, create[, format]]]) +} + +TextStream { + AtEndOfLine + AtEndOfStream + Column + Line + + Close() + Read(characters) + ReadAll() + ReadLine() + Skip(characters) + SkipLine() + Write(string) + WriteBlankLines(lines) + WriteLine([string]) + OpenAsTextStream([iomode, [format]]) +} + +' Windows Script Host +' https://learn.microsoft.com/en-us/previous-versions/ms950396(v=msdn.10) +ActiveXObject { +} +WScript { +} + + +'! functions ======================================================= +' https://learn.microsoft.com/en-us/previous-versions/3ca8tfek(v=vs.85) +Abs(number) +Array(arglist) +Asc(string) +Atn(number) + +CBool(expression) +CByte(expression) +CCur(expression) +CDate(date) +CDbl(expression) +Chr(charcode) +CInt(expression) +CLng(expression) +CSng(expression) +CStr(expression) +Hex(number) +Oct(number) +Cos(number) +CreateObject(servername.typename [, location]) + +Date +DateAdd(interval, number, date) +DateDiff(interval, date1, date2 [,firstdayofweek[, firstweekofyear]]) +DatePart(interval, date[, firstdayofweek[, firstweekofyear]]) +DateSerial(year, month, day) +DateValue(date) +Day(date) + +Escape(charString) +Eval(expression) +Exp(number) + +Filter(InputStrings, Value[, Include[, Compare]]) +FormatCurrency(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]]) +FormatDateTime(Date[, NamedFormat]) +FormatNumber(Expression [,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]]) +FormatPercent(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]]) + +GetLocale() +GetObject([pathname] [, class]) +GetRef(procname) +Hour(time) + +InputBox(prompt[, title][, default][, xpos][, ypos][, helpfile, context]) +InStr([start, ]string1, string2[, compare]) +InStrRev(string1, string2[, start[, compare]]) +Int(number) +Fix(number) +IsArray(varname) +IsDate(expression) +IsEmpty(expression) +IsNull(expression) +IsNumeric(expression) +IsObject(expression) +Join(list[, delimiter]) + +LBound(arrayname[, dimension]) +LCase(string) +Left(string, length) +Len(string | varname) +LoadPicture(picturename) +Log(number) +LTrim(string) +RTrim(string) +Trim(string) + +Mid(string, start[, length]) +Minute(time) +Month(date) +MonthName(month[, abbreviate]) +MsgBox(prompt[, buttons][, title][, helpfile, context]) +Now + +Replace(expression, find, replacewith[, start[, count[, compare]]]) +RGB(red, green, blue) +Right(string, length) +Rnd[(number)] +Round(expression[, numdecimalplaces]) + +ScriptEngine +ScriptEngineBuildVersion +ScriptEngineMajorVersion +ScriptEngineMinorVersion +Second(time) +SetLocale(lcid) +Sgn(number) +Sin(number) +Space(number) +Split(expression[, delimiter[, count[, compare]]]) +Sqr(number) +StrComp(string1, string2[, compare]) +String(number, character) +StrReverse(string1) +Tan(number) +Time +Timer +TimeSerial(hour, minute, second) +TimeValue(time) +TypeName(varname) + +UBound(arrayname[, dimension]) +UCase(string) +Unescape(charString) +VarType(varname) +Weekday(date, [firstdayofweek]) +WeekdayName(weekday, abbreviate, firstdayofweek) +Year(date) + +'! constants ======================================================= +' https://learn.microsoft.com/en-us/previous-versions/ydz4cfk3(v=vs.85) +' Color Constants +vbBlack vbRed vbGreen vbYellow vbBlue vbMagenta vbCyan vbWhite +' Comparison Constants +vbBinaryCompare vbTextCompare +' Date and Time Constants +vbSunday vbMonday vbTuesday vbWednesday vbThursday vbFriday vbSaturday +vbUseSystemDayOfWeek vbFirstJan1 vbFirstFourDays vbFirstFullWeek +' Date Format Constants +vbGeneralDate vbLongDate vbShortDate vbLongTime vbShortTime +' Miscellaneous Constants +vbObjectError +' MsgBox Constants +vbOKOnly vbOKCancel vbAbortRetryIgnore vbYesNoCancel vbYesNo vbRetryCancel +vbCritical vbQuestion vbExclamation vbInformation +vbDefaultButton1 vbDefaultButton2 vbDefaultButton3 vbDefaultButton4 +vbApplicationModal vbSystemModal +vbOK vbCancel vbAbort vbRetry vbIgnore vbYes vbNo +' String Constants +vbCr vbCrLf vbFormFeed vbLf vbNewLine vbNullChar vbNullString vbTab vbVerticalTab +' Tristate Constants +vbUseDefault vbTrue vbFalse +' VarType Constants +vbEmpty vbNull vbInteger vbLong vbSingle vbDouble vbCurrency vbDate vbString +vbObject vbError vbBoolean vbVariant vbDataObject vbDecimal vbByte vbArray