dfs 2002/10/30 09:49:10
Modified: . CHANGES build.properties
src/java/org/apache/oro/text/awk AwkMatchResult.java
AwkMatcher.java
Log:
PR: 13522
Fixed problem whereby an AwkMatchResult resulting from a match on an
AwkStreamInput source (AwkMatcher.contains(AwkStreamInput, Pattern);)
would contain offsets relative to the buffered input rather than to where
the input stream was first read from (usually the beginning of the stream).
Revision Changes Path
1.31 +7 -2 jakarta-oro/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/jakarta-oro/CHANGES,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- CHANGES 14 Oct 2002 16:20:02 -0000 1.30
+++ CHANGES 30 Oct 2002 17:49:10 -0000 1.31
@@ -1,6 +1,11 @@
$Id$
-Version 2.0.7-dev0-2
+Version 2.0.7-dev-2
+ o Fixed problem whereby an AwkMatchResult resulting from a match on an
+ AwkStreamInput source (AwkMatcher.contains(AwkStreamInput, Pattern);)
+ would contain offsets relative to the buffered input rather than to where
+ the input stream was first read from (usually the beginning of the stream).
+
o Added support for negating modifiers. For example (?-i)foo. Note,
we still do not support Perl 5.005+ group-local modifiers such as
(?imsx-imsx:pattern).
1.5 +2 -2 jakarta-oro/build.properties
Index: build.properties
===================================================================
RCS file: /home/cvs/jakarta-oro/build.properties,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- build.properties 31 May 2002 03:17:42 -0000 1.4
+++ build.properties 30 Oct 2002 17:49:10 -0000 1.5
@@ -12,7 +12,7 @@
# Name and version information
name=Jakarta-ORO
project=jakarta-oro
-version=2.0.7-dev-1
+version=2.0.7-dev-2
# Name and version of the project
project.name=${project}-${version}
1.5 +10 -1 jakarta-oro/src/java/org/apache/oro/text/awk/AwkMatchResult.java
Index: AwkMatchResult.java
===================================================================
RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/awk/AwkMatchResult.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AwkMatchResult.java 20 May 2001 23:55:21 -0000 1.4
+++ AwkMatchResult.java 30 Oct 2002 17:49:10 -0000 1.5
@@ -114,6 +114,15 @@
/**
+ * Adjusts the relative offset where the match begins to an absolute
+ * value. Only used by AwkMatcher to adjust the offset for stream
+ * matches.
+ */
+ void _incrementMatchBeginOffset(int streamOffset) {
+ __matchBeginOffset+=streamOffset;
+ }
+
+ /**
* @return The length of the match.
*/
public int length(){ return __length; }
1.7 +9 -2 jakarta-oro/src/java/org/apache/oro/text/awk/AwkMatcher.java
Index: AwkMatcher.java
===================================================================
RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/awk/AwkMatcher.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AwkMatcher.java 10 Jul 2001 12:39:18 -0000 1.6
+++ AwkMatcher.java 30 Oct 2002 17:49:10 -0000 1.7
@@ -621,7 +621,14 @@
__beginOffset = 0;
_search();
input._currentOffset = __lastMatchedBufferOffset;
- return (__lastMatchResult != null);
+
+ if(__lastMatchResult != null) {
+ // Adjust match begin offset to be relative to beginning of stream.
+ __lastMatchResult._incrementMatchBeginOffset(input._bufferOffset);
+ return true;
+ }
+
+ return false;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.