Timur Sağlam 5 лет назад
Родитель
Сommit
f6fd8af027

+ 0 - 1
jplag.frontend-utils/src/main/java/jplag/UnicodeReader.java

@@ -89,7 +89,6 @@ public class UnicodeReader extends Reader {
             encoding = defaultEnc;
             unread = n;
         }
-        // System.out.println("read=" + n + ", unread=" + unread);
 
         if (unread > 0)
             internalIn.unread(bom, (n - unread), unread);

+ 0 - 8
jplag.frontend.chars/src/main/java/jplag/chars/Parser.java

@@ -9,14 +9,6 @@ public class Parser extends jplag.Parser implements jplag.TokenConstants {
 
 	private Structure struct;
 
-	public static void main(String args[]) {
-		System.out.println("parsing: " + args[0]);
-		Parser parser = new Parser();
-		parser.struct = new Structure();
-		parser.parseFile(new File("."), args[0]);
-		System.out.println(parser.struct);
-	}
-
 	public jplag.Structure parse(File dir, String files[]) {
 		struct = new Structure();
 		errors = 0;

+ 0 - 14
jplag.frontend.cpp/src/main/java/jplag/cpp/Scanner.java

@@ -3,26 +3,12 @@ package jplag.cpp;
 import java.io.File;
 
 import jplag.Parser;
-import jplag.StrippedProgram;
 
 public class Scanner extends Parser implements CPPTokenConstants {
 	private String actFile;
 
 	private jplag.Structure struct;
 
-	public static void main(String args[]) {
-		System.out.print("File: ");
-		for (int i = 0; i < args.length; i++) {
-			System.out.print(args[i] + " ");
-		}
-		System.out.println();
-
-		Scanner scanner = new Scanner();
-		scanner.setProgram(new StrippedProgram());
-
-		scanner.scan(new File("."), args);
-	}
-
 	public jplag.Structure scan(File dir, String files[]) {
 		struct = new jplag.Structure();
 		errors = 0;

+ 0 - 42
jplag.frontend.csharp-1.2/src/main/java/jplag/csharp/Parser.java

@@ -1,12 +1,8 @@
 package jplag.csharp;
 
-import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.IOException;
 
-import jplag.StrippedProgram;
 import jplag.Structure;
 import jplag.UnicodeReader;
 import jplag.csharp.grammar.CSharpLexer;
@@ -16,44 +12,6 @@ public class Parser extends jplag.Parser implements CSharpTokenConstants {
 	private Structure struct;
 	private String currentFile;
 
-	public static void main(String args[]) {
-		if (args.length != 1) {
-			System.out.println("Only one parameter allowed.");
-			System.exit(-1);
-		}
-		Parser parser = new Parser();
-		parser.setProgram(new StrippedProgram());
-		jplag.Structure struct = parser.parse(new File(args[0]).getParentFile(), new String[] { new File(args[0]).getName() });
-		try {
-			BufferedReader reader = new BufferedReader(new FileReader(new File(args[0])));
-			int lineNr = 1;
-			int token = 0;
-			String line;
-			while ((line = reader.readLine()) != null) {
-				if (token < struct.size()) {
-					boolean first = true;
-					while (struct.tokens[token] != null && struct.tokens[token].getLine() == lineNr) {
-						if (!first)
-							System.out.println();
-						jplag.Token tok = struct.tokens[token];
-						System.out.print(CSharpToken.type2string(tok.type) + " (" + tok.getLine() + "," + tok.getColumn() + ","
-								+ tok.getLength() + ")\t");
-						first = false;
-						token++;
-					}
-					if (first)
-						System.out.print(" \t");
-				} else
-					System.out.print(" \t");
-				System.out.println(line);
-				lineNr++;
-			}
-			reader.close();
-		} catch (IOException e) {
-			System.out.println(e);
-		}
-	}
-
 	public jplag.Structure parse(File dir, String files[]) {
 		struct = new Structure();
 		errors = 0;

+ 0 - 4
jplag.frontend.java-1.1exp/src/main/java/jplag/javax/Parser.java

@@ -7,10 +7,6 @@ public class Parser extends jplag.Parser implements JavaTokenConstants {
 
 	private jplag.Structure struct;
 
-	public void main(String args[]) {
-		System.out.println(parse(new File("."), args).toString());
-	}
-
 	public jplag.Structure parse(File dir, String files[]) {
 		struct = new jplag.Structure();
 		errors = 0;

+ 0 - 45
jplag.frontend.java-1.2/src/main/java/jplag/java/Parser.java

@@ -1,15 +1,7 @@
 package jplag.java;
 
-/**
- * The two classes jplag.java.grammar.[JLexer|JRecognizer] are being generated by antlr into the directory
- * target/generated-sources/antlr/... Generate the classes with antlr or use mvn compile
- */
-
-import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.IOException;
 
 import jplag.InputState;
 import jplag.ParserToken;
@@ -21,43 +13,6 @@ public class Parser extends jplag.Parser implements JavaTokenConstants {
 	private Structure struct;
 	private String currentFile;
 
-	public static void main(String args[]) {
-		if (args.length != 1) {
-			System.out.println("Only one parameter allowed.");
-			System.exit(-1);
-		}
-		Parser parser = new Parser();
-		parser.setProgram(new jplag.StrippedProgram());
-		jplag.Structure struct = parser.parse(null, args);
-		try {
-			BufferedReader reader = new BufferedReader(new FileReader(new File(args[0])));
-			int lineNr = 1;
-			int token = 0;
-			String line;
-			while ((line = reader.readLine()) != null) {
-				if (token < struct.size()) {
-					boolean first = true;
-					while (struct.tokens[token] != null && struct.tokens[token].getLine() == lineNr) {
-						if (!first)
-							System.out.println();
-						JavaToken tok = (JavaToken) struct.tokens[token];
-						System.out.print(JavaToken.type2string(tok.type) + " (" + tok.getLine() + "," + tok.getColumn() + ","
-								+ tok.getLength() + ")\t");
-						first = false;
-						token++;
-					}
-					if (first)
-						System.out.print("                \t");
-				}
-				System.out.println(line);
-				lineNr++;
-			}
-			reader.close();
-		} catch (IOException e) {
-			System.out.println(e);
-		}
-	}
-
 	public jplag.Structure parse(File dir, String files[]) {
 		struct = new Structure();
 		errors = 0;

+ 0 - 41
jplag.frontend.java-1.5/src/main/java/jplag/java15/Parser.java

@@ -1,9 +1,6 @@
 package jplag.java15;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
 
 import jplag.java15.grammar.JavaParser;
 import jplag.java15.grammar.Token;
@@ -18,44 +15,6 @@ public class Parser extends jplag.Parser implements JavaTokenConstants {
 		this.useMethodSeparators = useMethodSeparators;
 	}
 
-	public static void main(String args[]) {
-		if (args.length != 1) {
-			System.out.println("Only one parameter allowed.");
-			System.exit(-1);
-		}
-		Parser parser = new Parser(true);
-		parser.setProgram(new jplag.StrippedProgram());
-		jplag.Structure struct = parser.parse(null, args);
-		try {
-			BufferedReader reader = new BufferedReader(new FileReader(new File(args[0])));
-			int lineNr = 1;
-			int token = 0;
-			String line;
-			while ((line = reader.readLine()) != null) {
-				if (token < struct.size()) {
-					boolean first = true;
-					while (struct.tokens[token] != null && struct.tokens[token].getLine() == lineNr) {
-						if (!first) {
-							System.out.println();
-						}
-						JavaToken tok = (JavaToken) struct.tokens[token];
-						System.out.print(JavaToken.type2string(tok.type) + " (" + tok.getLine() + "," + tok.getColumn() + ","
-								+ tok.getLength() + ")\t");
-						first = false;
-						token++;
-					}
-					if (first)
-						System.out.print("                \t");
-				}
-				System.out.println(line);
-				lineNr++;
-			}
-			reader.close();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-	}
-
 	public jplag.Structure parse(File dir, String files[]) {
 		struct = new jplag.Structure();
 		errors = 0;

+ 0 - 42
jplag.frontend.java-1.7/src/main/java/jplag/java17/Parser.java

@@ -1,10 +1,8 @@
 package jplag.java17;
 
 import java.io.BufferedInputStream;
-import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileReader;
 import java.io.IOException;
 
 import org.antlr.v4.runtime.CharStream;
@@ -22,46 +20,6 @@ public class Parser extends jplag.Parser implements JavaTokenConstants {
 	private Structure struct = new Structure();
 	private String currentFile;
 
-	public static void main(String args[]) {
-		if (args.length < 1) {
-			System.out.println("Only one or more files as parameter allowed.");
-			System.exit(-1);
-		}
-		Parser parser = new Parser();
-		parser.setProgram(new jplag.StrippedProgram());
-		jplag.Structure struct = parser.parse(null, args);
-		try {
-			BufferedReader reader = new BufferedReader(new FileReader(new File(args[0])));
-			int lineNr = 1;
-			int token = 0;
-			String line;
-			while ((line = reader.readLine()) != null) {
-				if (token < struct.size()) {
-					boolean first = true;
-					while (struct.tokens[token] != null
-							&& struct.tokens[token].getLine() == lineNr) {
-						if (!first)
-							System.out.println();
-						JavaToken tok=(JavaToken) struct.tokens[token];
-						System.out.print(JavaToken.type2string(tok.type) + " ("
-							+ tok.getLine() + ","
-							+ tok.getColumn() + ","
-							+ tok.getLength() + ")\t");
-						first = false;
-						token++;
-					}
-					if (first)
-						System.out.print("                \t");
-				}
-				System.out.println(line);
-				lineNr++;
-			}
-			reader.close();
-		} catch (IOException e) {
-			System.out.println(e);
-		}
-	}
-	
 	public jplag.Structure parse(File dir, String files[]) {
 		struct = new Structure();
 		errors = 0;

+ 0 - 44
jplag.frontend.python-3/src/main/java/jplag/python3/Parser.java

@@ -1,10 +1,8 @@
 package jplag.python3;
 
 import java.io.BufferedInputStream;
-import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileReader;
 import java.io.IOException;
 
 import org.antlr.v4.runtime.CharStream;
@@ -23,48 +21,6 @@ public class Parser extends jplag.Parser implements Python3TokenConstants {
     private Structure struct = new Structure();
     private String currentFile;
 
-    public static void main(String args[]) {
-        if (args.length < 1) {
-            System.out.println("Only one or more files as parameter allowed.");
-            System.exit(-1);
-        }
-        Parser parser = new Parser();
-        parser.setProgram(new jplag.StrippedProgram());
-        jplag.Structure struct = parser.parse(null, args);
-        try {
-            BufferedReader reader = new BufferedReader(new FileReader(new File(args[0])));
-            int lineNr = 1;
-            int token = 0;
-            String line;
-            while ((line = reader.readLine()) != null) {
-                if (token < struct.size()) {
-                    boolean first = true;
-                    while (struct.tokens[token] != null
-                            && struct.tokens[token].getLine() == lineNr) {
-                        if (!first) {
-                            System.out.println();
-                        }
-                        Python3Token tok = (Python3Token) struct.tokens[token];
-                        System.out.print(Python3Token.type2string(tok.type) + " ("
-                                + tok.getLine() + ","
-                                + tok.getColumn() + ","
-                                + tok.getLength() + ")\t");
-                        first = false;
-                        token++;
-                    }
-                    if (first) {
-                        System.out.print("                \t");
-                    }
-                }
-                System.out.println(line);
-                lineNr++;
-            }
-            reader.close();
-        } catch (IOException e) {
-            System.out.println(e);
-        }
-    }
-
     public jplag.Structure parse(File dir, String files[]) {
         struct = new Structure();
         errors = 0;

+ 0 - 5
jplag.frontend.scheme/src/main/java/jplag/scheme/Parser.java

@@ -7,11 +7,6 @@ public class Parser extends jplag.Parser implements SchemeTokenConstants {
 
 	private jplag.Structure struct;
 
-	public static void main(String args[]) {
-		Parser p = new Parser();
-		System.out.println(p.parse(new File("."), args).toString());
-	}
-
 	public jplag.Structure parse(File dir, String files[]) {
 		struct = new jplag.Structure();
 		errors = 0;

+ 0 - 39
jplag.frontend.text/src/main/java/jplag/text/Parser.java

@@ -5,7 +5,6 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
-import java.io.IOException;
 import java.util.HashSet;
 
 import jplag.InputState;
@@ -113,42 +112,4 @@ public class Parser extends jplag.Parser implements jplag.TokenConstants {
 		program.print("ERROR: Out of serials!", null);
         System.out.println("jplag.text.Parser: ERROR: Out of serials!");
 	}
-
-	public static void main(String args[]) {
-		if (args.length != 1) {
-			System.out.println("Only one parameter allowed.");
-			System.exit(-1);
-		}
-		Parser parser = new Parser();
-		jplag.Structure struct = parser.parse(new File("."), args);
-		try {
-			BufferedReader reader = new BufferedReader(new FileReader(new File(args[0])));
-			int lineNr = 1;
-			int token = 0;
-			String line;
-			while ((line = reader.readLine()) != null) {
-				if (token < struct.size()) {
-					boolean first = true;
-					while (struct.tokens[token] != null && struct.tokens[token].getLine() == lineNr) {
-						if (!first)
-							System.out.println();
-						jplag.Token tok = struct.tokens[token];
-						System.out.print(TextToken.type2string(tok.type) + " (" + tok.getLine() + "," + tok.getColumn() + ","
-								+ tok.getLength() + ")\t");
-						first = false;
-						token++;
-					}
-					if (first)
-						System.out.print(" \t");
-				} else
-					System.out.print(" \t");
-				System.out.println(line);
-				lineNr++;
-			}
-			reader.close();
-		} catch (IOException e) {
-			System.out.println(e);
-		}
-	}
-
 }