[prev in list] [next in list] [prev in thread] [next in thread]
List: jakarta-oro-dev
Subject: cvs commit: jakarta-oro/src/java/org/apache/oro/text/regex Perl5Compiler.java Perl5Matcher.java
From: dfs () locus ! apache ! org
Date: 2000-12-24 3:34:26
[Download RAW message or body]
dfs 00/12/23 19:34:25
Modified: . CHANGES
build build-oro.xml
src/java/org/apache/oro/text/perl Perl5Util.java
src/java/org/apache/oro/text/regex Perl5Compiler.java
Perl5Matcher.java
Log:
Updated CHANGES file. Commented out chmod in build-oro.xml because build
fails with that line using the ant.jar in CVS. Fixed a documentation typo
in Perl5Util.java. Removed outdated documentation in Perl5Compiler.java
that claimed MULTILINE_MASK and SINGLELINE_MASK should not be used together.
Perl5Matcher was not properly tracking the current offset in
__interpret so PatternMatcherInput would not have its current offset
properly updated. This bug was introduced when fixing the
PatternMatcherInput anchor bug. When the currentOffset parameter
was added to __interpret, not all of the necessary
__currentOffset = beginOffset assignments were changed to
__currentOffset = currentOffset assignments. This has been
fixed by updating the remaining assignments.
Revision Changes Path
1.2 +37 -1 jakarta-oro/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/jakarta-oro/CHANGES,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CHANGES 2000/07/23 23:08:27 1.1
+++ CHANGES 2000/12/24 03:34:23 1.2
@@ -1,4 +1,40 @@
-$Id: CHANGES,v 1.1 2000/07/23 23:08:27 jon Exp $
+$Id: CHANGES,v 1.2 2000/12/24 03:34:23 dfs Exp $
+
+Version 2.0.2-dev
+
+o Some documentation fixes.
+
+o Perl5Matcher was not properly tracking the current offset in
+ __interpret so PatternMatcherInput would not have its current offset
+ properly updated. This bug was introduced when fixing the
+ PatternMatcherInput anchor bug. When the currentOffset parameter
+ was added to __interpret, not all of the necessary
+ __currentOffset = beginOffset assignments were changed to
+ __currentOffset = currentOffset assignments. This has been
+ fixed by updating the remaining assignments.
+
+o The org.apache.oro.text.regex.Util.split() method was further
+ generalized to accept a Collection reference argument to store the result.
+
+Version 2.0.1
+
+o Jeff ? (jlb@houseofdistraction.com) and Peter Kronenberg
+ (pkronenberg@predictivetechnologies.com) identified a bug in the
+ behavior of PatternMatcherInput matching methods with respect to
+ anchors (^). Matches were always being performed interpreting the
+ beginning of the string from either a 0 or a current offset rather
+ than from the beginOffset. Essentially, the beginning of the string
+ for purposes of matching ^ wasn't being associated with beginOffset.
+ This problem has been fixed.
+
+o A problem with multiline matches that was introduced in the
+ transition from OROMatcher/Perltools/etc. to Jakarta-ORO
+ was fixed.
+
+o The org.apache.oro.text.regex.Util.split() method was generalized to
+ accept a List reference argument to store the result.
+
+Version 2.0
Many small, but important, changes have been made to this software
between its last release as ORO software and its first release as part
1.8 +3 -1 jakarta-oro/build/build-oro.xml
Index: build-oro.xml
===================================================================
RCS file: /home/cvs/jakarta-oro/build/build-oro.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- build-oro.xml 2000/12/15 18:00:51 1.7
+++ build-oro.xml 2000/12/24 03:34:23 1.8
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- $Id: build-oro.xml,v 1.7 2000/12/15 18:00:51 jon Exp $ -->
+<!-- $Id: build-oro.xml,v 1.8 2000/12/24 03:34:23 dfs Exp $ -->
<project name="Jakarta-ORO" default="main" basedir=".">
@@ -27,7 +27,9 @@
<target name="prepare" depends="init">
<mkdir dir="${build.dest}"/>
+ <!--
<chmod perm="+x" file="bin/antRun"/>
+ -->
</target>
<!-- lib target. Compiles the library classes only -->
1.4 +2 -2 jakarta-oro/src/java/org/apache/oro/text/perl/Perl5Util.java
Index: Perl5Util.java
===================================================================
RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/perl/Perl5Util.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Perl5Util.java 2000/09/15 05:17:26 1.3
+++ Perl5Util.java 2000/12/24 03:34:24 1.4
@@ -111,7 +111,7 @@
* while((line = input.readLine()) != null) {
* // First find the line with the string we want to substitute because
* // it is cheaper than blindly substituting each line.
- * if(util.match("/HREF=\"description1.html\"") {
+ * if(util.match("/HREF=\"description1.html\"/") {
* line = util.substitute("s/description1\\.html/about1.html/", line);
* }
* output.println(line);
@@ -148,7 +148,7 @@
* (or even a split, but this isn't particularly useful).
@author <a href="mailto:dfs@savarese.org">Daniel F. Savarese</a>
- @version $Id: Perl5Util.java,v 1.3 2000/09/15 05:17:26 dfs Exp $
+ @version $Id: Perl5Util.java,v 1.4 2000/12/24 03:34:24 dfs Exp $
* @see MalformedPerl5PatternException
* @see org.apache.oro.text.PatternCache
1.4 +1 -5 jakarta-oro/src/java/org/apache/oro/text/regex/Perl5Compiler.java
Index: Perl5Compiler.java
===================================================================
RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/regex/Perl5Compiler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Perl5Compiler.java 2000/09/02 06:28:34 1.3
+++ Perl5Compiler.java 2000/12/24 03:34:25 1.4
@@ -65,7 +65,7 @@
* information about Perl5 regular expressions.
@author <a href="mailto:dfs@savarese.org">Daniel F. Savarese</a>
- @version $Id: Perl5Compiler.java,v 1.3 2000/09/02 06:28:34 jon Exp $
+ @version $Id: Perl5Compiler.java,v 1.4 2000/12/24 03:34:25 dfs Exp $
* @see PatternCompiler
* @see MalformedPatternException
@@ -136,8 +136,6 @@
* Additionally the <b> . </b> metacharacter will not match newlines when
* an expression is compiled with <b> MULTILINE_MASK </b>, which is its
* default behavior.
- * The <b>SINGLELINE_MASK</b> and <b>MULTILINE_MASK</b> should not be
- * used together.
*/
public static final int MULTILINE_MASK = __MULTILINE;
@@ -153,8 +151,6 @@
* Additionally, the <b> . </b> metacharacter will match newlines when
* an expression is compiled with <b> SINGLELINE_MASK </b>, unlike its
* default behavior.
- * The <b>SINGLELINE_MASK</b> and <b>MULTILINE_MASK</b> should not be
- * used together.
*/
public static final int SINGLELINE_MASK = __SINGLELINE;
1.6 +30 -26 jakarta-oro/src/java/org/apache/oro/text/regex/Perl5Matcher.java
Index: Perl5Matcher.java
===================================================================
RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/regex/Perl5Matcher.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Perl5Matcher.java 2000/12/22 23:52:52 1.5
+++ Perl5Matcher.java 2000/12/24 03:34:25 1.6
@@ -66,7 +66,7 @@
* Perl5Compiler.
@author <a href="mailto:dfs@savarese.org">Daniel F. Savarese</a>
- @version $Id: Perl5Matcher.java,v 1.5 2000/12/22 23:52:52 jon Exp $
+ @version $Id: Perl5Matcher.java,v 1.6 2000/12/24 03:34:25 dfs Exp $
* @see PatternMatcher
* @see Perl5Compiler
@@ -281,6 +281,8 @@
// is done to ensure validity.
// __originalInput must be set before calling this method for
// __lastMatchResult to be set correctly.
+ // beginOffset marks the beginning of the string
+ // currentOffset marks where to start the pattern search
private boolean __interpret(Perl5Pattern expression, char[] input,
int beginOffset, int endOffset,
int currentOffset)
@@ -315,8 +317,8 @@
break _mainLoop;
} else if(expression._back >= 0) {
__currentOffset-=expression._back;
- if(__currentOffset < beginOffset)
- __currentOffset = beginOffset;
+ if(__currentOffset < currentOffset)
+ __currentOffset = currentOffset;
minLength = expression._back + mustString.length;
} else if(!expression._isExpensive &&
(expression._options & Perl5Compiler.READ_ONLY_MASK) == 0 &&
@@ -325,7 +327,7 @@
// so that mustUtility is only decremented if the expression is
// compiled without READ_ONLY_MASK.
mustString = expression._mustString = null;
- __currentOffset = beginOffset;
+ __currentOffset = currentOffset;
} else {
__currentOffset = currentOffset;
minLength = mustString.length;
@@ -333,30 +335,32 @@
}
if((expression._anchor & Perl5Pattern._OPT_ANCH) != 0) {
- if(__tryExpression(expression, beginOffset)) {
- success = true;
- break _mainLoop;
- } else if(__multiline ||
- (expression._anchor & Perl5Pattern._OPT_ANCH_MBOL) != 0 ||
- (expression._anchor & Perl5Pattern._OPT_IMPLICIT) != 0) {
-
- if(minLength > 0)
- dontTry = minLength - 1;
- endOffset-=dontTry;
-
- if(__currentOffset > beginOffset)
- --__currentOffset;
-
- while(__currentOffset < endOffset) {
- if(__input[__currentOffset++] == '\n') {
- if(__currentOffset < endOffset &&
- __tryExpression(expression, __currentOffset)) {
- success = true;
- break _mainLoop;
+ if(__currentOffset == beginOffset &&
+ __tryExpression(expression, beginOffset))
+ {
+ success = true;
+ break _mainLoop;
+ } else if(__multiline
+ || (expression._anchor & Perl5Pattern._OPT_ANCH_MBOL) != 0
+ || (expression._anchor & Perl5Pattern._OPT_IMPLICIT) != 0)
+ {
+ if(minLength > 0)
+ dontTry = minLength - 1;
+ endOffset-=dontTry;
+
+ if(__currentOffset > currentOffset)
+ --__currentOffset;
+
+ while(__currentOffset < endOffset) {
+ if(__input[__currentOffset++] == '\n') {
+ if(__currentOffset < endOffset &&
+ __tryExpression(expression, __currentOffset)) {
+ success = true;
+ break _mainLoop;
+ }
+ }
}
}
- }
- }
break _mainLoop;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic