public static JFile parseFile(File file) throws FileNotFoundException, ParseException { curDir = file.getParent(); curFileName = file.getName(); FileReader reader = new FileReader(file); try { Rcc parser = new Rcc(reader); recTab = new Hashtable(); return parser.Input(); } finally { try { reader.close(); } catch (IOException e) { } } }
public final JFile Include() throws ParseException { String fname; Token t; jj_consume_token(INCLUDE_TKN); t = jj_consume_token(CSTRING_TKN); JFile ret = null; fname = t.image.replaceAll("^\"", "").replaceAll("\"$", ""); File file = new File(curDir, fname); String tmpDir = curDir; String tmpFile = curFileName; curDir = file.getParent(); curFileName = file.getName(); try { FileReader reader = new FileReader(file); Rcc parser = new Rcc(reader); try { ret = parser.Input(); System.out.println(fname + " Parsed Successfully"); } catch (ParseException e) { System.out.println(e.toString()); System.exit(1); } try { reader.close(); } catch (IOException e) { } } catch (FileNotFoundException e) { System.out.println("File " + fname + " Not found."); System.exit(1); } curDir = tmpDir; curFileName = tmpFile; { if (true) return ret; } throw new Error("Missing return statement in function"); }