From b1adc4671dc6c26d4a97222481d433f17633811b Mon Sep 17 00:00:00 2001 From: Andreas Stadelmeier Date: Wed, 20 Sep 2017 14:00:44 +0200 Subject: [PATCH] =?UTF-8?q?Environment=20einf=C3=BChren?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/de/dhbwstuttgart/core/JavaTXCompiler.java | 6 ++++-- src/de/dhbwstuttgart/parser/JavaTXParser.java | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/de/dhbwstuttgart/core/JavaTXCompiler.java index 39bb276a..26c22d4d 100644 --- a/src/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -21,6 +21,8 @@ import java.util.stream.Collectors; public class JavaTXCompiler { + CompilationEnvironment environment; + protected List sourceFiles = new ArrayList<>(); /* public JavaTXCompiler(List sourceFiles){ @@ -68,13 +70,13 @@ public class JavaTXCompiler { } public SourceFile parse(File sourceFile) throws IOException, java.lang.ClassNotFoundException { - SourceFile ret = new JavaTXParser().parse(sourceFile); + SourceFile ret = new JavaTXParser(environment).parse(sourceFile); sourceFiles.add(ret); return ret; } public SourceFile parse(String source) throws IOException, java.lang.ClassNotFoundException { - SourceFile ret = new JavaTXParser().parse(source); + SourceFile ret = new JavaTXParser(environment).parse(source); sourceFiles.add(ret); return ret; } diff --git a/src/de/dhbwstuttgart/parser/JavaTXParser.java b/src/de/dhbwstuttgart/parser/JavaTXParser.java index 970958af..86549144 100644 --- a/src/de/dhbwstuttgart/parser/JavaTXParser.java +++ b/src/de/dhbwstuttgart/parser/JavaTXParser.java @@ -1,5 +1,6 @@ package de.dhbwstuttgart.parser; +import de.dhbwstuttgart.core.CompilationEnvironment; import de.dhbwstuttgart.parser.SyntaxTreeGenerator.SyntaxTreeGenerator; import de.dhbwstuttgart.parser.antlr.Java8Lexer; import de.dhbwstuttgart.parser.antlr.Java8Parser; @@ -14,6 +15,12 @@ import java.util.ArrayList; import java.util.List; public class JavaTXParser { + CompilationEnvironment environment; + + public JavaTXParser(CompilationEnvironment env) { + environment = env; + } + public SourceFile parse(InputStream source) throws IOException, java.lang.ClassNotFoundException { InputStream stream = source;//new FileInputStream(sourceFile); ANTLRInputStream input = new ANTLRInputStream(stream);