annotate runtime/indent/testdir/vb.ok @ 31579:7d68a90cbf5c

Update runtime files Commit: https://github.com/vim/vim/commit/f1dcd14fc5d4370476cd82895a4479ca2d252e54 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 31 15:30:45 2022 +0000 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Sat, 31 Dec 2022 16:45:06 +0100
parents
children f8e7e00787b5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31579
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 ' vim: filetype=vb shiftwidth=4 expandtab
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 '
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 ' START_INDENT
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 Public Type GEmployeeRecord ' Create user-defined type.
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 ID As Integer ' Define elements of data type.
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 Name As String * 20
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 Address As String * 30
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 Phone As Long
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 HireDate As Date
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 End Type
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 Public Enum InterfaceColors
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 icMistyRose = &HE1E4FF&
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 icSlateGray = &H908070&
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 icDodgerBlue = &HFF901E&
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 icDeepSkyBlue = &HFFBF00&
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 icSpringGreen = &H7FFF00&
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 icForestGreen = &H228B22&
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 icGoldenrod = &H20A5DA&
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 icFirebrick = &H2222B2&
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 End Enum
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 Enum SecurityLevel
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 IllegalEntry = -1
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 SecurityLevel1 = 0
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 SecurityLevel2 = 1
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 End Enum
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 Public Function TestConditional (number As Integer, ext As String) As Boolean
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 Dim inRange As Boolean
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 Select Case number
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 Case <= 0
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 inRange = False
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 Case > 10
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 inRange = False
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 Case Else
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 inRange = True
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 End Select
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 ' This is a special case identified in the indent script.
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 Select Case number
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 End Select
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 If ext = ".xlm" Then
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 If inRange Then
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 TestConditional = True
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 Else
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 TestConditional = False
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 End If
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 ElseIf ext = ".xlsx" Then
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 If inRange Then
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 TestConditional = False
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 Else
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 TestConditional = True
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 End If
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 Else
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 TestConditional = False
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 End If
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 End Function
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 Private Sub TestIterators (lLimit As Integer, uLimit As Integer)
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 Dim a() As Variant
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 Dim elmt As Variant
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 Dim found As Boolean
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 Dim indx As Integer
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 Const specialValue As Integer = 5
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 If uLimit < lLimit Then
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 Exit Sub
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 End If
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 ReDim a(lLimit To uLimit)
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 For indx=lLimit To Ulimit
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 a(indx) = 2 * indx
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 Next indx
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 found = False
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 For Each elmt in a
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 If elmt = specialValue Then
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 found = True
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 End If
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 Next elmt
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 If found then
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 indx = uLimit
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 Do While indx >= lLimit
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 indx = indx - 1
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 Loop
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 End If
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 End Sub
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 Public Sub TestMultiline (cellAddr As String, rowNbr As Long)
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 Dim rng As Range
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 Set rng = Range(cellAddr)
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 With rng
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 .Cells(1,1).Value = _
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 "Line 1 of multiline string; " & _
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 "Line 2 of multiline string; " & _
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 "Line 3 of multiline string"
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 End With
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 ' The following lines have whitespace after the underscore character
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 ' and therefore do not form a valid multiline statement. The indent
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 ' script correctly treats them as four single line statements contrary
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 ' to the author's obvious indent.
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 rng..Cells(1,1).Value = _
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 "Line 1 of multiline string; " & _
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 "Line 2 of multiline string; " & _
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 "Line 3 of multiline string"
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 End Sub
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 Private Sub TestStmtLabel()
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 GoTo stmtLabel
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 ' Statement labels are never indented
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 stmtLabel:
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 End Sub
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 Sub TestTypeKeyword()
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 Type EmployeeRecord ' Create user-defined type.
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 ID As Integer ' Define elements of data type.
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 Name As String * 20
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 Address As String * 30
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 Phone As Long
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 HireDate As Date
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 End Type
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 Dim varType As EmployeeRecord
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 End Sub
7d68a90cbf5c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 ' END_INDENT