| 4 | |
| 5 | public class AntlrBatchTestRig { |
| 6 | public static void main(String[] args) throws Exception { |
| 7 | if (args.length < 1) { |
| 8 | System.err.println("Usage: AntlrBatchTestRig <file1> [file2] ..."); |
| 9 | System.exit(1); |
| 10 | } |
| 11 | |
| 12 | int exitCode = 0; |
| 13 | for (String filePath: args) { |
| 14 | try { |
| 15 | if (!testFile(filePath)) |
| 16 | exitCode = 1; |
| 17 | } catch (Exception e) { |
| 18 | System.err.println("ERROR:" + filePath + ":" + e.getMessage()); |
| 19 | exitCode = 1; |
| 20 | } |
| 21 | } |
| 22 | System.exit(exitCode); |
| 23 | } |
| 24 | |
| 25 | private static boolean testFile(String filePath) throws Exception { |
| 26 | // Detect mode based on file extension |