diff --git a/src/de/dhbwstuttgart/parser/PackageCrawler.java b/src/de/dhbwstuttgart/parser/PackageCrawler.java index bef0d6c7..007b4736 100644 --- a/src/de/dhbwstuttgart/parser/PackageCrawler.java +++ b/src/de/dhbwstuttgart/parser/PackageCrawler.java @@ -9,6 +9,7 @@ import org.reflections.util.FilterBuilder; import java.util.LinkedList; import java.util.List; +import java.util.ArrayList; import java.util.Set; /** @@ -32,4 +33,13 @@ public class PackageCrawler { return classes; } + + public static List getClassNames(String packageName){ + List nameList = new ArrayList(); + Set> classes = getClassesInPackage(packageName); + for(Class c : classes){ + nameList.add(c.getName()); + } + return nameList; + } } diff --git a/src/de/dhbwstuttgart/parser/RunParser.java b/src/de/dhbwstuttgart/parser/RunParser.java index 08228eb0..f9456a85 100644 --- a/src/de/dhbwstuttgart/parser/RunParser.java +++ b/src/de/dhbwstuttgart/parser/RunParser.java @@ -9,6 +9,8 @@ import de.dhbwstuttgart.syntaxtree.modifier.*; import java.util.ArrayList; import java.util.Scanner; +import java.io.File; +import java.io.FileNotFoundException; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.IOException; @@ -16,7 +18,8 @@ import java.nio.charset.StandardCharsets; public class RunParser{ public static void main(String[] args){ try{ - Scanner sc = new Scanner(System.in); + File file = new File(args[0]); + Scanner sc = new Scanner(file); String inputString = sc.nextLine(); while(sc.hasNextLine()) inputString = inputString + sc.nextLine() + "\n"; InputStream stream = new ByteArrayInputStream(inputString.getBytes(StandardCharsets.UTF_8)); @@ -45,6 +48,9 @@ public class RunParser{ catch(java.util.NoSuchElementException e){ System.out.println("Error: Source seems to be empty."); } + catch(FileNotFoundException e){ + System.out.println("File not found."); + } catch(IOException e){ System.out.println("An exception occured which is on our TODO list."); e.printStackTrace();