Skip to content

Commit 0be5e8b

Browse files
committed
fixes #730 (nested if/elseif/else precompiler directives work)
1 parent 18718f1 commit 0be5e8b

File tree

3 files changed

+3203
-3158
lines changed

3 files changed

+3203
-3158
lines changed

Rubberduck.Parsing/Grammar/VBA.g4

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -359,18 +359,18 @@ macroConstStmt : MACRO_CONST WS? ambiguousIdentifier WS? EQ WS? valueStmt;
359359
macroIfThenElseStmt : macroIfBlockStmt macroElseIfBlockStmt* macroElseBlockStmt? MACRO_END_IF;
360360

361361
macroIfBlockStmt :
362-
MACRO_IF WS? ifConditionStmt WS THEN NEWLINE+
363-
((moduleDeclarationsElement | moduleBody | block) NEWLINE*)?
362+
MACRO_IF WS? ifConditionStmt WS THEN NEWLINE*
363+
((moduleDeclarationsElement | moduleBody | block) NEWLINE*)*
364364
;
365365

366366
macroElseIfBlockStmt :
367-
MACRO_ELSEIF WS? ifConditionStmt WS THEN NEWLINE+
368-
((moduleDeclarationsElement | moduleBody | block) NEWLINE*)?
367+
MACRO_ELSEIF WS? ifConditionStmt WS THEN NEWLINE*
368+
((moduleDeclarationsElement | moduleBody | block) NEWLINE*)*
369369
;
370370

371371
macroElseBlockStmt :
372-
MACRO_ELSE NEWLINE+
373-
((moduleDeclarationsElement | moduleBody | block) NEWLINE*)?
372+
MACRO_ELSE NEWLINE*
373+
((moduleDeclarationsElement | moduleBody | block) NEWLINE*)*
374374
;
375375

376376
midStmt : MID WS? LPAREN WS? argsCall WS? RPAREN;
@@ -797,8 +797,8 @@ LSET : L S E T;
797797
MACRO_CONST : '#' C O N S T WS;
798798
MACRO_IF : '#' I F WS;
799799
MACRO_ELSEIF : '#' E L S E I F WS;
800-
MACRO_ELSE : '#' E L S E WS;
801-
MACRO_END_IF : '#' E N D WS I F;
800+
MACRO_ELSE : '#' E L S E NEWLINE;
801+
MACRO_END_IF : '#' E N D WS I F NEWLINE;
802802
ME : M E;
803803
MID : M I D;
804804
MKDIR : M K D I R;

0 commit comments

Comments
 (0)