1 21 22 package net.percederberg.grammatica.parser.re; 23 24 import java.io.FileReader ; 25 26 32 public class DebugRegExp { 33 34 39 public static void main(String [] args) { 40 char[] buffer = new char[1024]; 41 FileReader in; 42 int length; 43 String str = ""; 44 45 if (args.length != 1) { 47 System.err.println("Syntax: DebugRegExp <regexpfile>"); 48 System.exit(1); 49 } 50 51 try { 53 in = new FileReader (args[0]); 54 length = in.read(buffer); 55 str = new String (buffer, 0, length); 56 } catch (Exception e) { 57 e.printStackTrace(); 58 System.exit(1); 59 } 60 61 try { 63 System.out.println(new RegExp(str, false)); 64 } catch (RegExpException e) { 65 e.printStackTrace(); 66 System.exit(1); 67 } 68 } 69 } 70 | Popular Tags |