vb6parse 1.0.1

vb6parse is a library for parsing and analyzing VB6 code, from projects, to controls, to modules, and forms.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
//! # `InputBox` Function
//!
//! Displays a prompt in a dialog box, waits for the user to input text or click a button,
//! and returns a `String` containing the contents of the text box.
//!
//! ## Syntax
//!
//! ```vb
//! InputBox(prompt[, title][, default][, xpos][, ypos][, helpfile, context])
//! ```
//!
//! ## Parameters
//!
//! - `prompt` (Required): `String` expression displayed as the message in the dialog box. Maximum length is approximately 1024 characters, depending on width of characters used. Can include line breaks using `vbCrLf`, `vbNewLine`, or `Chr(13) & Chr(10)`
//! - `title` (Optional): `String` expression displayed in the title bar of the dialog box. If omitted, the application name is displayed
//! - `default` (Optional): `String` expression displayed in the text box as the default response if no other input is provided. If omitted, the text box is displayed empty
//! - `xpos` (Optional): Numeric expression that specifies, in twips, the horizontal distance from the left edge of the screen. If omitted, the dialog box is horizontally centered
//! - `ypos` (Optional): Numeric expression that specifies, in twips, the vertical distance from the top of the screen. If omitted, the dialog box is positioned vertically approximately one-third down the screen
//! - `helpfile` (Optional): `String` expression that identifies the Help file to use. If provided, context must also be provided
//! - `context` (Optional): Numeric expression that identifies the Help context number assigned to the Help topic. If provided, helpfile must also be provided
//!
//! ## Return Value
//!
//! Returns a `String`:
//! - If OK is clicked or Enter is pressed: Returns the text in the text box
//! - If Cancel is clicked: Returns an empty string ("")
//! - If Esc is pressed: Returns an empty string ("")
//! - If the default parameter is provided and user clicks OK without entering text: Returns the default value
//!
//! ## Remarks
//!
//! The `InputBox` function provides a simple way to get user input:
//!
//! - Displays a modal dialog box that blocks execution until user responds
//! - The dialog always includes OK and Cancel buttons
//! - Pressing Enter is equivalent to clicking OK
//! - Pressing Esc is equivalent to clicking Cancel
//! - Cannot distinguish between Cancel and an empty string entered by user
//! - For multi-line input, use a custom form instead
//! - Maximum prompt length is approximately 1024 characters
//! - Position parameters (xpos, ypos) are in twips (1440 twips = 1 inch)
//! - Help integration requires both helpfile and context parameters
//! - The text box accepts a single line of text (no multi-line support)
//! - Input is returned as typed (no automatic validation or conversion)
//! - Always returns a `String`, even if numeric input is expected
//!
//! ## Typical Uses
//!
//! 1. **Simple User Input**: Get basic text input from users
//! 2. **Configuration Values**: Prompt for settings or preferences
//! 3. **Data Entry**: Quick single-value data entry
//! 4. **File Names**: Prompt for file or folder names
//! 5. **Search Terms**: Get search queries from users
//! 6. **Passwords**: Simple password entry (though text is visible)
//! 7. **Numeric Input**: Get numeric values (requires validation)
//! 8. **Confirmation Input**: Request verification text from users
//!
//! ## Basic Usage Examples
//!
//! ```vb
//! ' Example 1: Simple input
//! Dim userName As String
//! userName = InputBox("Enter your name:")
//! If userName <> "" Then
//!     MsgBox "Hello, " & userName
//! End If
//!
//! ' Example 2: With title and default
//! Dim age As String
//! age = InputBox("Enter your age:", "Age Entry", "18")
//! If IsNumeric(age) Then
//!     MsgBox "You are " & age & " years old"
//! End If
//!
//! ' Example 3: With position
//! Dim response As String
//! response = InputBox("Enter response:", "Input", "", 1000, 1000)
//!
//! ' Example 4: Multi-line prompt
//! Dim email As String
//! email = InputBox("Please enter your email address:" & vbCrLf & _
//!                  "This will be used for notifications.", _
//!                  "Email Address")
//! ```
//!
//! ## Common Patterns
//!
//! ```vb
//! ' Pattern 1: Validate numeric input
//! Function GetNumericInput(prompt As String, Optional default As String = "0") As Double
//!     Dim input As String
//!     Dim result As Double
//!     
//!     Do
//!         input = InputBox(prompt, "Numeric Input", default)
//!         
//!         If input = "" Then
//!             GetNumericInput = 0
//!             Exit Function
//!         End If
//!         
//!         If IsNumeric(input) Then
//!             GetNumericInput = CDbl(input)
//!             Exit Function
//!         End If
//!         
//!         MsgBox "Please enter a valid number", vbExclamation
//!     Loop
//! End Function
//!
//! ' Pattern 2: Required input (loop until provided)
//! Function GetRequiredInput(prompt As String, title As String) As String
//!     Dim input As String
//!     
//!     Do
//!         input = InputBox(prompt, title)
//!         
//!         If input <> "" Then
//!             GetRequiredInput = input
//!             Exit Function
//!         End If
//!         
//!         If MsgBox("Input is required. Try again?", vbYesNo) = vbNo Then
//!             GetRequiredInput = ""
//!             Exit Function
//!         End If
//!     Loop
//! End Function
//!
//! ' Pattern 3: Input with validation
//! Function GetEmailAddress() As String
//!     Dim email As String
//!     
//!     Do
//!         email = InputBox("Enter your email address:", "Email")
//!         
//!         If email = "" Then
//!             GetEmailAddress = ""
//!             Exit Function
//!         End If
//!         
//!         If InStr(email, "@") > 0 And InStr(email, ".") > 0 Then
//!             GetEmailAddress = email
//!             Exit Function
//!         End If
//!         
//!         MsgBox "Please enter a valid email address", vbExclamation
//!     Loop
//! End Function
//!
//! ' Pattern 4: Input with range validation
//! Function GetIntegerInRange(prompt As String, minVal As Long, maxVal As Long) As Long
//!     Dim input As String
//!     Dim value As Long
//!     
//!     Do
//!         input = InputBox(prompt & vbCrLf & _
//!                         "Range: " & minVal & " to " & maxVal, _
//!                         "Input", CStr(minVal))
//!         
//!         If input = "" Then
//!             GetIntegerInRange = minVal
//!             Exit Function
//!         End If
//!         
//!         If IsNumeric(input) Then
//!             value = CLng(input)
//!             If value >= minVal And value <= maxVal Then
//!                 GetIntegerInRange = value
//!                 Exit Function
//!             End If
//!         End If
//!         
//!         MsgBox "Please enter a value between " & minVal & " and " & maxVal, vbExclamation
//!     Loop
//! End Function
//!
//! ' Pattern 5: File name input with validation
//! Function GetFileName(prompt As String, Optional extension As String = "") As String
//!     Dim fileName As String
//!     
//!     Do
//!         fileName = InputBox(prompt, "File Name")
//!         
//!         If fileName = "" Then
//!             GetFileName = ""
//!             Exit Function
//!         End If
//!         
//!         ' Check for invalid characters
//!         If InStr(fileName, "\") > 0 Or InStr(fileName, "/") > 0 Or _
//!            InStr(fileName, ":") > 0 Or InStr(fileName, "*") > 0 Or _
//!            InStr(fileName, "?") > 0 Or InStr(fileName, """") > 0 Or _
//!            InStr(fileName, "<") > 0 Or InStr(fileName, ">") > 0 Or _
//!            InStr(fileName, "|") > 0 Then
//!             MsgBox "File name contains invalid characters", vbExclamation
//!         Else
//!             If extension <> "" And Right$(fileName, Len(extension)) <> extension Then
//!                 fileName = fileName & extension
//!             End If
//!             GetFileName = fileName
//!             Exit Function
//!         End If
//!     Loop
//! End Function
//!
//! ' Pattern 6: Password input (simple - visible text)
//! Function GetPassword(prompt As String) As String
//!     Dim password As String
//!     Dim confirm As String
//!     
//!     password = InputBox(prompt, "Password")
//!     
//!     If password = "" Then
//!         GetPassword = ""
//!         Exit Function
//!     End If
//!     
//!     confirm = InputBox("Confirm password:", "Confirm Password")
//!     
//!     If password = confirm Then
//!         GetPassword = password
//!     Else
//!         MsgBox "Passwords do not match", vbExclamation
//!         GetPassword = ""
//!     End If
//! End Function
//!
//! ' Pattern 7: Multiple inputs in sequence
//! Sub GetUserInfo()
//!     Dim firstName As String
//!     Dim lastName As String
//!     Dim email As String
//!     
//!     firstName = InputBox("Enter first name:", "User Information")
//!     If firstName = "" Then Exit Sub
//!     
//!     lastName = InputBox("Enter last name:", "User Information")
//!     If lastName = "" Then Exit Sub
//!     
//!     email = InputBox("Enter email:", "User Information")
//!     If email = "" Then Exit Sub
//!     
//!     MsgBox "User: " & firstName & " " & lastName & vbCrLf & _
//!            "Email: " & email
//! End Sub
//!
//! ' Pattern 8: Input with list of options in prompt
//! Function GetOption() As String
//!     Dim choice As String
//!     Dim prompt As String
//!     
//!     prompt = "Select an option:" & vbCrLf & _
//!              "1 - Create new file" & vbCrLf & _
//!              "2 - Open existing file" & vbCrLf & _
//!              "3 - Exit" & vbCrLf & vbCrLf & _
//!              "Enter choice (1-3):"
//!     
//!     choice = InputBox(prompt, "Main Menu", "1")
//!     
//!     Select Case choice
//!         Case "1", "2", "3"
//!             GetOption = choice
//!         Case Else
//!             GetOption = ""
//!     End Select
//! End Function
//!
//! ' Pattern 9: Trim and clean input
//! Function GetCleanInput(prompt As String, title As String) As String
//!     Dim input As String
//!     
//!     input = InputBox(prompt, title)
//!     
//!     ' Trim whitespace
//!     input = Trim$(input)
//!     
//!     ' Remove multiple spaces
//!     Do While InStr(input, "  ") > 0
//!         input = Replace(input, "  ", " ")
//!     Loop
//!     
//!     GetCleanInput = input
//! End Function
//!
//! ' Pattern 10: Cancel detection with default
//! Function GetInputWithCancelDetection(prompt As String, defaultValue As String) As Variant
//!     Dim input As String
//!     
//!     input = InputBox(prompt, "Input", defaultValue)
//!     
//!     If input = "" And defaultValue <> "" Then
//!         ' User likely clicked Cancel
//!         GetInputWithCancelDetection = Null
//!     Else
//!         GetInputWithCancelDetection = input
//!     End If
//! End Function
//! ```
//!
//! ## Advanced Usage Examples
//!
//! ```vb
//! ' Example 1: Configuration manager with InputBox
//! Public Class ConfigManager
//!     Private m_settings As Collection
//!     
//!     Private Sub Class_Initialize()
//!         Set m_settings = New Collection
//!     End Sub
//!     
//!     Public Function GetSetting(key As String, prompt As String, _
//!                                Optional defaultValue As String = "") As String
//!         On Error Resume Next
//!         GetSetting = m_settings(key)
//!         
//!         If Err.Number <> 0 Or GetSetting = "" Then
//!             Err.Clear
//!             GetSetting = InputBox(prompt, "Configuration: " & key, defaultValue)
//!             
//!             If GetSetting <> "" Then
//!                 m_settings.Add GetSetting, key
//!             End If
//!         End If
//!         On Error GoTo 0
//!     End Function
//!     
//!     Public Sub ClearSettings()
//!         Set m_settings = New Collection
//!     End Sub
//! End Class
//!
//! ' Example 2: Data validation wrapper
//! Public Class InputValidator
//!     Public Enum ValidationType
//!         vtText = 0
//!         vtInteger = 1
//!         vtDecimal = 2
//!         vtEmail = 3
//!         vtDate = 4
//!     End Enum
//!     
//!     Public Function GetValidatedInput(prompt As String, _
//!                                       validationType As ValidationType, _
//!                                       Optional title As String = "Input", _
//!                                       Optional defaultValue As String = "") As Variant
//!         Dim input As String
//!         Dim isValid As Boolean
//!         
//!         Do
//!             input = InputBox(prompt, title, defaultValue)
//!             
//!             If input = "" Then
//!                 GetValidatedInput = Null
//!                 Exit Function
//!             End If
//!             
//!             isValid = ValidateInput(input, validationType)
//!             
//!             If isValid Then
//!                 GetValidatedInput = ConvertInput(input, validationType)
//!                 Exit Function
//!             Else
//!                 MsgBox "Invalid input. Please try again.", vbExclamation
//!             End If
//!         Loop
//!     End Function
//!     
//!     Private Function ValidateInput(input As String, vType As ValidationType) As Boolean
//!         Select Case vType
//!             Case vtText
//!                 ValidateInput = Len(input) > 0
//!             Case vtInteger
//!                 ValidateInput = IsNumeric(input) And InStr(input, ".") = 0
//!             Case vtDecimal
//!                 ValidateInput = IsNumeric(input)
//!             Case vtEmail
//!                 ValidateInput = InStr(input, "@") > 0 And InStr(input, ".") > 0
//!             Case vtDate
//!                 ValidateInput = IsDate(input)
//!             Case Else
//!                 ValidateInput = False
//!         End Select
//!     End Function
//!     
//!     Private Function ConvertInput(input As String, vType As ValidationType) As Variant
//!         Select Case vType
//!             Case vtInteger
//!                 ConvertInput = CLng(input)
//!             Case vtDecimal
//!                 ConvertInput = CDbl(input)
//!             Case vtDate
//!                 ConvertInput = CDate(input)
//!             Case Else
//!                 ConvertInput = input
//!         End Select
//!     End Function
//! End Class
//!
//! ' Example 3: Wizard-style input sequence
//! Function RunWizard() As Boolean
//!     Dim step1 As String, step2 As String, step3 As String
//!     Dim prompt As String
//!     
//!     ' Step 1
//!     prompt = "Step 1 of 3:" & vbCrLf & _
//!              "Enter project name:"
//!     step1 = InputBox(prompt, "Project Wizard")
//!     If step1 = "" Then
//!         RunWizard = False
//!         Exit Function
//!     End If
//!     
//!     ' Step 2
//!     prompt = "Step 2 of 3:" & vbCrLf & _
//!              "Enter project location:"
//!     step2 = InputBox(prompt, "Project Wizard", "C:\Projects")
//!     If step2 = "" Then
//!         RunWizard = False
//!         Exit Function
//!     End If
//!     
//!     ' Step 3
//!     prompt = "Step 3 of 3:" & vbCrLf & _
//!              "Enter description:"
//!     step3 = InputBox(prompt, "Project Wizard")
//!     If step3 = "" Then step3 = "(No description)"
//!     
//!     ' Create project
//!     MsgBox "Creating project:" & vbCrLf & _
//!            "Name: " & step1 & vbCrLf & _
//!            "Location: " & step2 & vbCrLf & _
//!            "Description: " & step3
//!     
//!     RunWizard = True
//! End Function
//!
//! ' Example 4: Search query builder
//! Function BuildSearchQuery() As String
//!     Dim searchTerm As String
//!     Dim filters As String
//!     Dim query As String
//!     
//!     searchTerm = InputBox("Enter search term:", "Search")
//!     If searchTerm = "" Then
//!         BuildSearchQuery = ""
//!         Exit Function
//!     End If
//!     
//!     filters = InputBox("Enter filters (optional):" & vbCrLf & _
//!                       "Examples: category:books, year:2020", _
//!                       "Search Filters")
//!     
//!     query = "search=" & searchTerm
//!     If filters <> "" Then
//!         query = query & "&filters=" & filters
//!     End If
//!     
//!     BuildSearchQuery = query
//! End Function
//! ```
//!
//! ## Error Handling
//!
//! The `InputBox` function rarely raises errors, but should be used with error handling:
//!
//! ```vb
//! On Error GoTo ErrorHandler
//! Dim userInput As String
//!
//! userInput = InputBox("Enter value:", "Input")
//!
//! If userInput = "" Then
//!     MsgBox "No input provided", vbInformation
//! Else
//!     ProcessInput userInput
//! End If
//! Exit Sub
//!
//! ErrorHandler:
//!     MsgBox "Error getting input: " & Err.Description, vbCritical
//! ```
//!
//! ## Performance Considerations
//!
//! - **Modal Dialog**: Blocks execution until user responds
//! - **User Interaction**: Performance depends entirely on user response time
//! - **String Returns**: Always returns a `String` regardless of expected data type
//! - **No Timeout**: Dialog waits indefinitely for user action
//! - **Lightweight**: Minimal overhead for displaying dialog
//!
//! ## Best Practices
//!
//! 1. **Clear Prompts**: Write clear, concise prompts that explain what input is needed
//! 2. **Validate Input**: Always validate and convert input as needed (`InputBox` returns `String`)
//! 3. **Handle Cancel**: Check for empty string return value (could be Cancel or empty input)
//! 4. **Provide Defaults**: Use default parameter for common or suggested values
//! 5. **Error Handling**: Wrap `InputBox` calls in error handling
//! 6. **Alternative UI**: For complex input, use custom forms instead of `InputBox`
//! 7. **Accessibility**: Consider users who need keyboard navigation
//! 8. **Multi-line Prompts**: Use `vbCrLf` to create multi-line prompts for clarity
//!
//! ## Comparison with Other Functions
//!
//! | Function | Purpose | Return Type |
//! |----------|---------|-------------|
//! | `InputBox` | Get user text input | `String` |
//! | `MsgBox` | Display message, get button click | `VbMsgBoxResult` |
//! | Custom Form | Complex input with multiple fields | Varies |
//! | `FileDialog` | Get file/folder selection | `String` |
//!
//! ## Platform and Version Notes
//!
//! - Available in all VB6 versions
//! - Dialog appearance follows Windows theme
//! - Maximum prompt length is approximately 1024 characters
//! - Position parameters use twips (1440 twips = 1 inch)
//! - No built-in password masking (text is visible)
//! - Help integration requires compiled help files (.hlp or .chm)
//!
//! ## Limitations
//!
//! - Single-line text input only (no multi-line support)
//! - Cannot distinguish between Cancel and empty input
//! - No input masking for passwords
//! - No built-in validation
//! - Modal dialog blocks all application interaction
//! - No timeout option (waits indefinitely)
//! - Limited formatting options for prompt text
//! - Cannot customize button labels (always OK/Cancel)
//! - No progress indication for long operations
//!
//! ## Related Functions
//!
//! - `MsgBox`: Display messages and get button responses
//! - `Input`: Read from files (different from `InputBox`)
//! - Custom Forms: For complex input scenarios
//! - `Shell`: Execute external programs for advanced input

#[cfg(test)]
mod tests {
    use crate::*;

    #[test]
    fn inputbox_basic() {
        let source = r#"
Sub Test()
    name = InputBox("Enter your name:")
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_with_title() {
        let source = r#"
Sub Test()
    age = InputBox("Enter age:", "Age Entry")
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_with_default() {
        let source = r#"
Sub Test()
    city = InputBox("Enter city:", "Location", "New York")
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_with_position() {
        let source = r#"
Sub Test()
    response = InputBox("Enter response:", "Input", "", 1000, 1000)
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_if_statement() {
        let source = r#"
Sub Test()
    If InputBox("Continue?") <> "" Then
        MsgBox "Continuing"
    End If
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_in_loop() {
        let source = r#"
Sub Test()
    Do
        value = InputBox("Enter value:")
    Loop Until value <> ""
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_function_return() {
        let source = r#"
Function GetName() As String
    GetName = InputBox("Enter name:", "Name Entry")
End Function
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_trim() {
        let source = r#"
Sub Test()
    cleaned = Trim$(InputBox("Enter text:"))
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_isnumeric() {
        let source = r#"
Sub Test()
    If IsNumeric(InputBox("Enter number:")) Then
        Debug.Print "Valid"
    End If
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_comparison() {
        let source = r#"
Sub Test()
    If InputBox("Password:") = "secret" Then
        MsgBox "Access granted"
    End If
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_concatenation() {
        let source = r#"
Sub Test()
    fullName = InputBox("First name:") & " " & InputBox("Last name:")
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_msgbox() {
        let source = r#"
Sub Test()
    MsgBox InputBox("Enter message:")
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_select_case() {
        let source = r#"
Sub Test()
    Select Case InputBox("Select option (1-3):")
        Case "1"
            MsgBox "Option 1"
    End Select
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_for_loop() {
        let source = r#"
Sub Test()
    Dim i As Integer
    For i = 1 To 3
        names(i) = InputBox("Enter name " & i & ":")
    Next i
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_debug_print() {
        let source = r#"
Sub Test()
    Debug.Print "User entered: " & InputBox("Enter text:")
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_with_vbcrlf() {
        let source = r#"
Sub Test()
    result = InputBox("Line 1" & vbCrLf & "Line 2", "Multi-line Prompt")
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_in_class() {
        let source = r#"
Private Sub Class_Initialize()
    m_userName = InputBox("Enter username:")
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_property_assignment() {
        let source = r#"
Sub Test()
    obj.Name = InputBox("Enter name:")
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_array_assignment() {
        let source = r#"
Sub Test()
    values(index) = InputBox("Enter value:")
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_with_statement() {
        let source = r#"
Sub Test()
    With userData
        .Name = InputBox("Name:")
    End With
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_collection_add() {
        let source = r#"
Sub Test()
    col.Add InputBox("Enter item:")
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_function_argument() {
        let source = r#"
Sub Test()
    Call ProcessName(InputBox("Enter name:"))
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_len_check() {
        let source = r#"
Sub Test()
    If Len(InputBox("Enter text:")) > 0 Then
        MsgBox "Text entered"
    End If
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_ucase() {
        let source = r#"
Sub Test()
    code = UCase$(InputBox("Enter code:"))
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_val() {
        let source = r#"
Sub Test()
    number = Val(InputBox("Enter number:"))
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_iif() {
        let source = r#"
Sub Test()
    result = IIf(InputBox("Confirm?") = "yes", "Confirmed", "Cancelled")
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }

    #[test]
    fn inputbox_parentheses() {
        let source = r#"
Sub Test()
    value = (InputBox("Enter value:"))
End Sub
"#;
        let (cst_opt, _failures) = ConcreteSyntaxTree::from_text("test.bas", source).unpack();
        let cst = cst_opt.expect("CST should be parsed");

        let tree = cst.to_serializable();

        let mut settings = insta::Settings::clone_current();
        settings.set_snapshot_path(
            "../../../../../snapshots/syntax/library/functions/interaction/inputbox",
        );
        settings.set_prepend_module_to_snapshot(false);
        let _guard = settings.bind_to_scope();
        insta::assert_yaml_snapshot!(tree);
    }
}