Skip to content

Commit c7fd2e5

Browse files
committed
Fix preprocessor tests
1 parent 85463a4 commit c7fd2e5

7 files changed

+147
-138
lines changed

Rubberduck.Parsing/Preprocessing/VBAConditionalCompilationParser.cs

Lines changed: 130 additions & 126 deletions
Large diffs are not rendered by default.

Rubberduck.Parsing/Preprocessing/VBAConditionalCompilationParser.g4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ keyword :
207207
| SEEK
208208
| UNLOCK
209209
| WRITE
210+
| NAME
210211
;
211212

212213
markerKeyword : AS;

Rubberduck.Parsing/Preprocessing/VBAConditionalCompilationParserBaseListener.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11-
// Generated from C:\Users\Splinter\Documents\Visual Studio 2015\Projects\RubberduckParserTest\RubberduckParserTest\VBAConditionalCompilationParser.g4 by ANTLR 4.3
11+
// Generated from C:\Users\hosch\Documents\Visual Studio 2015\Projects\Rubberduck\Rubberduck.Parsing\Preprocessing\VBAConditionalCompilationParser.g4 by ANTLR 4.3
1212

1313
// Unreachable code detected
1414
#pragma warning disable 0162
@@ -17,7 +17,7 @@
1717
// Missing XML comment for publicly visible type or member '...'
1818
#pragma warning disable 1591
1919

20-
namespace Rubberduck.Parsing.Preprocessing {
20+
namespace Rubberduck.Parsing {
2121

2222
using Antlr4.Runtime.Misc;
2323
using IErrorNode = Antlr4.Runtime.Tree.IErrorNode;
@@ -449,4 +449,4 @@ public virtual void VisitTerminal([NotNull] ITerminalNode node) { }
449449
/// <remarks>The default implementation does nothing.</remarks>
450450
public virtual void VisitErrorNode([NotNull] IErrorNode node) { }
451451
}
452-
} // namespace Rubberduck.Parsing.Preprocessing
452+
} // namespace Rubberduck.Parsing

Rubberduck.Parsing/Preprocessing/VBAConditionalCompilationParserBaseVisitor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11-
// Generated from C:\Users\Splinter\Documents\Visual Studio 2015\Projects\RubberduckParserTest\RubberduckParserTest\VBAConditionalCompilationParser.g4 by ANTLR 4.3
11+
// Generated from C:\Users\hosch\Documents\Visual Studio 2015\Projects\Rubberduck\Rubberduck.Parsing\Preprocessing\VBAConditionalCompilationParser.g4 by ANTLR 4.3
1212

1313
// Unreachable code detected
1414
#pragma warning disable 0162
@@ -17,7 +17,7 @@
1717
// Missing XML comment for publicly visible type or member '...'
1818
#pragma warning disable 1591
1919

20-
namespace Rubberduck.Parsing.Preprocessing {
20+
namespace Rubberduck.Parsing {
2121
using Antlr4.Runtime.Misc;
2222
using Antlr4.Runtime.Tree;
2323
using IToken = Antlr4.Runtime.IToken;
@@ -373,4 +373,4 @@ public partial class VBAConditionalCompilationParserBaseVisitor<Result> : Abstra
373373
/// <return>The visitor result.</return>
374374
public virtual Result VisitCcConst([NotNull] VBAConditionalCompilationParser.CcConstContext context) { return VisitChildren(context); }
375375
}
376-
} // namespace Rubberduck.Parsing.Preprocessing
376+
} // namespace Rubberduck.Parsing

Rubberduck.Parsing/Preprocessing/VBAConditionalCompilationParserListener.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11-
// Generated from C:\Users\Splinter\Documents\Visual Studio 2015\Projects\RubberduckParserTest\RubberduckParserTest\VBAConditionalCompilationParser.g4 by ANTLR 4.3
11+
// Generated from C:\Users\hosch\Documents\Visual Studio 2015\Projects\Rubberduck\Rubberduck.Parsing\Preprocessing\VBAConditionalCompilationParser.g4 by ANTLR 4.3
1212

1313
// Unreachable code detected
1414
#pragma warning disable 0162
@@ -17,7 +17,7 @@
1717
// Missing XML comment for publicly visible type or member '...'
1818
#pragma warning disable 1591
1919

20-
namespace Rubberduck.Parsing.Preprocessing {
20+
namespace Rubberduck.Parsing {
2121
using Antlr4.Runtime.Misc;
2222
using IParseTreeListener = Antlr4.Runtime.Tree.IParseTreeListener;
2323
using IToken = Antlr4.Runtime.IToken;
@@ -370,4 +370,4 @@ public interface IVBAConditionalCompilationParserListener : IParseTreeListener {
370370
/// <param name="context">The parse tree.</param>
371371
void ExitCcConst([NotNull] VBAConditionalCompilationParser.CcConstContext context);
372372
}
373-
} // namespace Rubberduck.Parsing.Preprocessing
373+
} // namespace Rubberduck.Parsing

Rubberduck.Parsing/Preprocessing/VBAConditionalCompilationParserVisitor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11-
// Generated from C:\Users\Splinter\Documents\Visual Studio 2015\Projects\RubberduckParserTest\RubberduckParserTest\VBAConditionalCompilationParser.g4 by ANTLR 4.3
11+
// Generated from C:\Users\hosch\Documents\Visual Studio 2015\Projects\Rubberduck\Rubberduck.Parsing\Preprocessing\VBAConditionalCompilationParser.g4 by ANTLR 4.3
1212

1313
// Unreachable code detected
1414
#pragma warning disable 0162
@@ -17,7 +17,7 @@
1717
// Missing XML comment for publicly visible type or member '...'
1818
#pragma warning disable 1591
1919

20-
namespace Rubberduck.Parsing.Preprocessing {
20+
namespace Rubberduck.Parsing {
2121
using Antlr4.Runtime.Misc;
2222
using Antlr4.Runtime.Tree;
2323
using IToken = Antlr4.Runtime.IToken;
@@ -247,4 +247,4 @@ public interface IVBAConditionalCompilationParserVisitor<Result> : IParseTreeVis
247247
/// <return>The visitor result.</return>
248248
Result VisitCcConst([NotNull] VBAConditionalCompilationParser.CcConstContext context);
249249
}
250-
} // namespace Rubberduck.Parsing.Preprocessing
250+
} // namespace Rubberduck.Parsing

RubberduckTests/Preprocessing/VBAPreprocessorVisitorTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
using Rubberduck.Parsing.Preprocessing;
55
using Rubberduck.Parsing.Symbols;
66
using System;
7+
using System.Diagnostics;
78
using System.Globalization;
9+
using Rubberduck.Parsing;
810

911
namespace RubberduckTests.Preprocessing
1012
{
@@ -1271,6 +1273,8 @@ private Tuple<SymbolTable<string, IValue>, IValue> Preprocess(string code)
12711273
var tree = parser.compilationUnit();
12721274
var evaluator = new VBAPreprocessorVisitor(symbolTable, new VBAPredefinedCompilationConstants(7.01), tree.start.InputStream);
12731275
var expr = evaluator.Visit(tree);
1276+
1277+
Debug.Assert(parser.NumberOfSyntaxErrors == 0);
12741278
return Tuple.Create(symbolTable, expr.Evaluate());
12751279
}
12761280
}

0 commit comments

Comments
 (0)