Program: 188
Project: 188
Buggy source:
private boolean regmatch(@Nullable CharPointer scan){
  CharPointer next;
  int op;
  char c;
  while (scan != null) {
    if (got_int || out_of_stack) {
      return false;
    }
    next=regnext(scan);
    op=scan.OP();
    if (WITH_NL(op) && reginput.isNul() && reglnum < reg_maxline) {
      reg_nextline();
    }
 else {
      if (WITH_NL(op)) {
        op-=ADD_NL;
      }
      c=reginput.charAt();
switch (op) {
case BOL:
        if (!reginput.equals(regline)) {
          return false;
        }
      break;
case EOL:
    if (c != '\u0000') {
      return false;
    }
  break;
case RE_BOF:
if (reglnum != 0 || !reginput.equals(regline) || (reg_match == null && reg_getline(-1) != null)) {
  return false;
}
break;
case RE_EOF:
if (reglnum != reg_maxline || c != '\u0000') {
return false;
}
break;
case CURSOR:
LogicalPosition curpos=reg_buf.getCaretModel().getLogicalPosition();
if (reglnum + reg_firstlnum != curpos.line || reginput.pointer() - regline.pointer() != curpos.column) {
return false;
}
break;
case RE_LNUM:
if (reg_match != null || !re_num_cmp((reglnum + reg_firstlnum),scan)) {
return false;
}
break;
case RE_COL:
if (!re_num_cmp((reginput.pointer() - regline.pointer()) + 1,scan)) {
return false;
}
break;
case RE_VCOL:
break;
case BOW:
if (c == '\u0000') {
return false;
}
 else {
if (!CharacterClasses.isWord(c) || (reginput.pointer() > regline.pointer() && CharacterClasses.isWord(reginput.charAt(-1)))) {
return false;
}
}
break;
case EOW:
if (reginput.equals(regline)) {
return false;
}
if (!CharacterClasses.isWord(reginput.charAt(-1))) {
return false;
}
if (!reginput.isNul() && CharacterClasses.isWord(c)) {
return false;
}
break;
case ANY:
if (c == '\u0000') {
return false;
}
reginput.inc();
break;
case IDENT:
if (!Character.isJavaIdentifierPart(c)) {
return false;
}
reginput.inc();
break;
case SIDENT:
if (CharacterClasses.isDigit(reginput.charAt()) || !Character.isJavaIdentifierPart(c)) {
return false;
}
reginput.inc();
break;
case KWORD:
if (!CharacterClasses.isWord(reginput.charAt())) {
return false;
}
reginput.inc();
break;
case SKWORD:
if (CharacterClasses.isDigit(reginput.charAt()) || !CharacterClasses.isWord(reginput.charAt())) {
return false;
}
reginput.inc();
break;
case FNAME:
if (!CharacterClasses.isFile(c)) {
return false;
}
reginput.inc();
break;
case SFNAME:
if (CharacterClasses.isDigit(reginput.charAt()) || !CharacterClasses.isFile(c)) {
return false;
}
reginput.inc();
break;
case PRINT:
if (!CharacterClasses.isPrint(reginput.charAt())) {
return false;
}
reginput.inc();
break;
case SPRINT:
if (CharacterClasses.isDigit(reginput.charAt()) || !CharacterClasses.isPrint(reginput.charAt())) {
return false;
}
reginput.inc();
break;
case WHITE:
if (!CharacterClasses.isWhite(c)) {
return false;
}
reginput.inc();
break;
case NWHITE:
if (c == '\u0000' || CharacterClasses.isWhite(c)) {
return false;
}
reginput.inc();
break;
case DIGIT:
if (!CharacterClasses.isDigit(c)) {
return false;
}
reginput.inc();
break;
case NDIGIT:
if (c == '\u0000' || CharacterClasses.isDigit(c)) {
return false;
}
reginput.inc();
break;
case HEX:
if (!CharacterClasses.isHex(c)) {
return false;
}
reginput.inc();
break;
case NHEX:
if (c == '\u0000' || CharacterClasses.isHex(c)) {
return false;
}
reginput.inc();
break;
case OCTAL:
if (!CharacterClasses.isOctal(c)) {
return false;
}
reginput.inc();
break;
case NOCTAL:
if (c == '\u0000' || CharacterClasses.isOctal(c)) {
return false;
}
reginput.inc();
break;
case WORD:
if (!CharacterClasses.isWord(c)) {
return false;
}
reginput.inc();
break;
case NWORD:
if (c == '\u0000' || CharacterClasses.isWord(c)) {
return false;
}
reginput.inc();
break;
case HEAD:
if (!CharacterClasses.isHead(c)) {
return false;
}
reginput.inc();
break;
case NHEAD:
if (c == '\u0000' || CharacterClasses.isHead(c)) {
return false;
}
reginput.inc();
break;
case ALPHA:
if (!CharacterClasses.isAlpha(c)) {
return false;
}
reginput.inc();
break;
case NALPHA:
if (c == '\u0000' || CharacterClasses.isAlpha(c)) {
return false;
}
reginput.inc();
break;
case LOWER:
if (!CharacterClasses.isLower(c)) {
return false;
}
reginput.inc();
break;
case NLOWER:
if (c == '\u0000' || CharacterClasses.isLower(c)) {
return false;
}
reginput.inc();
break;
case UPPER:
if (!CharacterClasses.isUpper(c)) {
return false;
}
reginput.inc();
break;
case NUPPER:
if (c == '\u0000' || CharacterClasses.isUpper(c)) {
return false;
}
reginput.inc();
break;
case EXACTLY:
{
int len;
CharPointer opnd;
opnd=scan.OPERAND();
if (opnd.charAt() != reginput.charAt() && (!ireg_ic || Character.toLowerCase(opnd.charAt()) != Character.toLowerCase(reginput.charAt()))) {
return false;
}
if (opnd.charAt(1) == '\u0000') {
reginput.inc();
}
 else {
len=opnd.strlen();
if (cstrncmp(opnd,reginput,len) != 0) {
return false;
}
reginput.inc(len);
}
}
break;
case ANYOF:
case ANYBUT:
if (c == '\u0000') {
return false;
}
if ((cstrchr(scan.OPERAND(),c) == null) == (op == ANYOF)) {
return false;
}
reginput.inc();
break;
case NOTHING:
break;
case BACK:
break;
case MOPEN:
case MOPEN + 1:
case MOPEN + 2:
case MOPEN + 3:
case MOPEN + 4:
case MOPEN + 5:
case MOPEN + 6:
case MOPEN + 7:
case MOPEN + 8:
case MOPEN + 9:
{
int no;
save_se_T save=new save_se_T();
no=op - MOPEN;
cleanup_subexpr();
save_se(save,reg_startpos[no],reg_startp[no]);
if (regmatch(next)) {
return true;
}
restore_se(save,reg_startpos[no],reg_startp[no]);
return false;
}
case NOPEN:
case NCLOSE:
return regmatch(next);
case ZOPEN + 1:
case ZOPEN + 2:
case ZOPEN + 3:
case ZOPEN + 4:
case ZOPEN + 5:
case ZOPEN + 6:
case ZOPEN + 7:
case ZOPEN + 8:
case ZOPEN + 9:
{
int no;
save_se_T save=new save_se_T();
no=op - ZOPEN;
cleanup_zsubexpr();
save_se(save,reg_startzpos[no],reg_startzp[no]);
if (regmatch(next)) {
return true;
}
restore_se(save,reg_startzpos[no],reg_startzp[no]);
return false;
}
case MCLOSE:
case MCLOSE + 1:
case MCLOSE + 2:
case MCLOSE + 3:
case MCLOSE + 4:
case MCLOSE + 5:
case MCLOSE + 6:
case MCLOSE + 7:
case MCLOSE + 8:
case MCLOSE + 9:
{
int no;
save_se_T save=new save_se_T();
no=op - MCLOSE;
cleanup_subexpr();
save_se(save,reg_endpos[no],reg_endp[no]);
if (regmatch(next)) {
return true;
}
restore_se(save,reg_endpos[no],reg_endp[no]);
return false;
}
case ZCLOSE + 1:
case ZCLOSE + 2:
case ZCLOSE + 3:
case ZCLOSE + 4:
case ZCLOSE + 5:
case ZCLOSE + 6:
case ZCLOSE + 7:
case ZCLOSE + 8:
case ZCLOSE + 9:
{
int no;
save_se_T save=new save_se_T();
no=op - ZCLOSE;
cleanup_zsubexpr();
save_se(save,reg_endzpos[no],reg_endzp[no]);
if (regmatch(next)) {
return true;
}
restore_se(save,reg_endzpos[no],reg_endzp[no]);
return false;
}
case BACKREF + 1:
case BACKREF + 2:
case BACKREF + 3:
case BACKREF + 4:
case BACKREF + 5:
case BACKREF + 6:
case BACKREF + 7:
case BACKREF + 8:
case BACKREF + 9:
{
int no;
int len;
int clnum;
int ccol;
CharPointer p;
no=op - BACKREF;
cleanup_subexpr();
if (reg_match != null) {
if (reg_endp[no] == null) {
len=0;
}
 else {
len=reg_endp[no].pointer() - reg_startp[no].pointer();
if (cstrncmp(reg_startp[no],reginput,len) != 0) {
return false;
}
}
}
 else {
if (reg_endpos[no].lnum < 0) {
len=0;
}
 else {
if (reg_startpos[no].lnum == reglnum && reg_endpos[no].lnum == reglnum) {
len=reg_endpos[no].col - reg_startpos[no].col;
if (cstrncmp(regline.ref(reg_startpos[no].col),reginput,len) != 0) {
return false;
}
}
 else {
ccol=reg_startpos[no].col;
clnum=reg_startpos[no].lnum;
for (; ; ) {
if (!regline.equals(reg_tofree)) {
reg_tofree=regline.ref(0);
reginput=reg_tofree.ref(reginput.pointer() - regline.pointer());
regline=reg_tofree.ref(0);
}
p=reg_getline(clnum);
if (clnum == reg_endpos[no].lnum) {
len=reg_endpos[no].col - ccol;
}
 else {
len=p.ref(ccol).strlen();
}
if (cstrncmp(p.ref(ccol),reginput,len) != 0) {
return false;
}
if (clnum == reg_endpos[no].lnum) {
break;
}
if (reglnum == reg_maxline) {
return false;
}
reg_nextline();
++clnum;
ccol=0;
if (got_int || out_of_stack) {
return false;
}
}
}
}
}
reginput.inc(len);
}
break;
case ZREF + 1:
case ZREF + 2:
case ZREF + 3:
case ZREF + 4:
case ZREF + 5:
case ZREF + 6:
case ZREF + 7:
case ZREF + 8:
case ZREF + 9:
{
int no;
int len;
cleanup_zsubexpr();
no=op - ZREF;
if (re_extmatch_in != null && re_extmatch_in.matches[no] != null) {
len=re_extmatch_in.matches[no].length();
if (cstrncmp(new CharPointer(re_extmatch_in.matches[no]),reginput,len) != 0) {
return false;
}
reginput.inc(len);
}
 else {
}
}
break;
case BRANCH:
{
if (next.OP() != BRANCH) {
next=scan.OPERAND();
}
 else {
regsave_T save=new regsave_T();
do {
reg_save(save);
if (regmatch(scan.OPERAND())) {
return true;
}
reg_restore(save);
scan=regnext(scan);
}
 while (scan != null && scan.OP() == BRANCH);
return false;
}
}
break;
case BRACE_LIMITS:
{
int no;
if (next.OP() == BRACE_SIMPLE) {
bl_minval=scan.OPERAND_MIN();
bl_maxval=scan.OPERAND_MAX();
}
 else if (next.OP() >= BRACE_COMPLEX && next.OP() < BRACE_COMPLEX + 10) {
no=next.OP() - BRACE_COMPLEX;
brace_min[no]=scan.OPERAND_MIN();
brace_max[no]=scan.OPERAND_MAX();
brace_count[no]=0;
}
 else {
VimPlugin.showMessage(MessageHelper.message(Msg.e_internal));
return false;
}
}
break;
case BRACE_COMPLEX:
case BRACE_COMPLEX + 1:
case BRACE_COMPLEX + 2:
case BRACE_COMPLEX + 3:
case BRACE_COMPLEX + 4:
case BRACE_COMPLEX + 5:
case BRACE_COMPLEX + 6:
case BRACE_COMPLEX + 7:
case BRACE_COMPLEX + 8:
case BRACE_COMPLEX + 9:
{
int no;
regsave_T save=new regsave_T();
no=op - BRACE_COMPLEX;
++brace_count[no];
if (brace_count[no] <= (brace_min[no] <= brace_max[no] ? brace_min[no] : brace_max[no])) {
reg_save(save);
if (regmatch(scan.OPERAND())) {
return true;
}
reg_restore(save);
--brace_count[no];
return false;
}
if (brace_min[no] <= brace_max[no]) {
if (brace_count[no] <= brace_max[no]) {
reg_save(save);
if (regmatch(scan.OPERAND())) {
return true;
}
reg_restore(save);
--brace_count[no];
}
}
 else {
if (brace_count[no] <= brace_min[no]) {
reg_save(save);
if (regmatch(next)) {
return true;
}
reg_restore(save);
next=scan.OPERAND();
}
}
}
break;
case BRACE_SIMPLE:
case STAR:
case PLUS:
{
char nextb;
char nextb_ic;
int count;
regsave_T save=new regsave_T();
int minval;
int maxval;
if (next.OP() == EXACTLY) {
nextb=next.OPERAND().charAt();
if (ireg_ic) {
if (Character.isUpperCase(nextb)) {
nextb_ic=Character.toLowerCase(nextb);
}
 else {
nextb_ic=Character.toUpperCase(nextb);
}
}
 else {
nextb_ic=nextb;
}
}
 else {
nextb='\u0000';
nextb_ic='\u0000';
}
if (op != BRACE_SIMPLE) {
minval=(op == STAR) ? 0 : 1;
maxval=MAX_LIMIT;
}
 else {
minval=bl_minval;
maxval=bl_maxval;
}
count=regrepeat(scan.OPERAND(),maxval);
if (got_int) {
return false;
}
if (minval <= maxval) {
while (count >= minval) {
if (nextb == '\u0000' || reginput.charAt() == nextb || reginput.charAt() == nextb_ic) {
reg_save(save);
if (regmatch(next)) {
return true;
}
reg_restore(save);
}
if (--count < minval) {
break;
}
if (reginput == regline) {
--reglnum;
regline=reg_getline(reglnum);
if (regline == null) {
return false;
}
reginput=regline.ref(regline.strlen());
if (got_int || out_of_stack) {
return false;
}
}
 else {
reginput.dec();
}
}
}
 else {
if (count < maxval) {
return false;
}
for (; ; ) {
if (nextb == '\u0000' || reginput.charAt() == nextb || reginput.charAt() == nextb_ic) {
reg_save(save);
if (regmatch(next)) {
return true;
}
reg_restore(save);
}
if (count == minval || regrepeat(scan.OPERAND(),1) == 0) {
break;
}
++count;
if (got_int || out_of_stack) {
return false;
}
}
}
return false;
}
case NOMATCH:
{
regsave_T save=new regsave_T();
reg_save(save);
if (regmatch(scan.OPERAND())) {
return false;
}
reg_restore(save);
}
break;
case MATCH:
case SUBPAT:
{
regsave_T save=new regsave_T();
reg_save(save);
if (!regmatch(scan.OPERAND())) {
return false;
}
if (op == MATCH) {
reg_restore(save);
}
}
break;
case BEHIND:
case NOBEHIND:
{
regsave_T save_after=new regsave_T(), save_start=new regsave_T();
regsave_T save_behind_pos=new regsave_T();
boolean needmatch=(op == BEHIND);
reg_save(save_start);
if (regmatch(next)) {
reg_save(save_after);
save_behind_pos=behind_pos;
behind_pos=save_start;
while (true) {
reg_restore(save_start);
if (regmatch(scan.OPERAND()) && reg_save_equal(behind_pos)) {
behind_pos=save_behind_pos;
if (needmatch) {
reg_restore(save_after);
return true;
}
return false;
}
if (reg_match == null) {
if (save_start.pos.col == 0) {
if (save_start.pos.lnum < behind_pos.pos.lnum || reg_getline(--save_start.pos.lnum) == null) {
break;
}
reg_restore(save_start);
save_start.pos.col=regline.strlen();
}
 else {
--save_start.pos.col;
}
}
 else {
if (save_start.ptr == regline) {
break;
}
save_start.ptr.dec();
}
}
behind_pos=save_behind_pos;
if (!needmatch) {
reg_restore(save_after);
return true;
}
}
return false;
}
case BHPOS:
if (reg_match == null) {
if (behind_pos.pos.col != reginput.pointer() - regline.pointer() || behind_pos.pos.lnum != reglnum) {
return false;
}
}
 else if (behind_pos.ptr != reginput) {
return false;
}
break;
case NEWL:
if (c != '\u0000' || reglnum == reg_maxline) {
return false;
}
reg_nextline();
break;
case END:
return true;
default :
VimPlugin.showMessage(MessageHelper.message(Msg.e_re_corr));
return false;
}
}
scan=next;
}
VimPlugin.showMessage(MessageHelper.message(Msg.e_re_corr));
return false;
}

Fixed version (ground truth):
private boolean regmatch(@Nullable CharPointer scan){
  CharPointer next;
  int op;
  char c;
  while (scan != null) {
    if (got_int || out_of_stack) {
      return false;
    }
    next=regnext(scan);
    op=scan.OP();
    if (WITH_NL(op) && reginput.isNul() && reglnum < reg_maxline) {
      reg_nextline();
    }
 else {
      if (WITH_NL(op)) {
        op-=ADD_NL;
      }
      c=reginput.charAt();
switch (op) {
case BOL:
        if (!reginput.equals(regline)) {
          return false;
        }
      break;
case EOL:
    if (c != '\u0000') {
      return false;
    }
  break;
case RE_BOF:
if (reglnum != 0 || !reginput.equals(regline) || (reg_match == null && reg_getline(-1) != null)) {
  return false;
}
break;
case RE_EOF:
if (reglnum != reg_maxline || c != '\u0000') {
return false;
}
break;
case CURSOR:
LogicalPosition curpos=reg_buf.getCaretModel().getLogicalPosition();
if (reglnum + reg_firstlnum != curpos.line || reginput.pointer() - regline.pointer() != curpos.column) {
return false;
}
break;
case RE_LNUM:
if (reg_match != null || !re_num_cmp((reglnum + reg_firstlnum),scan)) {
return false;
}
break;
case RE_COL:
if (!re_num_cmp((reginput.pointer() - regline.pointer()) + 1,scan)) {
return false;
}
break;
case RE_VCOL:
break;
case BOW:
if (c == '\u0000') {
return false;
}
 else {
if (!CharacterClasses.isWord(c) || (reginput.pointer() > regline.pointer() && CharacterClasses.isWord(reginput.charAt(-1)))) {
return false;
}
}
break;
case EOW:
if (reginput.equals(regline)) {
return false;
}
if (!CharacterClasses.isWord(reginput.charAt(-1))) {
return false;
}
if (!reginput.isNul() && CharacterClasses.isWord(c)) {
return false;
}
break;
case ANY:
if (c == '\u0000') {
return false;
}
reginput.inc();
break;
case IDENT:
if (!Character.isJavaIdentifierPart(c)) {
return false;
}
reginput.inc();
break;
case SIDENT:
if (CharacterClasses.isDigit(reginput.charAt()) || !Character.isJavaIdentifierPart(c)) {
return false;
}
reginput.inc();
break;
case KWORD:
if (!CharacterClasses.isWord(reginput.charAt())) {
return false;
}
reginput.inc();
break;
case SKWORD:
if (CharacterClasses.isDigit(reginput.charAt()) || !CharacterClasses.isWord(reginput.charAt())) {
return false;
}
reginput.inc();
break;
case FNAME:
if (!CharacterClasses.isFile(c)) {
return false;
}
reginput.inc();
break;
case SFNAME:
if (CharacterClasses.isDigit(reginput.charAt()) || !CharacterClasses.isFile(c)) {
return false;
}
reginput.inc();
break;
case PRINT:
if (!CharacterClasses.isPrint(reginput.charAt())) {
return false;
}
reginput.inc();
break;
case SPRINT:
if (CharacterClasses.isDigit(reginput.charAt()) || !CharacterClasses.isPrint(reginput.charAt())) {
return false;
}
reginput.inc();
break;
case WHITE:
if (!CharacterClasses.isWhite(c)) {
return false;
}
reginput.inc();
break;
case NWHITE:
if (c == '\u0000' || CharacterClasses.isWhite(c)) {
return false;
}
reginput.inc();
break;
case DIGIT:
if (!CharacterClasses.isDigit(c)) {
return false;
}
reginput.inc();
break;
case NDIGIT:
if (c == '\u0000' || CharacterClasses.isDigit(c)) {
return false;
}
reginput.inc();
break;
case HEX:
if (!CharacterClasses.isHex(c)) {
return false;
}
reginput.inc();
break;
case NHEX:
if (c == '\u0000' || CharacterClasses.isHex(c)) {
return false;
}
reginput.inc();
break;
case OCTAL:
if (!CharacterClasses.isOctal(c)) {
return false;
}
reginput.inc();
break;
case NOCTAL:
if (c == '\u0000' || CharacterClasses.isOctal(c)) {
return false;
}
reginput.inc();
break;
case WORD:
if (!CharacterClasses.isWord(c)) {
return false;
}
reginput.inc();
break;
case NWORD:
if (c == '\u0000' || CharacterClasses.isWord(c)) {
return false;
}
reginput.inc();
break;
case HEAD:
if (!CharacterClasses.isHead(c)) {
return false;
}
reginput.inc();
break;
case NHEAD:
if (c == '\u0000' || CharacterClasses.isHead(c)) {
return false;
}
reginput.inc();
break;
case ALPHA:
if (!CharacterClasses.isAlpha(c)) {
return false;
}
reginput.inc();
break;
case NALPHA:
if (c == '\u0000' || CharacterClasses.isAlpha(c)) {
return false;
}
reginput.inc();
break;
case LOWER:
if (!CharacterClasses.isLower(c)) {
return false;
}
reginput.inc();
break;
case NLOWER:
if (c == '\u0000' || CharacterClasses.isLower(c)) {
return false;
}
reginput.inc();
break;
case UPPER:
if (!CharacterClasses.isUpper(c)) {
return false;
}
reginput.inc();
break;
case NUPPER:
if (c == '\u0000' || CharacterClasses.isUpper(c)) {
return false;
}
reginput.inc();
break;
case EXACTLY:
{
int len;
CharPointer opnd;
opnd=scan.OPERAND();
if (opnd.charAt() != reginput.charAt() && (!ireg_ic || Character.toLowerCase(opnd.charAt()) != Character.toLowerCase(reginput.charAt()))) {
return false;
}
if (opnd.charAt(1) == '\u0000') {
reginput.inc();
}
 else {
len=opnd.strlen();
if (cstrncmp(opnd,reginput,len) != 0) {
return false;
}
reginput.inc(len);
}
}
break;
case ANYOF:
case ANYBUT:
if (c == '\u0000') {
return false;
}
if ((cstrchr(scan.OPERAND(),c) == null) == (op == ANYOF)) {
return false;
}
reginput.inc();
break;
case NOTHING:
break;
case BACK:
break;
case MOPEN:
case MOPEN + 1:
case MOPEN + 2:
case MOPEN + 3:
case MOPEN + 4:
case MOPEN + 5:
case MOPEN + 6:
case MOPEN + 7:
case MOPEN + 8:
case MOPEN + 9:
{
int no;
save_se_T save=new save_se_T();
no=op - MOPEN;
cleanup_subexpr();
save_se(save,reg_startpos[no],reg_startp[no]);
if (regmatch(next)) {
return true;
}
restore_se(save,reg_startpos[no],reg_startp[no]);
return false;
}
case NOPEN:
case NCLOSE:
return regmatch(next);
case ZOPEN + 1:
case ZOPEN + 2:
case ZOPEN + 3:
case ZOPEN + 4:
case ZOPEN + 5:
case ZOPEN + 6:
case ZOPEN + 7:
case ZOPEN + 8:
case ZOPEN + 9:
{
int no;
save_se_T save=new save_se_T();
no=op - ZOPEN;
cleanup_zsubexpr();
save_se(save,reg_startzpos[no],reg_startzp[no]);
if (regmatch(next)) {
return true;
}
restore_se(save,reg_startzpos[no],reg_startzp[no]);
return false;
}
case MCLOSE:
case MCLOSE + 1:
case MCLOSE + 2:
case MCLOSE + 3:
case MCLOSE + 4:
case MCLOSE + 5:
case MCLOSE + 6:
case MCLOSE + 7:
case MCLOSE + 8:
case MCLOSE + 9:
{
int no;
save_se_T save=new save_se_T();
no=op - MCLOSE;
cleanup_subexpr();
save_se(save,reg_endpos[no],reg_endp[no]);
if (regmatch(next)) {
return true;
}
restore_se(save,reg_endpos[no],reg_endp[no]);
return false;
}
case ZCLOSE + 1:
case ZCLOSE + 2:
case ZCLOSE + 3:
case ZCLOSE + 4:
case ZCLOSE + 5:
case ZCLOSE + 6:
case ZCLOSE + 7:
case ZCLOSE + 8:
case ZCLOSE + 9:
{
int no;
save_se_T save=new save_se_T();
no=op - ZCLOSE;
cleanup_zsubexpr();
save_se(save,reg_endzpos[no],reg_endzp[no]);
if (regmatch(next)) {
return true;
}
restore_se(save,reg_endzpos[no],reg_endzp[no]);
return false;
}
case BACKREF + 1:
case BACKREF + 2:
case BACKREF + 3:
case BACKREF + 4:
case BACKREF + 5:
case BACKREF + 6:
case BACKREF + 7:
case BACKREF + 8:
case BACKREF + 9:
{
int no;
int len;
int clnum;
int ccol;
CharPointer p;
no=op - BACKREF;
cleanup_subexpr();
if (reg_match != null) {
if (reg_endp[no] == null) {
len=0;
}
 else {
len=reg_endp[no].pointer() - reg_startp[no].pointer();
if (cstrncmp(reg_startp[no],reginput,len) != 0) {
return false;
}
}
}
 else {
if (reg_endpos[no].lnum < 0) {
len=0;
}
 else {
if (reg_startpos[no].lnum == reglnum && reg_endpos[no].lnum == reglnum) {
len=reg_endpos[no].col - reg_startpos[no].col;
if (cstrncmp(regline.ref(reg_startpos[no].col),reginput,len) != 0) {
return false;
}
}
 else {
ccol=reg_startpos[no].col;
clnum=reg_startpos[no].lnum;
for (; ; ) {
if (!regline.equals(reg_tofree)) {
reg_tofree=regline.ref(0);
reginput=reg_tofree.ref(reginput.pointer() - regline.pointer());
regline=reg_tofree.ref(0);
}
p=reg_getline(clnum);
if (clnum == reg_endpos[no].lnum) {
len=reg_endpos[no].col - ccol;
}
 else {
len=p.ref(ccol).strlen();
}
if (cstrncmp(p.ref(ccol),reginput,len) != 0) {
return false;
}
if (clnum == reg_endpos[no].lnum) {
break;
}
if (reglnum == reg_maxline) {
return false;
}
reg_nextline();
++clnum;
ccol=0;
if (got_int || out_of_stack) {
return false;
}
}
}
}
}
reginput.inc(len);
}
break;
case ZREF + 1:
case ZREF + 2:
case ZREF + 3:
case ZREF + 4:
case ZREF + 5:
case ZREF + 6:
case ZREF + 7:
case ZREF + 8:
case ZREF + 9:
{
int no;
int len;
cleanup_zsubexpr();
no=op - ZREF;
if (re_extmatch_in != null && re_extmatch_in.matches[no] != null) {
len=re_extmatch_in.matches[no].length();
if (cstrncmp(new CharPointer(re_extmatch_in.matches[no]),reginput,len) != 0) {
return false;
}
reginput.inc(len);
}
 else {
}
}
break;
case BRANCH:
{
if (next.OP() != BRANCH) {
next=scan.OPERAND();
}
 else {
regsave_T save=new regsave_T();
do {
reg_save(save);
if (regmatch(scan.OPERAND())) {
return true;
}
reg_restore(save);
scan=regnext(scan);
}
 while (scan != null && scan.OP() == BRANCH);
return false;
}
}
break;
case BRACE_LIMITS:
{
int no;
if (next.OP() == BRACE_SIMPLE) {
bl_minval=scan.OPERAND_MIN();
bl_maxval=scan.OPERAND_MAX();
}
 else if (next.OP() >= BRACE_COMPLEX && next.OP() < BRACE_COMPLEX + 10) {
no=next.OP() - BRACE_COMPLEX;
brace_min[no]=scan.OPERAND_MIN();
brace_max[no]=scan.OPERAND_MAX();
brace_count[no]=0;
}
 else {
VimPlugin.showMessage(MessageHelper.message(Msg.e_internal));
return false;
}
}
break;
case BRACE_COMPLEX:
case BRACE_COMPLEX + 1:
case BRACE_COMPLEX + 2:
case BRACE_COMPLEX + 3:
case BRACE_COMPLEX + 4:
case BRACE_COMPLEX + 5:
case BRACE_COMPLEX + 6:
case BRACE_COMPLEX + 7:
case BRACE_COMPLEX + 8:
case BRACE_COMPLEX + 9:
{
int no;
regsave_T save=new regsave_T();
no=op - BRACE_COMPLEX;
++brace_count[no];
if (brace_count[no] <= (brace_min[no] <= brace_max[no] ? brace_min[no] : brace_max[no])) {
reg_save(save);
if (regmatch(scan.OPERAND())) {
return true;
}
reg_restore(save);
--brace_count[no];
return false;
}
if (brace_min[no] <= brace_max[no]) {
if (brace_count[no] <= brace_max[no]) {
reg_save(save);
if (regmatch(scan.OPERAND())) {
return true;
}
reg_restore(save);
--brace_count[no];
}
}
 else {
if (brace_count[no] <= brace_min[no]) {
reg_save(save);
if (regmatch(next)) {
return true;
}
reg_restore(save);
next=scan.OPERAND();
}
}
}
break;
case BRACE_SIMPLE:
case STAR:
case PLUS:
{
char nextb;
char nextb_ic;
int count;
regsave_T save=new regsave_T();
int minval;
int maxval;
if (next.OP() == EXACTLY) {
nextb=next.OPERAND().charAt();
if (ireg_ic) {
if (Character.isUpperCase(nextb)) {
nextb_ic=Character.toLowerCase(nextb);
}
 else {
nextb_ic=Character.toUpperCase(nextb);
}
}
 else {
nextb_ic=nextb;
}
}
 else {
nextb='\u0000';
nextb_ic='\u0000';
}
if (op != BRACE_SIMPLE) {
minval=(op == STAR) ? 0 : 1;
maxval=MAX_LIMIT;
}
 else {
minval=bl_minval;
maxval=bl_maxval;
}
count=regrepeat(scan.OPERAND(),maxval);
if (got_int) {
return false;
}
if (minval <= maxval) {
while (count >= minval) {
if (nextb == '\u0000' || reginput.charAt() == nextb || reginput.charAt() == nextb_ic) {
reg_save(save);
if (regmatch(next)) {
return true;
}
reg_restore(save);
}
if (--count < minval) {
break;
}
if (reginput.equals(regline)) {
--reglnum;
regline=reg_getline(reglnum);
if (regline == null) {
return false;
}
reginput=regline.ref(regline.strlen());
if (got_int || out_of_stack) {
return false;
}
}
 else {
reginput.dec();
}
}
}
 else {
if (count < maxval) {
return false;
}
for (; ; ) {
if (nextb == '\u0000' || reginput.charAt() == nextb || reginput.charAt() == nextb_ic) {
reg_save(save);
if (regmatch(next)) {
return true;
}
reg_restore(save);
}
if (count == minval || regrepeat(scan.OPERAND(),1) == 0) {
break;
}
++count;
if (got_int || out_of_stack) {
return false;
}
}
}
return false;
}
case NOMATCH:
{
regsave_T save=new regsave_T();
reg_save(save);
if (regmatch(scan.OPERAND())) {
return false;
}
reg_restore(save);
}
break;
case MATCH:
case SUBPAT:
{
regsave_T save=new regsave_T();
reg_save(save);
if (!regmatch(scan.OPERAND())) {
return false;
}
if (op == MATCH) {
reg_restore(save);
}
}
break;
case BEHIND:
case NOBEHIND:
{
regsave_T save_after=new regsave_T(), save_start=new regsave_T();
regsave_T save_behind_pos;
boolean needmatch=(op == BEHIND);
reg_save(save_start);
if (regmatch(next)) {
reg_save(save_after);
save_behind_pos=behind_pos == null ? null : new regsave_T(behind_pos);
behind_pos=new regsave_T(save_start);
while (true) {
reg_restore(save_start);
if (regmatch(scan.OPERAND()) && reg_save_equal(behind_pos)) {
behind_pos=save_behind_pos;
if (needmatch) {
reg_restore(save_after);
return true;
}
return false;
}
if (reg_match == null) {
if (save_start.pos.col == 0) {
if (save_start.pos.lnum < behind_pos.pos.lnum || reg_getline(--save_start.pos.lnum) == null) {
break;
}
reg_restore(save_start);
save_start.pos.col=regline.strlen();
}
 else {
--save_start.pos.col;
}
}
 else {
if (save_start.ptr == regline) {
break;
}
save_start.ptr.dec();
}
}
behind_pos=save_behind_pos;
if (!needmatch) {
reg_restore(save_after);
return true;
}
}
return false;
}
case BHPOS:
if (reg_match == null) {
if (behind_pos.pos.col != reginput.pointer() - regline.pointer() || behind_pos.pos.lnum != reglnum) {
return false;
}
}
 else if (behind_pos.ptr != reginput) {
return false;
}
break;
case NEWL:
if (c != '\u0000' || reglnum == reg_maxline) {
return false;
}
reg_nextline();
break;
case END:
return true;
default :
VimPlugin.showMessage(MessageHelper.message(Msg.e_re_corr));
return false;
}
}
scan=next;
}
VimPlugin.showMessage(MessageHelper.message(Msg.e_re_corr));
return false;
}