public void match(int t) throws IOException, SyntaxError { if (t == lookahead) { // Progress the lookahead lookahead = reader.read(); } else throw new SyntaxError("syntax error"); }
public Parser(String filePath, String outputPath) throws IOException { reader = new BufferedReader(new FileReader(filePath)); writer = new WriterFactory(outputPath).create(); lookahead = reader.read(); }