/[classpath]/classpath/gnu/regexp/RE.java
ViewVC logotype

Diff of /classpath/gnu/regexp/RE.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by mark, Sun Mar 7 23:58:54 2004 UTC revision 1.2 by mark, Sat Sep 25 17:29:13 2004 UTC
# Line 492  public class RE extends REToken { Line 492  public class RE extends REToken {
492        else if ((unit.ch == '(') && (syntax.get(RESyntax.RE_NO_BK_PARENS) ^ unit.bk)) {        else if ((unit.ch == '(') && (syntax.get(RESyntax.RE_NO_BK_PARENS) ^ unit.bk)) {
493          boolean pure = false;          boolean pure = false;
494          boolean comment = false;          boolean comment = false;
495            boolean lookAhead = false;
496            boolean negativelh = false;
497          if ((index+1 < pLength) && (pattern[index] == '?')) {          if ((index+1 < pLength) && (pattern[index] == '?')) {
498            switch (pattern[index+1]) {            switch (pattern[index+1]) {
499              case '!':
500                if (syntax.get(RESyntax.RE_LOOKAHEAD)) {
501                  pure = true;
502                  negativelh = true;
503                  lookAhead = true;
504                  index += 2;
505                }
506                break;
507              case '=':
508                if (syntax.get(RESyntax.RE_LOOKAHEAD)) {
509                  pure = true;
510                  lookAhead = true;
511                  index += 2;
512                }
513                break;
514            case ':':            case ':':
515              if (syntax.get(RESyntax.RE_PURE_GROUPING)) {              if (syntax.get(RESyntax.RE_PURE_GROUPING)) {
516                pure = true;                pure = true;
# Line 539  public class RE extends REToken { Line 556  public class RE extends REToken {
556              numSubs++;              numSubs++;
557            }            }
558    
559            int useIndex = (pure) ? 0 : nextSub + numSubs;            int useIndex = (pure || lookAhead) ? 0 : nextSub + numSubs;
560            currentToken = new RE(String.valueOf(pattern,index,endIndex-index).toCharArray(),cflags,syntax,useIndex,nextSub + numSubs);            currentToken = new RE(String.valueOf(pattern,index,endIndex-index).toCharArray(),cflags,syntax,useIndex,nextSub + numSubs);
561            numSubs += ((RE) currentToken).getNumSubs();            numSubs += ((RE) currentToken).getNumSubs();
562    
563              if (lookAhead) {
564                  currentToken = new RETokenLookAhead(currentToken,negativelh);
565              }
566    
567            index = nextIndex;            index = nextIndex;
568          } // not a comment          } // not a comment
569        } // subexpression        } // subexpression

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26