comparison src/regexp_nfa.c @ 4671:b3c59716e700 v7.3.1083

updated for version 7.3.1083 Problem: New regexp engine: Does not support \%^ and \%$. Solution: Support matching start and end of file.
author Bram Moolenaar <bram@vim.org>
date Fri, 31 May 2013 22:14:52 +0200
parents 2d15582e132f
children 05d57d7c2d55
comparison
equal deleted inserted replaced
4670:053beb7bf8ba 4671:b3c59716e700
863 863
864 /* Catch \%^ and \%$ regardless of where they appear in the 864 /* Catch \%^ and \%$ regardless of where they appear in the
865 * pattern -- regardless of whether or not it makes sense. */ 865 * pattern -- regardless of whether or not it makes sense. */
866 case '^': 866 case '^':
867 EMIT(NFA_BOF); 867 EMIT(NFA_BOF);
868 /* TODO: Not yet supported */
869 return FAIL;
870 break; 868 break;
871 869
872 case '$': 870 case '$':
873 EMIT(NFA_EOF); 871 EMIT(NFA_EOF);
874 /* TODO: Not yet supported */
875 return FAIL;
876 break; 872 break;
877 873
878 case '#': 874 case '#':
879 EMIT(NFA_CURSOR); 875 EMIT(NFA_CURSOR);
880 break; 876 break;
1778 break; 1774 break;
1779 case NFA_EOL: STRCPY(code, "NFA_EOL "); break; 1775 case NFA_EOL: STRCPY(code, "NFA_EOL "); break;
1780 case NFA_BOL: STRCPY(code, "NFA_BOL "); break; 1776 case NFA_BOL: STRCPY(code, "NFA_BOL "); break;
1781 case NFA_EOW: STRCPY(code, "NFA_EOW "); break; 1777 case NFA_EOW: STRCPY(code, "NFA_EOW "); break;
1782 case NFA_BOW: STRCPY(code, "NFA_BOW "); break; 1778 case NFA_BOW: STRCPY(code, "NFA_BOW "); break;
1779 case NFA_EOF: STRCPY(code, "NFA_EOF "); break;
1780 case NFA_BOF: STRCPY(code, "NFA_BOF "); break;
1783 case NFA_STAR: STRCPY(code, "NFA_STAR "); break; 1781 case NFA_STAR: STRCPY(code, "NFA_STAR "); break;
1784 case NFA_PLUS: STRCPY(code, "NFA_PLUS "); break; 1782 case NFA_PLUS: STRCPY(code, "NFA_PLUS "); break;
1785 case NFA_NOT: STRCPY(code, "NFA_NOT "); break; 1783 case NFA_NOT: STRCPY(code, "NFA_NOT "); break;
1786 case NFA_SKIP_CHAR: STRCPY(code, "NFA_SKIP_CHAR"); break; 1784 case NFA_SKIP_CHAR: STRCPY(code, "NFA_SKIP_CHAR"); break;
1787 case NFA_OR: STRCPY(code, "NFA_OR"); break; 1785 case NFA_OR: STRCPY(code, "NFA_OR"); break;
3702 eow = FALSE; 3700 eow = FALSE;
3703 if (eow) 3701 if (eow)
3704 addstate_here(thislist, t->state->out, &t->sub, &listidx); 3702 addstate_here(thislist, t->state->out, &t->sub, &listidx);
3705 break; 3703 break;
3706 } 3704 }
3705
3706 case NFA_BOF:
3707 if (reglnum == 0 && reginput == regline
3708 && (!REG_MULTI || reg_firstlnum == 1))
3709 addstate_here(thislist, t->state->out, &t->sub, &listidx);
3710 break;
3711
3712 case NFA_EOF:
3713 if (reglnum == reg_maxline && curc == NUL)
3714 addstate_here(thislist, t->state->out, &t->sub, &listidx);
3715 break;
3707 3716
3708 #ifdef FEAT_MBYTE 3717 #ifdef FEAT_MBYTE
3709 case NFA_COMPOSING: 3718 case NFA_COMPOSING:
3710 { 3719 {
3711 int mc = curc; 3720 int mc = curc;