summaryrefslogtreecommitdiffstats
path: root/libjava/gnu/regexp/RE.java
diff options
context:
space:
mode:
authormark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-25 19:04:34 +0000
committermark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-25 19:04:34 +0000
commitd1148ca6beb9cad1102b63b8d54e213c4c86f9ad (patch)
treeffc01befdc137abc39092adb9c561cb9a1c78bd9 /libjava/gnu/regexp/RE.java
parentcca3db550474ffe31298399c0c2446cb41d4bd26 (diff)
downloadppe42-gcc-d1148ca6beb9cad1102b63b8d54e213c4c86f9ad.tar.gz
ppe42-gcc-d1148ca6beb9cad1102b63b8d54e213c4c86f9ad.zip
2004-09-25 Shashank Bapat <shashankbapat@yahoo.com>
Mark Wielaard <mark@klomp.org> * gnu/regexp/RE.java (initialize): Add RETokenLookAhead support. * gnu/regexp/RETokenLookAhead.java: New file. * Makefile.am (ordinary_java_source_files): Add RETokenLookAhead.java. * Makefile.in: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88106 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/regexp/RE.java')
-rw-r--r--libjava/gnu/regexp/RE.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/libjava/gnu/regexp/RE.java b/libjava/gnu/regexp/RE.java
index fdc00feb3fb..d782975e9af 100644
--- a/libjava/gnu/regexp/RE.java
+++ b/libjava/gnu/regexp/RE.java
@@ -492,8 +492,25 @@ public class RE extends REToken {
else if ((unit.ch == '(') && (syntax.get(RESyntax.RE_NO_BK_PARENS) ^ unit.bk)) {
boolean pure = false;
boolean comment = false;
+ boolean lookAhead = false;
+ boolean negativelh = false;
if ((index+1 < pLength) && (pattern[index] == '?')) {
switch (pattern[index+1]) {
+ case '!':
+ if (syntax.get(RESyntax.RE_LOOKAHEAD)) {
+ pure = true;
+ negativelh = true;
+ lookAhead = true;
+ index += 2;
+ }
+ break;
+ case '=':
+ if (syntax.get(RESyntax.RE_LOOKAHEAD)) {
+ pure = true;
+ lookAhead = true;
+ index += 2;
+ }
+ break;
case ':':
if (syntax.get(RESyntax.RE_PURE_GROUPING)) {
pure = true;
@@ -539,10 +556,14 @@ public class RE extends REToken {
numSubs++;
}
- int useIndex = (pure) ? 0 : nextSub + numSubs;
+ int useIndex = (pure || lookAhead) ? 0 : nextSub + numSubs;
currentToken = new RE(String.valueOf(pattern,index,endIndex-index).toCharArray(),cflags,syntax,useIndex,nextSub + numSubs);
numSubs += ((RE) currentToken).getNumSubs();
+ if (lookAhead) {
+ currentToken = new RETokenLookAhead(currentToken,negativelh);
+ }
+
index = nextIndex;
} // not a comment
} // subexpression
OpenPOWER on IntegriCloud