|
1 | 1 | package com.annimon.ownlang.parser;
|
2 | 2 |
|
| 3 | +import com.annimon.ownlang.Console; |
| 4 | +import com.annimon.ownlang.exceptions.OwnLangParserException; |
3 | 5 | import com.annimon.ownlang.lib.FunctionValue;
|
4 | 6 | import com.annimon.ownlang.lib.NumberValue;
|
5 | 7 | import com.annimon.ownlang.lib.ScopeHandler;
|
6 | 8 | import com.annimon.ownlang.parser.ast.FunctionDefineStatement;
|
7 | 9 | import com.annimon.ownlang.parser.ast.Statement;
|
8 | 10 | import com.annimon.ownlang.parser.ast.Visitor;
|
| 11 | +import com.annimon.ownlang.parser.error.ParseErrorsFormatterStage; |
9 | 12 | import com.annimon.ownlang.parser.optimization.OptimizationStage;
|
10 | 13 | import com.annimon.ownlang.parser.visitors.AbstractVisitor;
|
11 | 14 | import com.annimon.ownlang.stages.*;
|
@@ -83,10 +86,16 @@ public void initialize() {
|
83 | 86 | @ParameterizedTest
|
84 | 87 | @MethodSource("data")
|
85 | 88 | public void testProgram(String programPath) {
|
| 89 | + final StagesDataMap stagesData = new StagesDataMap(); |
86 | 90 | try {
|
87 |
| - testPipeline.perform(new StagesDataMap(), programPath); |
| 91 | + testPipeline.perform(stagesData, programPath); |
| 92 | + } catch (OwnLangParserException ex) { |
| 93 | + final var error = new ParseErrorsFormatterStage() |
| 94 | + .perform(stagesData, ex.getParseErrors()); |
| 95 | + fail(programPath + "\n" + error, ex); |
88 | 96 | } catch (Exception oae) {
|
89 |
| - fail(oae); |
| 97 | + fail(programPath, oae); |
| 98 | + Console.handleException(stagesData, Thread.currentThread(), oae); |
90 | 99 | }
|
91 | 100 | }
|
92 | 101 |
|
|
0 commit comments