Author: vgritsenko
Date: Tue Mar 13 17:42:40 2007
New Revision: 517956
URL: http://svn.apache.org/viewvc?view=rev&rev=517956
Log:
updated code to match javadoc, update program in javadoc
Modified:
jakarta/regexp/trunk/src/java/org/apache/regexp/recompile.java
Modified: jakarta/regexp/trunk/src/java/org/apache/regexp/recompile.java
URL:
http://svn.apache.org/viewvc/jakarta/regexp/trunk/src/java/org/apache/regexp/recompile.java?view=diff&rev=517956&r1=517955&r2=517956
==============================================================================
--- jakarta/regexp/trunk/src/java/org/apache/regexp/recompile.java (original)
+++ jakarta/regexp/trunk/src/java/org/apache/regexp/recompile.java Tue Mar 13
17:42:40 2007
@@ -22,21 +22,18 @@
/**
* 'recompile' is a command line tool that pre-compiles one or more regular
expressions
* for use with the regular expression matcher class 'RE'. For example, the
command
- * "java recompile a*b" produces output like this:
+ * <code>java org.apache.regexp.recompile re1 "a*b"</code> produces output
like this:
*
* <pre>
*
- * // Pre-compiled regular expression "a*b"
- * char[] re1Instructions =
+ * // Pre-compiled regular expression 'a*b'
+ * private static final char[] re1Instructions =
* {
- * 0x007c, 0x0000, 0x001a, 0x007c, 0x0000, 0x000d, 0x0041,
- * 0x0001, 0x0004, 0x0061, 0x007c, 0x0000, 0x0003, 0x0047,
- * 0x0000, 0xfff6, 0x007c, 0x0000, 0x0003, 0x004e, 0x0000,
- * 0x0003, 0x0041, 0x0001, 0x0004, 0x0062, 0x0045, 0x0000,
- * 0x0000,
+ * 0x002a, 0x0000, 0x0007, 0x0041, 0x0001, 0xfffd, 0x0061,
+ * 0x0041, 0x0001, 0x0004, 0x0062, 0x0045, 0x0000, 0x0000,
* };
*
- * REProgram re1 = new REProgram(re1Instructions);
+ * private static final REProgram re1 = new REProgram(re1Instructions);
*
* </pre>
*
@@ -60,6 +57,7 @@
{
/**
* Main application entrypoint.
+ *
* @param arg Command line arguments
*/
static public void main(String[] arg)
@@ -82,11 +80,11 @@
// Compile regular expression
String name = arg[i];
String pattern = arg[i+1];
- String instructions = name + "PatternInstructions";
+ String instructions = name + "Instructions";
// Output program as a nice, formatted character array
- System.out.print("\n // Pre-compiled regular expression '"
+ pattern + "'\n"
- + " private static char[] " + instructions
+ " = \n {");
+ System.out.print("\n // Pre-compiled regular expression '"
+ pattern + "'\n"
+ + " private static final char[] " +
instructions + " = \n {");
// Compile program for pattern
REProgram program = r.compile(pattern);
@@ -115,7 +113,7 @@
// End of program block
System.out.println("\n };");
- System.out.println("\n private static RE " + name +
"Pattern = new RE(new REProgram(" + instructions + "));");
+ System.out.println("\n private static final REProgram " +
name + " = new REProgram(" + instructions + ");");
}
catch (RESyntaxException e)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]