Skip to content

Commit 55d00e0

Browse files
committed
fixed Attributes.g4 to parse UserForm headers.
1 parent 0dc14a7 commit 55d00e0

File tree

5 files changed

+2152
-2025
lines changed

5 files changed

+2152
-2025
lines changed

Rubberduck.Parsing/VBA/AttributeParser.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ public override void ExitAttributeStmt(AttributesParser.AttributeStmtContext con
142142
public override void ExitModuleConfigElement(AttributesParser.ModuleConfigElementContext context)
143143
{
144144
var name = context.ambiguousIdentifier().GetText();
145-
var values = new[] {context.literal().GetText()};
145+
var literal = context.literal();
146+
var values = new[] { literal == null ? string.Empty : literal.GetText()};
146147
_currentScopeAttributes.Add(name, values);
147148
}
148149
}

Rubberduck.Parsing/VBA/Attributes.g4

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,16 @@ module :
3333
WS?
3434
;
3535

36-
moduleHeader : VERSION WS DOUBLELITERAL WS CLASS;
36+
moduleHeader : VERSION WS DOUBLELITERAL WS? CLASS? endOfStatement;
3737

3838
moduleConfig :
39-
BEGIN endOfStatement
39+
BEGIN (WS GUIDLITERAL WS ambiguousIdentifier WS?)? endOfStatement
4040
moduleConfigElement+
4141
END
4242
;
4343

4444
moduleConfigElement :
45-
ambiguousIdentifier WS? EQ WS? literal endOfStatement
46-
;
45+
ambiguousIdentifier WS* EQ WS* literal (':' SHORTLITERAL)? endOfStatement;
4746

4847
moduleAttributes : (attributeStmt endOfStatement)+;
4948

@@ -423,6 +422,7 @@ HEXLITERAL : '&H' [0-9A-F]+ '&'?;
423422
SHORTLITERAL : (PLUS|MINUS)? DIGIT+ ('#' | '&' | '@')?;
424423
INTEGERLITERAL : SHORTLITERAL (E SHORTLITERAL)?;
425424
DOUBLELITERAL : (PLUS|MINUS)? DIGIT* '.' DIGIT+ (E SHORTLITERAL)?;
425+
GUIDLITERAL : '{' [0-9A-F]+ '-' [0-9A-F]+ '-' [0-9A-F]+ '-' [0-9A-F]+ '-' [0-9A-F]+ '}';
426426
427427
DATELITERAL : '#' DATEORTIME '#';
428428
fragment DATEORTIME : DATEVALUE WS? TIMEVALUE | DATEVALUE | TIMEVALUE;

0 commit comments

Comments
 (0)