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; |
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 |