? z.diff Index: RE.java =================================================================== RCS file: /home/cvspublic/jakarta-regexp/src/java/org/apache/regexp/RE.java,v retrieving revision 1.9 diff -u -r1.9 RE.java --- RE.java 9 Mar 2001 22:17:13 -0000 1.9 +++ RE.java 24 Apr 2002 13:29:56 -0000 @@ -452,7 +434,7 @@ // Limits static final int maxNode = 65536; // Maximum number of nodes in a program - static final int maxParen = 16; // Number of paren pairs (only 9 can be backrefs) + static final int MAX_PAREN = 16; // Number of paren pairs (only 9 can be backrefs) // Node layout constants static final int offsetOpcode = 0; // Opcode offset (first character) @@ -468,6 +450,7 @@ CharacterIterator search; // The string being matched against int idx; // Current index in string being searched int matchFlags; // Match behaviour flags + int maxParen = MAX_PAREN; // Parenthesized subexpressions int parenCount; // Number of subexpressions matched (num open parens + 1) @@ -647,6 +630,11 @@ public void setProgram(REProgram program) { this.program = program; + if (program != null && program.maxParens != -1) { + this.maxParen = program.maxParens; + } else { + this.maxParen = MAX_PAREN; + } } /** Index: RECompiler.java =================================================================== RCS file: /home/cvspublic/jakarta-regexp/src/java/org/apache/regexp/RECompiler.java,v retrieving revision 1.4 diff -u -r1.4 RECompiler.java --- RECompiler.java 27 Feb 2001 08:37:05 -0000 1.4 +++ RECompiler.java 24 Apr 2002 13:29:56 -0000 @@ -1331,7 +1293,7 @@ // Return the result char[] ins = new char[lenInstruction]; System.arraycopy(instruction, 0, ins, 0, lenInstruction); - return new REProgram(ins); + return new REProgram(parens, ins); } /** Index: REProgram.java =================================================================== RCS file: /home/cvspublic/jakarta-regexp/src/java/org/apache/regexp/REProgram.java,v retrieving revision 1.1 diff -u -r1.1 REProgram.java --- REProgram.java 27 Apr 2000 01:22:33 -0000 1.1 +++ REProgram.java 24 Apr 2002 13:29:56 -0000 @@ -80,6 +80,7 @@ int lenInstruction; // The amount of the instruction buffer in use char[] prefix; // Prefix string optimization int flags; // Optimization flags (REProgram.OPT_*) + int maxParens = -1; /** * Constructs a program object from a character array @@ -88,6 +89,17 @@ public REProgram(char[] instruction) { this(instruction, instruction.length); + } + + /** + * Constructs a program object from a character array + * @param parens Count of parens in the program + * @param instruction Character array with RE opcode instructions in it + */ + public REProgram(int parens, char[] instruction) + { + this(instruction, instruction.length); + this.maxParens = parens; } /**