Skip to content

Commit 5df7a89

Browse files
author
Andrin Meier
committed
add preprocessor validity tests
1 parent 56d8523 commit 5df7a89

35 files changed

+8996
-7929
lines changed

Rubberduck.Parsing/Grammar/VBA.g4

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ moduleDeclarationsElement :
6666
| variableStmt
6767
| moduleOption
6868
| typeStmt
69-
| macroStmt
70-
;
71-
72-
macroStmt :
73-
macroConstStmt
74-
| macroIfThenElseStmt
7569
;
7670

7771
moduleBody :
@@ -83,7 +77,6 @@ moduleBodyElement :
8377
| propertySetStmt
8478
| propertyLetStmt
8579
| subStmt
86-
| macroStmt
8780
;
8881

8982

@@ -126,7 +119,6 @@ blockStmt :
126119
| loadStmt
127120
| lockStmt
128121
| lsetStmt
129-
| macroStmt
130122
| midStmt
131123
| mkdirStmt
132124
| nameStmt
@@ -291,25 +283,6 @@ lockStmt : LOCK WS valueStmt (WS? ',' WS? valueStmt (WS TO WS valueStmt)?)?;
291283

292284
lsetStmt : LSET WS implicitCallStmt_InStmt WS? EQ WS? valueStmt;
293285

294-
macroConstStmt : MACRO_CONST WS? ambiguousIdentifier WS? EQ WS? valueStmt;
295-
296-
macroIfThenElseStmt : macroIfBlockStmt macroElseIfBlockStmt* macroElseBlockStmt? MACRO_END_IF;
297-
298-
macroIfBlockStmt :
299-
MACRO_IF WS? ifConditionStmt WS THEN endOfStatement
300-
(moduleDeclarations | moduleBody | block)*
301-
;
302-
303-
macroElseIfBlockStmt :
304-
MACRO_ELSEIF WS? ifConditionStmt WS THEN endOfStatement
305-
(moduleDeclarations | moduleBody | block)*
306-
;
307-
308-
macroElseBlockStmt :
309-
MACRO_ELSE endOfStatement
310-
(moduleDeclarations | moduleBody | block)*
311-
;
312-
313286
midStmt : MID WS? LPAREN WS? argsCall WS? RPAREN;
314287

315288
mkdirStmt : MKDIR WS valueStmt;
@@ -726,11 +699,6 @@ LOCK_READ : L O C K WS R E A D;
726699
LOCK_WRITE : L O C K WS W R I T E;
727700
LOCK_READ_WRITE : L O C K WS R E A D WS W R I T E;
728701
LSET : L S E T;
729-
MACRO_CONST : '#' C O N S T;
730-
MACRO_IF : '#' I F;
731-
MACRO_ELSEIF : '#' E L S E I F;
732-
MACRO_ELSE : '#' E L S E;
733-
MACRO_END_IF : '#' E N D WS? I F;
734702
ME : M E;
735703
MID : M I D;
736704
MKDIR : M K D I R;

Rubberduck.Parsing/Grammar/VBABaseListener.cs

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,19 +1203,6 @@ public virtual void EnterForEachStmt([NotNull] VBAParser.ForEachStmtContext cont
12031203
/// <param name="context">The parse tree.</param>
12041204
public virtual void ExitForEachStmt([NotNull] VBAParser.ForEachStmtContext context) { }
12051205

1206-
/// <summary>
1207-
/// Enter a parse tree produced by <see cref="VBAParser.macroElseBlockStmt"/>.
1208-
/// <para>The default implementation does nothing.</para>
1209-
/// </summary>
1210-
/// <param name="context">The parse tree.</param>
1211-
public virtual void EnterMacroElseBlockStmt([NotNull] VBAParser.MacroElseBlockStmtContext context) { }
1212-
/// <summary>
1213-
/// Exit a parse tree produced by <see cref="VBAParser.macroElseBlockStmt"/>.
1214-
/// <para>The default implementation does nothing.</para>
1215-
/// </summary>
1216-
/// <param name="context">The parse tree.</param>
1217-
public virtual void ExitMacroElseBlockStmt([NotNull] VBAParser.MacroElseBlockStmtContext context) { }
1218-
12191206
/// <summary>
12201207
/// Enter a parse tree produced by <see cref="VBAParser.exitStmt"/>.
12211208
/// <para>The default implementation does nothing.</para>
@@ -1528,19 +1515,6 @@ public virtual void EnterVariableStmt([NotNull] VBAParser.VariableStmtContext co
15281515
/// <param name="context">The parse tree.</param>
15291516
public virtual void ExitVariableStmt([NotNull] VBAParser.VariableStmtContext context) { }
15301517

1531-
/// <summary>
1532-
/// Enter a parse tree produced by <see cref="VBAParser.macroIfBlockStmt"/>.
1533-
/// <para>The default implementation does nothing.</para>
1534-
/// </summary>
1535-
/// <param name="context">The parse tree.</param>
1536-
public virtual void EnterMacroIfBlockStmt([NotNull] VBAParser.MacroIfBlockStmtContext context) { }
1537-
/// <summary>
1538-
/// Exit a parse tree produced by <see cref="VBAParser.macroIfBlockStmt"/>.
1539-
/// <para>The default implementation does nothing.</para>
1540-
/// </summary>
1541-
/// <param name="context">The parse tree.</param>
1542-
public virtual void ExitMacroIfBlockStmt([NotNull] VBAParser.MacroIfBlockStmtContext context) { }
1543-
15441518
/// <summary>
15451519
/// Enter a parse tree produced by <see cref="VBAParser.subscript"/>.
15461520
/// <para>The default implementation does nothing.</para>
@@ -1645,19 +1619,6 @@ public virtual void EnterFunctionStmt([NotNull] VBAParser.FunctionStmtContext co
16451619
/// <param name="context">The parse tree.</param>
16461620
public virtual void ExitFunctionStmt([NotNull] VBAParser.FunctionStmtContext context) { }
16471621

1648-
/// <summary>
1649-
/// Enter a parse tree produced by <see cref="VBAParser.macroElseIfBlockStmt"/>.
1650-
/// <para>The default implementation does nothing.</para>
1651-
/// </summary>
1652-
/// <param name="context">The parse tree.</param>
1653-
public virtual void EnterMacroElseIfBlockStmt([NotNull] VBAParser.MacroElseIfBlockStmtContext context) { }
1654-
/// <summary>
1655-
/// Exit a parse tree produced by <see cref="VBAParser.macroElseIfBlockStmt"/>.
1656-
/// <para>The default implementation does nothing.</para>
1657-
/// </summary>
1658-
/// <param name="context">The parse tree.</param>
1659-
public virtual void ExitMacroElseIfBlockStmt([NotNull] VBAParser.MacroElseIfBlockStmtContext context) { }
1660-
16611622
/// <summary>
16621623
/// Enter a parse tree produced by <see cref="VBAParser.returnStmt"/>.
16631624
/// <para>The default implementation does nothing.</para>
@@ -2022,19 +1983,6 @@ public virtual void EnterVariableListStmt([NotNull] VBAParser.VariableListStmtCo
20221983
/// <param name="context">The parse tree.</param>
20231984
public virtual void ExitVariableListStmt([NotNull] VBAParser.VariableListStmtContext context) { }
20241985

2025-
/// <summary>
2026-
/// Enter a parse tree produced by <see cref="VBAParser.macroConstStmt"/>.
2027-
/// <para>The default implementation does nothing.</para>
2028-
/// </summary>
2029-
/// <param name="context">The parse tree.</param>
2030-
public virtual void EnterMacroConstStmt([NotNull] VBAParser.MacroConstStmtContext context) { }
2031-
/// <summary>
2032-
/// Exit a parse tree produced by <see cref="VBAParser.macroConstStmt"/>.
2033-
/// <para>The default implementation does nothing.</para>
2034-
/// </summary>
2035-
/// <param name="context">The parse tree.</param>
2036-
public virtual void ExitMacroConstStmt([NotNull] VBAParser.MacroConstStmtContext context) { }
2037-
20381986
/// <summary>
20391987
/// Enter a parse tree produced by <see cref="VBAParser.iCS_B_ProcedureCall"/>.
20401988
/// <para>The default implementation does nothing.</para>
@@ -2100,19 +2048,6 @@ public virtual void EnterMidStmt([NotNull] VBAParser.MidStmtContext context) { }
21002048
/// <param name="context">The parse tree.</param>
21012049
public virtual void ExitMidStmt([NotNull] VBAParser.MidStmtContext context) { }
21022050

2103-
/// <summary>
2104-
/// Enter a parse tree produced by <see cref="VBAParser.macroIfThenElseStmt"/>.
2105-
/// <para>The default implementation does nothing.</para>
2106-
/// </summary>
2107-
/// <param name="context">The parse tree.</param>
2108-
public virtual void EnterMacroIfThenElseStmt([NotNull] VBAParser.MacroIfThenElseStmtContext context) { }
2109-
/// <summary>
2110-
/// Exit a parse tree produced by <see cref="VBAParser.macroIfThenElseStmt"/>.
2111-
/// <para>The default implementation does nothing.</para>
2112-
/// </summary>
2113-
/// <param name="context">The parse tree.</param>
2114-
public virtual void ExitMacroIfThenElseStmt([NotNull] VBAParser.MacroIfThenElseStmtContext context) { }
2115-
21162051
/// <summary>
21172052
/// Enter a parse tree produced by <see cref="VBAParser.vsPow"/>.
21182053
/// <para>The default implementation does nothing.</para>
@@ -2282,19 +2217,6 @@ public virtual void EnterModuleBodyElement([NotNull] VBAParser.ModuleBodyElement
22822217
/// <param name="context">The parse tree.</param>
22832218
public virtual void ExitModuleBodyElement([NotNull] VBAParser.ModuleBodyElementContext context) { }
22842219

2285-
/// <summary>
2286-
/// Enter a parse tree produced by <see cref="VBAParser.macroStmt"/>.
2287-
/// <para>The default implementation does nothing.</para>
2288-
/// </summary>
2289-
/// <param name="context">The parse tree.</param>
2290-
public virtual void EnterMacroStmt([NotNull] VBAParser.MacroStmtContext context) { }
2291-
/// <summary>
2292-
/// Exit a parse tree produced by <see cref="VBAParser.macroStmt"/>.
2293-
/// <para>The default implementation does nothing.</para>
2294-
/// </summary>
2295-
/// <param name="context">The parse tree.</param>
2296-
public virtual void ExitMacroStmt([NotNull] VBAParser.MacroStmtContext context) { }
2297-
22982220
/// <summary>
22992221
/// Enter a parse tree produced by <see cref="VBAParser.vsMid"/>.
23002222
/// <para>The default implementation does nothing.</para>

Rubberduck.Parsing/Grammar/VBABaseVisitor.cs

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,17 +1022,6 @@ public partial class VBABaseVisitor<Result> : AbstractParseTreeVisitor<Result>,
10221022
/// <return>The visitor result.</return>
10231023
public virtual Result VisitForEachStmt([NotNull] VBAParser.ForEachStmtContext context) { return VisitChildren(context); }
10241024

1025-
/// <summary>
1026-
/// Visit a parse tree produced by <see cref="VBAParser.macroElseBlockStmt"/>.
1027-
/// <para>
1028-
/// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
1029-
/// on <paramref name="context"/>.
1030-
/// </para>
1031-
/// </summary>
1032-
/// <param name="context">The parse tree.</param>
1033-
/// <return>The visitor result.</return>
1034-
public virtual Result VisitMacroElseBlockStmt([NotNull] VBAParser.MacroElseBlockStmtContext context) { return VisitChildren(context); }
1035-
10361025
/// <summary>
10371026
/// Visit a parse tree produced by <see cref="VBAParser.exitStmt"/>.
10381027
/// <para>
@@ -1297,17 +1286,6 @@ public partial class VBABaseVisitor<Result> : AbstractParseTreeVisitor<Result>,
12971286
/// <return>The visitor result.</return>
12981287
public virtual Result VisitVariableStmt([NotNull] VBAParser.VariableStmtContext context) { return VisitChildren(context); }
12991288

1300-
/// <summary>
1301-
/// Visit a parse tree produced by <see cref="VBAParser.macroIfBlockStmt"/>.
1302-
/// <para>
1303-
/// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
1304-
/// on <paramref name="context"/>.
1305-
/// </para>
1306-
/// </summary>
1307-
/// <param name="context">The parse tree.</param>
1308-
/// <return>The visitor result.</return>
1309-
public virtual Result VisitMacroIfBlockStmt([NotNull] VBAParser.MacroIfBlockStmtContext context) { return VisitChildren(context); }
1310-
13111289
/// <summary>
13121290
/// Visit a parse tree produced by <see cref="VBAParser.subscript"/>.
13131291
/// <para>
@@ -1396,17 +1374,6 @@ public partial class VBABaseVisitor<Result> : AbstractParseTreeVisitor<Result>,
13961374
/// <return>The visitor result.</return>
13971375
public virtual Result VisitFunctionStmt([NotNull] VBAParser.FunctionStmtContext context) { return VisitChildren(context); }
13981376

1399-
/// <summary>
1400-
/// Visit a parse tree produced by <see cref="VBAParser.macroElseIfBlockStmt"/>.
1401-
/// <para>
1402-
/// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
1403-
/// on <paramref name="context"/>.
1404-
/// </para>
1405-
/// </summary>
1406-
/// <param name="context">The parse tree.</param>
1407-
/// <return>The visitor result.</return>
1408-
public virtual Result VisitMacroElseIfBlockStmt([NotNull] VBAParser.MacroElseIfBlockStmtContext context) { return VisitChildren(context); }
1409-
14101377
/// <summary>
14111378
/// Visit a parse tree produced by <see cref="VBAParser.returnStmt"/>.
14121379
/// <para>
@@ -1715,17 +1682,6 @@ public partial class VBABaseVisitor<Result> : AbstractParseTreeVisitor<Result>,
17151682
/// <return>The visitor result.</return>
17161683
public virtual Result VisitVariableListStmt([NotNull] VBAParser.VariableListStmtContext context) { return VisitChildren(context); }
17171684

1718-
/// <summary>
1719-
/// Visit a parse tree produced by <see cref="VBAParser.macroConstStmt"/>.
1720-
/// <para>
1721-
/// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
1722-
/// on <paramref name="context"/>.
1723-
/// </para>
1724-
/// </summary>
1725-
/// <param name="context">The parse tree.</param>
1726-
/// <return>The visitor result.</return>
1727-
public virtual Result VisitMacroConstStmt([NotNull] VBAParser.MacroConstStmtContext context) { return VisitChildren(context); }
1728-
17291685
/// <summary>
17301686
/// Visit a parse tree produced by <see cref="VBAParser.iCS_B_ProcedureCall"/>.
17311687
/// <para>
@@ -1781,17 +1737,6 @@ public partial class VBABaseVisitor<Result> : AbstractParseTreeVisitor<Result>,
17811737
/// <return>The visitor result.</return>
17821738
public virtual Result VisitMidStmt([NotNull] VBAParser.MidStmtContext context) { return VisitChildren(context); }
17831739

1784-
/// <summary>
1785-
/// Visit a parse tree produced by <see cref="VBAParser.macroIfThenElseStmt"/>.
1786-
/// <para>
1787-
/// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
1788-
/// on <paramref name="context"/>.
1789-
/// </para>
1790-
/// </summary>
1791-
/// <param name="context">The parse tree.</param>
1792-
/// <return>The visitor result.</return>
1793-
public virtual Result VisitMacroIfThenElseStmt([NotNull] VBAParser.MacroIfThenElseStmtContext context) { return VisitChildren(context); }
1794-
17951740
/// <summary>
17961741
/// Visit a parse tree produced by <see cref="VBAParser.vsPow"/>.
17971742
/// <para>
@@ -1935,17 +1880,6 @@ public partial class VBABaseVisitor<Result> : AbstractParseTreeVisitor<Result>,
19351880
/// <return>The visitor result.</return>
19361881
public virtual Result VisitModuleBodyElement([NotNull] VBAParser.ModuleBodyElementContext context) { return VisitChildren(context); }
19371882

1938-
/// <summary>
1939-
/// Visit a parse tree produced by <see cref="VBAParser.macroStmt"/>.
1940-
/// <para>
1941-
/// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
1942-
/// on <paramref name="context"/>.
1943-
/// </para>
1944-
/// </summary>
1945-
/// <param name="context">The parse tree.</param>
1946-
/// <return>The visitor result.</return>
1947-
public virtual Result VisitMacroStmt([NotNull] VBAParser.MacroStmtContext context) { return VisitChildren(context); }
1948-
19491883
/// <summary>
19501884
/// Visit a parse tree produced by <see cref="VBAParser.vsMid"/>.
19511885
/// <para>

0 commit comments

Comments
 (0)