Skip to content

Commit caba9a7

Browse files
authored
Merge pull request #4830 from ScottDennison/next
Grammar cannot handle an empty moduleConfigProperty
2 parents 3454d64 + 77433e5 commit caba9a7

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

Rubberduck.Parsing/Grammar/VBAParser.g4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ moduleConfig :
5959

6060
moduleConfigProperty :
6161
BEGINPROPERTY whiteSpace unrestrictedIdentifier (LPAREN numberLiteral RPAREN)? (whiteSpace GUIDLITERAL)? endOfStatement
62-
(moduleConfigProperty | moduleConfigElement)+
62+
(moduleConfigProperty | moduleConfigElement)*
6363
ENDPROPERTY endOfStatement
6464
;
6565

RubberduckTests/Grammar/VBAParserTests.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,50 @@ BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
10921092
EndProperty
10931093
End
10941094
End
1095+
";
1096+
var parseResult = Parse(code);
1097+
AssertTree(parseResult.Item1, parseResult.Item2, "//moduleConfigProperty", matches => matches.Count == 2);
1098+
}
1099+
1100+
[Category("Parser")]
1101+
[Test]
1102+
public void TestNestedVbFormModuleConfigWithAnEmptyNestedProperty()
1103+
{
1104+
string code = @"
1105+
VERSION 5.00
1106+
Object = ""{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0""; ""MSCOMCTL.OCX""
1107+
Begin VB.Form Form1
1108+
Caption = ""Form1""
1109+
ClientHeight = 3195
1110+
ClientLeft = 60
1111+
ClientTop = 345
1112+
ClientWidth = 4680
1113+
LinkTopic = ""Form1""
1114+
ScaleHeight = 3195
1115+
ScaleWidth = 4680
1116+
StartUpPosition = 3 'Windows Default
1117+
Begin MSComctlLib.StatusBar StatusBar1
1118+
Align = 2 'Align Bottom
1119+
Height = 375
1120+
Left = 0
1121+
TabIndex = 0
1122+
Top = 2820
1123+
Width = 4680
1124+
_ExtentX = 8255
1125+
_ExtentY = 661
1126+
_Version = 393216
1127+
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
1128+
NumPanels = 1
1129+
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
1130+
EndProperty
1131+
EndProperty
1132+
End
1133+
End
1134+
Attribute VB_Name = ""Form1""
1135+
Attribute VB_GlobalNameSpace = False
1136+
Attribute VB_Creatable = False
1137+
Attribute VB_PredeclaredId = True
1138+
Attribute VB_Exposed = False
10951139
";
10961140
var parseResult = Parse(code);
10971141
AssertTree(parseResult.Item1, parseResult.Item2, "//moduleConfigProperty", matches => matches.Count == 2);

0 commit comments

Comments
 (0)