Merge branch 'antlr' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bigRefactoring

This commit is contained in:
JanUlrich 2017-02-22 01:35:59 +01:00
commit d328faeee2
2 changed files with 17 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import org.reflections.util.FilterBuilder;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.ArrayList;
import java.util.Set; import java.util.Set;
/** /**
@ -32,4 +33,13 @@ public class PackageCrawler {
return classes; return classes;
} }
public static List<String> getClassNames(String packageName){
List<String> nameList = new ArrayList();
Set<Class<?>> classes = getClassesInPackage(packageName);
for(Class c : classes){
nameList.add(c.getName());
}
return nameList;
}
} }

View File

@ -9,6 +9,8 @@ import de.dhbwstuttgart.syntaxtree.modifier.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Scanner; import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
@ -16,7 +18,8 @@ import java.nio.charset.StandardCharsets;
public class RunParser{ public class RunParser{
public static void main(String[] args){ public static void main(String[] args){
try{ try{
Scanner sc = new Scanner(System.in); File file = new File(args[0]);
Scanner sc = new Scanner(file);
String inputString = sc.nextLine(); String inputString = sc.nextLine();
while(sc.hasNextLine()) inputString = inputString + sc.nextLine() + "\n"; while(sc.hasNextLine()) inputString = inputString + sc.nextLine() + "\n";
InputStream stream = new ByteArrayInputStream(inputString.getBytes(StandardCharsets.UTF_8)); InputStream stream = new ByteArrayInputStream(inputString.getBytes(StandardCharsets.UTF_8));
@ -45,6 +48,9 @@ public class RunParser{
catch(java.util.NoSuchElementException e){ catch(java.util.NoSuchElementException e){
System.out.println("Error: Source seems to be empty."); System.out.println("Error: Source seems to be empty.");
} }
catch(FileNotFoundException e){
System.out.println("File not found.");
}
catch(IOException e){ catch(IOException e){
System.out.println("An exception occured which is on our TODO list."); System.out.println("An exception occured which is on our TODO list.");
e.printStackTrace(); e.printStackTrace();