Skip to content

Commit 90bfb01

Browse files
committed
Compiler: Store the PrintStream in the compiler aswell
1 parent 5a0be8d commit 90bfb01

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/org/piccode/backend/Compiler.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.piccode.backend;
22

3+
import java.io.PrintStream;
34
import java.util.ArrayList;
45
import java.util.List;
56
import org.antlr.v4.runtime.BaseErrorListener;
@@ -45,7 +46,7 @@
4546
* @author hexaredecimal
4647
*/
4748
public class Compiler {
48-
49+
public static PrintStream out = System.out;
4950
private static List<Runnable> nativeFunctions = new ArrayList<>();
5051

5152
public static PiccodeValue compile(String file, String code) {
@@ -95,6 +96,7 @@ public static PiccodeValue compile(String file, String code, List<PiccodeValue>
9596
Context.top.dropStackFrame();
9697
}
9798
//Context.top.dropStackFrame();
99+
e.out = out;
98100
e.reportError();
99101
//e.printStackTrace();
100102
return new PiccodeUnit();
@@ -133,6 +135,7 @@ public static List<Ast> compileDeclarationsAndGetExpressions(String file, String
133135
if (Context.top.getFramesCount() > 0) {
134136
Context.top.dropStackFrame();
135137
}
138+
e.out = out;
136139
e.reportError();
137140
return nodes;
138141
} catch (Exception rte) {

0 commit comments

Comments
 (0)