home *** CD-ROM | disk | FTP | other *** search
- package espresso;
-
- import java.io.IOException;
- import java.io.RandomAccessFile;
-
- class Report implements Constants {
- private static int lineNum = 0;
- private static String errLine = null;
- private static RandomAccessFile infile = null;
- static int nwarnings = 0;
- static int nerrors = 0;
- static boolean silent = false;
- public static String filename = "<input>";
- static int noPos = -1;
-
- static void close() {
- if (infile != null) {
- try {
- infile.close();
- infile = null;
- } catch (IOException var1) {
- }
- }
-
- }
-
- static void open(String var0) {
- filename = var0;
- }
-
- static void warning(int var0, String var1) {
- if (!silent && nwarnings < 100) {
- printError(var0, String.valueOf("warning: ").concat(String.valueOf(var1)));
- ++nwarnings;
- }
-
- }
-
- static void error(int var0, String var1) {
- if (!silent && nerrors < 100) {
- printError(var0, var1);
- ++nerrors;
- }
-
- }
-
- private static void printError(int var0, String var1) {
- if (var0 == noPos) {
- System.out.println(String.valueOf("error: ").concat(String.valueOf(var1)));
- } else {
- int var2 = var0 >>> 10;
- int var3 = var0 - (var2 << 10);
- System.out.print(String.valueOf(filename).concat(String.valueOf(":")));
- System.out.print(var2);
- System.out.print(": ");
- System.out.println(var1);
- printErrLine(var2, var3);
- prompt();
- }
-
- }
-
- private static void printErrLine(int var0, int var1) {
- try {
- if (infile == null) {
- infile = new RandomAccessFile(filename, "r");
- lineNum = 0;
- errLine = "";
- } else if (lineNum > var0) {
- infile.seek(0L);
- lineNum = 0;
- errLine = "";
- }
-
- if (infile != null) {
- while(lineNum < var0 && errLine != null) {
- errLine = infile.readLine();
- ++lineNum;
- }
-
- if (errLine != null) {
- System.out.println(errLine);
-
- for(int var2 = 1; var2 < var1; ++var2) {
- System.out.write(32);
- }
-
- System.out.println("^");
- }
- }
- } catch (IOException var4) {
- }
-
- }
-
- private static void prompt() {
- if (Switches.promptOnError) {
- System.out.println("R)esume, A)bort>");
-
- try {
- while(true) {
- switch (System.in.read()) {
- case 97:
- case 65:
- throw new CompilerError("user abort");
- case 114:
- case 82:
- return;
- }
- }
- } catch (IOException var2) {
- throw new CompilerError("input read error");
- }
- }
- }
-
- public Report() {
- }
- }
-