updated for version 7.0072
This commit is contained in:
		| @ -1259,7 +1259,7 @@ POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) $(TCL | ||||
|  | ||||
| ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(POST_DEFS) | ||||
|  | ||||
| LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) -Dinline= -D__extension__= -Dalloca=alloca | ||||
| LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) -Dinline= -D__extension__= -Dalloca=alloca -D"__attribute__(x)=" | ||||
|  | ||||
| DEPEND_CFLAGS = -DPROTO -DDEPEND -DFEAT_GUI $(LINT_CFLAGS) | ||||
|  | ||||
|  | ||||
| @ -1075,11 +1075,11 @@ else | ||||
|   fi | ||||
| fi | ||||
|  | ||||
| test "x$with_x" = xno -a "x$BEOS" != "xyes" -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no | ||||
| test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no | ||||
|  | ||||
| AC_MSG_CHECKING(--enable-gui argument) | ||||
| AC_ARG_ENABLE(gui, | ||||
|  [  --enable-gui[=OPTS]     X11 GUI [default=auto] [OPTS=auto/no/gtk/gtk2/gnome/gnome2/kde/motif/athena/neXtaw/beos/photon/carbon]], , enable_gui="auto") | ||||
|  [  --enable-gui[=OPTS]     X11 GUI [default=auto] [OPTS=auto/no/gtk/gtk2/gnome/gnome2/kde/motif/athena/neXtaw/photon/carbon]], , enable_gui="auto") | ||||
|  | ||||
| dnl Canonicalize the --enable-gui= argument so that it can be easily compared. | ||||
| dnl Do not use character classes for portability with old tools. | ||||
|  | ||||
| @ -1209,7 +1209,11 @@ gui_mch_destroy_scrollbar(scrollbar_T *sb) | ||||
| /* | ||||
|  * Implementation of the file selector related stuff | ||||
|  */ | ||||
| #if defined(HAVE_GTK2) && GTK_CHECK_VERSION(2,4,0) | ||||
| # define USE_FILE_CHOOSER | ||||
| #endif | ||||
|  | ||||
| #ifndef USE_FILE_CHOOSER | ||||
| /*ARGSUSED*/ | ||||
|     static void | ||||
| browse_ok_cb(GtkWidget *widget, gpointer cbdata) | ||||
| @ -1258,6 +1262,7 @@ browse_destroy_cb(GtkWidget * widget) | ||||
|  | ||||
|     return FALSE; | ||||
| } | ||||
| #endif | ||||
|  | ||||
| /* | ||||
|  * Put up a file requester. | ||||
| @ -1278,7 +1283,9 @@ gui_mch_browse(int saving, | ||||
| 	       char_u *initdir, | ||||
| 	       char_u *filter) | ||||
| { | ||||
|     GtkFileSelection	*fs;	/* shortcut */ | ||||
| #ifdef USE_FILE_CHOOSER | ||||
|     GtkWidget		*fc; | ||||
| #endif | ||||
|     char_u		dirbuf[MAXPATHL]; | ||||
|     char_u		*p; | ||||
|  | ||||
| @ -1286,12 +1293,56 @@ gui_mch_browse(int saving, | ||||
|     title = CONVERT_TO_UTF8(title); | ||||
| # endif | ||||
|  | ||||
|     if (!gui.filedlg) | ||||
|     /* Concatenate "initdir" and "dflt". */ | ||||
|     if (initdir == NULL || *initdir == NUL) | ||||
| 	mch_dirname(dirbuf, MAXPATHL); | ||||
|     else if (STRLEN(initdir) + 2 < MAXPATHL) | ||||
| 	STRCPY(dirbuf, initdir); | ||||
|     else | ||||
| 	dirbuf[0] = NUL; | ||||
|     /* Always need a trailing slash for a directory. */ | ||||
|     add_pathsep(dirbuf); | ||||
|     if (dflt != NULL && *dflt != NUL | ||||
| 			      && STRLEN(dirbuf) + 2 + STRLEN(dflt) < MAXPATHL) | ||||
| 	STRCAT(dirbuf, dflt); | ||||
|  | ||||
|     /* If our pointer is currently hidden, then we should show it. */ | ||||
|     gui_mch_mousehide(FALSE); | ||||
|  | ||||
| #ifdef USE_FILE_CHOOSER | ||||
|     /* We create the dialog each time, so that the button text can be "Open" | ||||
|      * or "Save" according to the action. */ | ||||
|     fc = gtk_file_chooser_dialog_new((const gchar *)title, | ||||
| 	    GTK_WINDOW(gui.mainwin), | ||||
| 	    saving ? GTK_FILE_CHOOSER_ACTION_SAVE | ||||
| 					   : GTK_FILE_CHOOSER_ACTION_OPEN, | ||||
| 	    saving ? GTK_STOCK_SAVE : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, | ||||
| 	    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | ||||
| 	    NULL); | ||||
|     gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fc), | ||||
| 						       (const gchar *)dirbuf); | ||||
|  | ||||
|     gui.browse_fname = NULL; | ||||
|     if (gtk_dialog_run(GTK_DIALOG(fc)) == GTK_RESPONSE_ACCEPT) | ||||
|     { | ||||
|         char *filename; | ||||
|  | ||||
|         filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc)); | ||||
|         gui.browse_fname = (char_u *)g_strdup(filename); | ||||
|         g_free(filename); | ||||
|     } | ||||
|     gtk_widget_destroy(GTK_WIDGET(fc)); | ||||
|  | ||||
| #else | ||||
|  | ||||
|     if (gui.filedlg == NULL) | ||||
|     { | ||||
| 	GtkFileSelection	*fs;	/* shortcut */ | ||||
|  | ||||
| 	gui.filedlg = gtk_file_selection_new((const gchar *)title); | ||||
| 	gtk_window_set_modal(GTK_WINDOW(gui.filedlg), TRUE); | ||||
| 	gtk_window_set_transient_for(GTK_WINDOW(gui.filedlg), | ||||
| 		GTK_WINDOW(gui.mainwin)); | ||||
| 						     GTK_WINDOW(gui.mainwin)); | ||||
| 	fs = GTK_FILE_SELECTION(gui.filedlg); | ||||
|  | ||||
| 	gtk_container_border_width(GTK_CONTAINER(fs), 4); | ||||
| @ -1308,26 +1359,6 @@ gui_mch_browse(int saving, | ||||
|     else | ||||
| 	gtk_window_set_title(GTK_WINDOW(gui.filedlg), (const gchar *)title); | ||||
|  | ||||
| # ifdef HAVE_GTK2 | ||||
|     CONVERT_TO_UTF8_FREE(title); | ||||
| # endif | ||||
|  | ||||
|     /* if our pointer is currently hidden, then we should show it. */ | ||||
|     gui_mch_mousehide(FALSE); | ||||
|  | ||||
|     /* Concatenate "initdir" and "dflt". */ | ||||
|     if (initdir == NULL || *initdir == NUL) | ||||
| 	mch_dirname(dirbuf, MAXPATHL); | ||||
|     else if (STRLEN(initdir) + 2 < MAXPATHL) | ||||
| 	STRCPY(dirbuf, initdir); | ||||
|     else | ||||
| 	dirbuf[0] = NUL; | ||||
|     /* Always need a trailing slash for a directory. */ | ||||
|     add_pathsep(dirbuf); | ||||
|     if (dflt != NULL && *dflt != NUL | ||||
| 			      && STRLEN(dirbuf) + 2 + STRLEN(dflt) < MAXPATHL) | ||||
| 	STRCAT(dirbuf, dflt); | ||||
|  | ||||
|     gtk_file_selection_set_filename(GTK_FILE_SELECTION(gui.filedlg), | ||||
| 						      (const gchar *)dirbuf); | ||||
| # ifndef HAVE_GTK2 | ||||
| @ -1338,7 +1369,11 @@ gui_mch_browse(int saving, | ||||
|     gtk_widget_show(gui.filedlg); | ||||
|     while (gui.filedlg && GTK_WIDGET_DRAWABLE(gui.filedlg)) | ||||
| 	gtk_main_iteration_do(TRUE); | ||||
| #endif | ||||
|  | ||||
| # ifdef HAVE_GTK2 | ||||
|     CONVERT_TO_UTF8_FREE(title); | ||||
| # endif | ||||
|     if (gui.browse_fname == NULL) | ||||
| 	return NULL; | ||||
|  | ||||
| @ -1422,6 +1457,7 @@ gui_mch_browsedir( | ||||
| } | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #endif	/* FEAT_BROWSE */ | ||||
|  | ||||
| #if defined(FEAT_GUI_DIALOG) && !defined(HAVE_GTK2) | ||||
| @ -3104,7 +3140,6 @@ gui_gtk_position_in_parent( | ||||
| 	pos_x = xP + wP - c_size.width - 2; | ||||
|     /* Assume 'guiheadroom' indicates the title bar height... */ | ||||
|     if ((pos_y + c_size.height + p_ghr / 2) > (hP + yP)) | ||||
| 	pos_y = yP + hP - c_size.height - 2 - p_ghr / 2; | ||||
|  | ||||
|     gtk_widget_set_uposition(child, pos_x, pos_y); | ||||
| } | ||||
|  | ||||
							
								
								
									
										242
									
								
								src/regexp.c
									
									
									
									
									
								
							
							
						
						
									
										242
									
								
								src/regexp.c
									
									
									
									
									
								
							| @ -3073,6 +3073,81 @@ static linenr_T		reg_firstlnum; | ||||
| static linenr_T		reg_maxline; | ||||
| static int		reg_line_lbr;	    /* "\n" in string is line break */ | ||||
|  | ||||
| /* Values for rs_state in regitem_T. */ | ||||
| typedef enum regstate_E | ||||
| { | ||||
|     RS_NOPEN = 0	/* NOPEN and NCLOSE */ | ||||
|     , RS_MOPEN		/* MOPEN + [0-9] */ | ||||
|     , RS_MCLOSE		/* MCLOSE + [0-9] */ | ||||
| #ifdef FEAT_SYN_HL | ||||
|     , RS_ZOPEN		/* ZOPEN + [0-9] */ | ||||
|     , RS_ZCLOSE		/* ZCLOSE + [0-9] */ | ||||
| #endif | ||||
|     , RS_BRANCH		/* BRANCH */ | ||||
|     , RS_BRCPLX_MORE	/* BRACE_COMPLEX and trying one more match */ | ||||
|     , RS_BRCPLX_LONG	/* BRACE_COMPLEX and trying longest match */ | ||||
|     , RS_BRCPLX_SHORT	/* BRACE_COMPLEX and trying shortest match */ | ||||
|     , RS_NOMATCH	/* NOMATCH */ | ||||
|     , RS_BEHIND1	/* BEHIND / NOBEHIND matching rest */ | ||||
|     , RS_BEHIND2	/* BEHIND / NOBEHIND matching behind part */ | ||||
|     , RS_STAR_LONG	/* STAR/PLUS/BRACE_SIMPLE longest match */ | ||||
|     , RS_STAR_SHORT	/* STAR/PLUS/BRACE_SIMPLE shortest match */ | ||||
| } regstate_T; | ||||
|  | ||||
| /* | ||||
|  * When there are alternatives a regstate_T is put on the regstack to remember | ||||
|  * what we are doing. | ||||
|  * Before it may be another type of item, depending on rs_state, to remember | ||||
|  * more things. | ||||
|  */ | ||||
| typedef struct regitem_S | ||||
| { | ||||
|     regstate_T	rs_state;	/* what we are doing, one of RS_ above */ | ||||
|     char_u	*rs_scan;	/* current node in program */ | ||||
|     union | ||||
|     { | ||||
| 	save_se_T  sesave; | ||||
| 	regsave_T  regsave; | ||||
|     } rs_un;			/* room for saving reginput */ | ||||
|     short	rs_no;		/* submatch nr */ | ||||
| } regitem_T; | ||||
|  | ||||
| static regitem_T *regstack_push __ARGS((regstate_T state, char_u *scan)); | ||||
| static void regstack_pop __ARGS((char_u **scan)); | ||||
|  | ||||
| /* used for BEHIND and NOBEHIND matching */ | ||||
| typedef struct regbehind_S | ||||
| { | ||||
|     regsave_T	save_after; | ||||
|     regsave_T	save_behind; | ||||
| } regbehind_T; | ||||
|  | ||||
| /* used for STAR, PLUS and BRACE_SIMPLE matching */ | ||||
| typedef struct regstar_S | ||||
| { | ||||
|     int		nextb;		/* next byte */ | ||||
|     int		nextb_ic;	/* next byte reverse case */ | ||||
|     long	count; | ||||
|     long	minval; | ||||
|     long	maxval; | ||||
| } regstar_T; | ||||
|  | ||||
| /* used to store input position when a BACK was encountered, so that we now if | ||||
|  * we made any progress since the last time. */ | ||||
| typedef struct backpos_S | ||||
| { | ||||
|     char_u	*bp_scan;	/* "scan" where BACK was encountered */ | ||||
|     regsave_T	bp_pos;		/* last input position */ | ||||
| } backpos_T; | ||||
|  | ||||
| /* | ||||
|  * regstack and backpos are used by regmatch().  They are kept over calls to | ||||
|  * avoid invoking malloc() and free() often. | ||||
|  */ | ||||
| static garray_T	regstack;	/* stack with regitem_T items, sometimes | ||||
| 				   preceded by regstar_T or regbehind_T. */ | ||||
| static garray_T	backpos;	/* table with backpos_T for BACK */ | ||||
|  | ||||
| /* | ||||
|  * Get pointer to the line "lnum", which is relative to "reg_firstlnum". | ||||
|  */ | ||||
| @ -3202,6 +3277,14 @@ vim_regexec_both(line, col) | ||||
|  | ||||
|     reg_tofree = NULL; | ||||
|  | ||||
|     /* Init the regstack empty.  Use an item size of 1 byte, since we push | ||||
|      * different things onto it.  Use a large grow size to avoid reallocating | ||||
|      * it too often. */ | ||||
|     ga_init2(®stack, 1, 10000); | ||||
|  | ||||
|     /* Init the backpos table empty. */ | ||||
|     ga_init2(&backpos, sizeof(backpos_T), 10); | ||||
|  | ||||
|     if (REG_MULTI) | ||||
|     { | ||||
| 	prog = reg_mmatch->regprog; | ||||
| @ -3360,8 +3443,10 @@ vim_regexec_both(line, col) | ||||
|     } | ||||
|  | ||||
| theend: | ||||
|     /* Didn't find a match. */ | ||||
|     vim_free(reg_tofree); | ||||
|     ga_clear(®stack); | ||||
|     ga_clear(&backpos); | ||||
|  | ||||
|     return retval; | ||||
| } | ||||
|  | ||||
| @ -3519,73 +3604,6 @@ reg_prev_class() | ||||
| static long	bl_minval; | ||||
| static long	bl_maxval; | ||||
|  | ||||
| /* Values for rs_state in regitem_T. */ | ||||
| typedef enum regstate_E | ||||
| { | ||||
|     RS_NOPEN = 0	/* NOPEN and NCLOSE */ | ||||
|     , RS_MOPEN		/* MOPEN + [0-9] */ | ||||
|     , RS_MCLOSE		/* MCLOSE + [0-9] */ | ||||
| #ifdef FEAT_SYN_HL | ||||
|     , RS_ZOPEN		/* ZOPEN + [0-9] */ | ||||
|     , RS_ZCLOSE		/* ZCLOSE + [0-9] */ | ||||
| #endif | ||||
|     , RS_BRANCH		/* BRANCH */ | ||||
|     , RS_BRCPLX_MORE	/* BRACE_COMPLEX and trying one more match */ | ||||
|     , RS_BRCPLX_LONG	/* BRACE_COMPLEX and trying longest match */ | ||||
|     , RS_BRCPLX_SHORT	/* BRACE_COMPLEX and trying shortest match */ | ||||
|     , RS_NOMATCH	/* NOMATCH */ | ||||
|     , RS_BEHIND1	/* BEHIND / NOBEHIND matching rest */ | ||||
|     , RS_BEHIND2	/* BEHIND / NOBEHIND matching behind part */ | ||||
|     , RS_STAR_LONG	/* STAR/PLUS/BRACE_SIMPLE longest match */ | ||||
|     , RS_STAR_SHORT	/* STAR/PLUS/BRACE_SIMPLE shortest match */ | ||||
| } regstate_T; | ||||
|  | ||||
| /* | ||||
|  * When there are alternatives a regstate_T is put on the regstack to remember | ||||
|  * what we are doing. | ||||
|  * Before it may be another type of item, depending on rs_state, to remember | ||||
|  * more things. | ||||
|  */ | ||||
| typedef struct regitem_S | ||||
| { | ||||
|     regstate_T	rs_state;	/* what we are doing, one of RS_ above */ | ||||
|     char_u	*rs_scan;	/* current node in program */ | ||||
|     union | ||||
|     { | ||||
| 	save_se_T  sesave; | ||||
| 	regsave_T  regsave; | ||||
|     } rs_un;			/* room for saving reginput */ | ||||
|     short	rs_no;		/* submatch nr */ | ||||
| } regitem_T; | ||||
|  | ||||
| static regitem_T *regstack_push __ARGS((garray_T *regstack, regstate_T state, char_u *scan)); | ||||
| static void regstack_pop __ARGS((garray_T *regstack, char_u **scan)); | ||||
|  | ||||
| /* used for BEHIND and NOBEHIND matching */ | ||||
| typedef struct regbehind_S | ||||
| { | ||||
|     regsave_T	save_after; | ||||
|     regsave_T	save_behind; | ||||
| } regbehind_T; | ||||
|  | ||||
| /* used for STAR, PLUS and BRACE_SIMPLE matching */ | ||||
| typedef struct regstar_S | ||||
| { | ||||
|     int		nextb;		/* next byte */ | ||||
|     int		nextb_ic;	/* next byte reverse case */ | ||||
|     long	count; | ||||
|     long	minval; | ||||
|     long	maxval; | ||||
| } regstar_T; | ||||
|  | ||||
| /* used to store input position when a BACK was encountered, so that we now if | ||||
|  * we made any progress since the last time. */ | ||||
| typedef struct backpos_S | ||||
| { | ||||
|     char_u	*bp_scan;	/* "scan" where BACK was encountered */ | ||||
|     regsave_T	bp_pos;		/* last input position */ | ||||
| } backpos_T; | ||||
|  | ||||
| /* | ||||
|  * regmatch - main matching routine | ||||
|  * | ||||
| @ -3608,8 +3626,6 @@ regmatch(scan) | ||||
|   char_u	*next;		/* Next node. */ | ||||
|   int		op; | ||||
|   int		c; | ||||
|   garray_T	regstack;	/* stack with regitem_T items, sometimes | ||||
| 				   preceded by regstar_T or regbehind_T. */ | ||||
|   regitem_T	*rp; | ||||
|   int		no; | ||||
|   int		status;		/* one of the RA_ values: */ | ||||
| @ -3618,14 +3634,11 @@ regmatch(scan) | ||||
| #define RA_BREAK	3	/* break inner loop */ | ||||
| #define RA_MATCH	4	/* successful match */ | ||||
| #define RA_NOMATCH	5	/* didn't match */ | ||||
|   garray_T	backpos;	/* table with backpos_T for BACK */ | ||||
|  | ||||
|   /* Init the regstack empty.  Use an item size of 1 byte, since we push | ||||
|    * different things onto it.  Use a large grow size to avoid reallocating | ||||
|    * it too often. */ | ||||
|   ga_init2(®stack, 1, 10000); | ||||
|  | ||||
|   ga_init2(&backpos, sizeof(backpos_T), 10); | ||||
|   /* Init the regstack and backpos table empty.  They are initialized and | ||||
|    * freed in vim_regexec_both() to reduce malloc()/free() calls. */ | ||||
|   regstack.ga_len = 0; | ||||
|   backpos.ga_len = 0; | ||||
|  | ||||
|   /* | ||||
|    * Repeat until "regstack" is empty. | ||||
| @ -4133,7 +4146,7 @@ regmatch(scan) | ||||
| 	    { | ||||
| 		no = op - MOPEN; | ||||
| 		cleanup_subexpr(); | ||||
| 		rp = regstack_push(®stack, RS_MOPEN, scan); | ||||
| 		rp = regstack_push(RS_MOPEN, scan); | ||||
| 		if (rp == NULL) | ||||
| 		    status = RA_FAIL; | ||||
| 		else | ||||
| @ -4148,7 +4161,7 @@ regmatch(scan) | ||||
|  | ||||
| 	  case NOPEN:	    /* \%( */ | ||||
| 	  case NCLOSE:	    /* \) after \%( */ | ||||
| 		if (regstack_push(®stack, RS_NOPEN, scan) == NULL) | ||||
| 		if (regstack_push(RS_NOPEN, scan) == NULL) | ||||
| 		    status = RA_FAIL; | ||||
| 		/* We simply continue and handle the result when done. */ | ||||
| 		break; | ||||
| @ -4166,7 +4179,7 @@ regmatch(scan) | ||||
| 	    { | ||||
| 		no = op - ZOPEN; | ||||
| 		cleanup_zsubexpr(); | ||||
| 		rp = regstack_push(®stack, RS_ZOPEN, scan); | ||||
| 		rp = regstack_push(RS_ZOPEN, scan); | ||||
| 		if (rp == NULL) | ||||
| 		    status = RA_FAIL; | ||||
| 		else | ||||
| @ -4193,7 +4206,7 @@ regmatch(scan) | ||||
| 	    { | ||||
| 		no = op - MCLOSE; | ||||
| 		cleanup_subexpr(); | ||||
| 		rp = regstack_push(®stack, RS_MCLOSE, scan); | ||||
| 		rp = regstack_push(RS_MCLOSE, scan); | ||||
| 		if (rp == NULL) | ||||
| 		    status = RA_FAIL; | ||||
| 		else | ||||
| @ -4218,7 +4231,7 @@ regmatch(scan) | ||||
| 	    { | ||||
| 		no = op - ZCLOSE; | ||||
| 		cleanup_zsubexpr(); | ||||
| 		rp = regstack_push(®stack, RS_ZCLOSE, scan); | ||||
| 		rp = regstack_push(RS_ZCLOSE, scan); | ||||
| 		if (rp == NULL) | ||||
| 		    status = RA_FAIL; | ||||
| 		else | ||||
| @ -4396,7 +4409,7 @@ regmatch(scan) | ||||
| 		    next = OPERAND(scan);	/* Avoid recursion. */ | ||||
| 		else | ||||
| 		{ | ||||
| 		    rp = regstack_push(®stack, RS_BRANCH, scan); | ||||
| 		    rp = regstack_push(RS_BRANCH, scan); | ||||
| 		    if (rp == NULL) | ||||
| 			status = RA_FAIL; | ||||
| 		    else | ||||
| @ -4446,7 +4459,7 @@ regmatch(scan) | ||||
| 		if (brace_count[no] <= (brace_min[no] <= brace_max[no] | ||||
| 					     ? brace_min[no] : brace_max[no])) | ||||
| 		{ | ||||
| 		    rp = regstack_push(®stack, RS_BRCPLX_MORE, scan); | ||||
| 		    rp = regstack_push(RS_BRCPLX_MORE, scan); | ||||
| 		    if (rp == NULL) | ||||
| 			status = RA_FAIL; | ||||
| 		    else | ||||
| @ -4465,7 +4478,7 @@ regmatch(scan) | ||||
| 		    /* Range is the normal way around, use longest match */ | ||||
| 		    if (brace_count[no] <= brace_max[no]) | ||||
| 		    { | ||||
| 			rp = regstack_push(®stack, RS_BRCPLX_LONG, scan); | ||||
| 			rp = regstack_push(RS_BRCPLX_LONG, scan); | ||||
| 			if (rp == NULL) | ||||
| 			    status = RA_FAIL; | ||||
| 			else | ||||
| @ -4482,7 +4495,7 @@ regmatch(scan) | ||||
| 		    /* Range is backwards, use shortest match first */ | ||||
| 		    if (brace_count[no] <= brace_min[no]) | ||||
| 		    { | ||||
| 			rp = regstack_push(®stack, RS_BRCPLX_SHORT, scan); | ||||
| 			rp = regstack_push(RS_BRCPLX_SHORT, scan); | ||||
| 			if (rp == NULL) | ||||
| 			    status = RA_FAIL; | ||||
| 			else | ||||
| @ -4562,7 +4575,7 @@ regmatch(scan) | ||||
| 		    else | ||||
| 		    { | ||||
| 			regstack.ga_len += sizeof(regstar_T); | ||||
| 			rp = regstack_push(®stack, rst.minval <= rst.maxval | ||||
| 			rp = regstack_push(rst.minval <= rst.maxval | ||||
| 					? RS_STAR_LONG : RS_STAR_SHORT, scan); | ||||
| 			if (rp == NULL) | ||||
| 			    status = RA_FAIL; | ||||
| @ -4582,7 +4595,7 @@ regmatch(scan) | ||||
| 	  case NOMATCH: | ||||
| 	  case MATCH: | ||||
| 	  case SUBPAT: | ||||
| 	    rp = regstack_push(®stack, RS_NOMATCH, scan); | ||||
| 	    rp = regstack_push(RS_NOMATCH, scan); | ||||
| 	    if (rp == NULL) | ||||
| 		status = RA_FAIL; | ||||
| 	    else | ||||
| @ -4607,7 +4620,7 @@ regmatch(scan) | ||||
| 	    else | ||||
| 	    { | ||||
| 		regstack.ga_len += sizeof(regbehind_T); | ||||
| 		rp = regstack_push(®stack, RS_BEHIND1, scan); | ||||
| 		rp = regstack_push(RS_BEHIND1, scan); | ||||
| 		if (rp == NULL) | ||||
| 		    status = RA_FAIL; | ||||
| 		else | ||||
| @ -4675,7 +4688,7 @@ regmatch(scan) | ||||
| 	{ | ||||
| 	  case RS_NOPEN: | ||||
| 	    /* Result is passed on as-is, simply pop the state. */ | ||||
| 	    regstack_pop(®stack, &scan); | ||||
| 	    regstack_pop(&scan); | ||||
| 	    break; | ||||
|  | ||||
| 	  case RS_MOPEN: | ||||
| @ -4683,7 +4696,7 @@ regmatch(scan) | ||||
| 	    if (status == RA_NOMATCH) | ||||
| 		restore_se(&rp->rs_un.sesave, ®_startpos[rp->rs_no], | ||||
| 						  ®_startp[rp->rs_no]); | ||||
| 	    regstack_pop(®stack, &scan); | ||||
| 	    regstack_pop(&scan); | ||||
| 	    break; | ||||
|  | ||||
| #ifdef FEAT_SYN_HL | ||||
| @ -4692,7 +4705,7 @@ regmatch(scan) | ||||
| 	    if (status == RA_NOMATCH) | ||||
| 		restore_se(&rp->rs_un.sesave, ®_startzpos[rp->rs_no], | ||||
| 						 ®_startzp[rp->rs_no]); | ||||
| 	    regstack_pop(®stack, &scan); | ||||
| 	    regstack_pop(&scan); | ||||
| 	    break; | ||||
| #endif | ||||
|  | ||||
| @ -4701,7 +4714,7 @@ regmatch(scan) | ||||
| 	    if (status == RA_NOMATCH) | ||||
| 		restore_se(&rp->rs_un.sesave, ®_endpos[rp->rs_no], | ||||
| 						    ®_endp[rp->rs_no]); | ||||
| 	    regstack_pop(®stack, &scan); | ||||
| 	    regstack_pop(&scan); | ||||
| 	    break; | ||||
|  | ||||
| #ifdef FEAT_SYN_HL | ||||
| @ -4710,14 +4723,14 @@ regmatch(scan) | ||||
| 	    if (status == RA_NOMATCH) | ||||
| 		restore_se(&rp->rs_un.sesave, ®_endzpos[rp->rs_no], | ||||
| 						   ®_endzp[rp->rs_no]); | ||||
| 	    regstack_pop(®stack, &scan); | ||||
| 	    regstack_pop(&scan); | ||||
| 	    break; | ||||
| #endif | ||||
|  | ||||
| 	  case RS_BRANCH: | ||||
| 	    if (status == RA_MATCH) | ||||
| 		/* this branch matched, use it */ | ||||
| 		regstack_pop(®stack, &scan); | ||||
| 		regstack_pop(&scan); | ||||
| 	    else | ||||
| 	    { | ||||
| 		if (status != RA_BREAK) | ||||
| @ -4730,7 +4743,7 @@ regmatch(scan) | ||||
| 		{ | ||||
| 		    /* no more branches, didn't find a match */ | ||||
| 		    status = RA_NOMATCH; | ||||
| 		    regstack_pop(®stack, &scan); | ||||
| 		    regstack_pop(&scan); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @ -4749,7 +4762,7 @@ regmatch(scan) | ||||
| 		reg_restore(&rp->rs_un.regsave, &backpos); | ||||
| 		--brace_count[rp->rs_no];	/* decrement match count */ | ||||
| 	    } | ||||
| 	    regstack_pop(®stack, &scan); | ||||
| 	    regstack_pop(&scan); | ||||
| 	    break; | ||||
|  | ||||
| 	  case RS_BRCPLX_LONG: | ||||
| @ -4762,7 +4775,7 @@ regmatch(scan) | ||||
| 		/* continue with the items after "\{}" */ | ||||
| 		status = RA_CONT; | ||||
| 	    } | ||||
| 	    regstack_pop(®stack, &scan); | ||||
| 	    regstack_pop(&scan); | ||||
| 	    if (status == RA_CONT) | ||||
| 		scan = regnext(scan); | ||||
| 	    break; | ||||
| @ -4772,7 +4785,7 @@ regmatch(scan) | ||||
| 	    if (status == RA_NOMATCH) | ||||
| 		/* There was no match, try to match one more item. */ | ||||
| 		reg_restore(&rp->rs_un.regsave, &backpos); | ||||
| 	    regstack_pop(®stack, &scan); | ||||
| 	    regstack_pop(&scan); | ||||
| 	    if (status == RA_NOMATCH) | ||||
| 	    { | ||||
| 		scan = OPERAND(scan); | ||||
| @ -4792,7 +4805,7 @@ regmatch(scan) | ||||
| 		if (rp->rs_no != SUBPAT)	/* zero-width */ | ||||
| 		    reg_restore(&rp->rs_un.regsave, &backpos); | ||||
| 	    } | ||||
| 	    regstack_pop(®stack, &scan); | ||||
| 	    regstack_pop(&scan); | ||||
| 	    if (status == RA_CONT) | ||||
| 		scan = regnext(scan); | ||||
| 	    break; | ||||
| @ -4800,7 +4813,7 @@ regmatch(scan) | ||||
| 	  case RS_BEHIND1: | ||||
| 	    if (status == RA_NOMATCH) | ||||
| 	    { | ||||
| 		regstack_pop(®stack, &scan); | ||||
| 		regstack_pop(&scan); | ||||
| 		regstack.ga_len -= sizeof(regbehind_T); | ||||
| 	    } | ||||
| 	    else | ||||
| @ -4844,7 +4857,7 @@ regmatch(scan) | ||||
| 		else | ||||
| 		    /* But we didn't want a match. */ | ||||
| 		    status = RA_NOMATCH; | ||||
| 		regstack_pop(®stack, &scan); | ||||
| 		regstack_pop(&scan); | ||||
| 		regstack.ga_len -= sizeof(regbehind_T); | ||||
| 	    } | ||||
| 	    else | ||||
| @ -4897,7 +4910,7 @@ regmatch(scan) | ||||
| 		    } | ||||
| 		    else | ||||
| 			status = RA_NOMATCH; | ||||
| 		    regstack_pop(®stack, &scan); | ||||
| 		    regstack_pop(&scan); | ||||
| 		    regstack.ga_len -= sizeof(regbehind_T); | ||||
| 		} | ||||
| 	    } | ||||
| @ -4910,7 +4923,7 @@ regmatch(scan) | ||||
|  | ||||
| 		if (status == RA_MATCH) | ||||
| 		{ | ||||
| 		    regstack_pop(®stack, &scan); | ||||
| 		    regstack_pop(&scan); | ||||
| 		    regstack.ga_len -= sizeof(regstar_T); | ||||
| 		    break; | ||||
| 		} | ||||
| @ -4976,7 +4989,7 @@ regmatch(scan) | ||||
| 		if (status != RA_CONT) | ||||
| 		{ | ||||
| 		    /* Failed. */ | ||||
| 		    regstack_pop(®stack, &scan); | ||||
| 		    regstack_pop(&scan); | ||||
| 		    regstack.ga_len -= sizeof(regstar_T); | ||||
| 		    status = RA_NOMATCH; | ||||
| 		} | ||||
| @ -5000,7 +5013,6 @@ regmatch(scan) | ||||
|      */ | ||||
|     if (regstack.ga_len == 0 || status == RA_FAIL) | ||||
|     { | ||||
| 	ga_clear(®stack); | ||||
| 	if (scan == NULL) | ||||
| 	{ | ||||
| 	    /* | ||||
| @ -5027,26 +5039,25 @@ regmatch(scan) | ||||
|  * Returns pointer to new item.  Returns NULL when out of memory. | ||||
|  */ | ||||
|     static regitem_T * | ||||
| regstack_push(regstack, state, scan) | ||||
|     garray_T	*regstack; | ||||
| regstack_push(state, scan) | ||||
|     regstate_T	state; | ||||
|     char_u	*scan; | ||||
| { | ||||
|     regitem_T	*rp; | ||||
|  | ||||
|     if ((long)((unsigned)regstack->ga_len >> 10) >= p_mmp) | ||||
|     if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) | ||||
|     { | ||||
| 	EMSG(_(e_maxmempat)); | ||||
| 	return NULL; | ||||
|     } | ||||
|     if (ga_grow(regstack, sizeof(regitem_T)) == FAIL) | ||||
|     if (ga_grow(®stack, sizeof(regitem_T)) == FAIL) | ||||
| 	return NULL; | ||||
|  | ||||
|     rp = (regitem_T *)((char *)regstack->ga_data + regstack->ga_len); | ||||
|     rp = (regitem_T *)((char *)regstack.ga_data + regstack.ga_len); | ||||
|     rp->rs_state = state; | ||||
|     rp->rs_scan = scan; | ||||
|  | ||||
|     regstack->ga_len += sizeof(regitem_T); | ||||
|     regstack.ga_len += sizeof(regitem_T); | ||||
|     return rp; | ||||
| } | ||||
|  | ||||
| @ -5054,16 +5065,15 @@ regstack_push(regstack, state, scan) | ||||
|  * Pop an item from the regstack. | ||||
|  */ | ||||
|     static void | ||||
| regstack_pop(regstack, scan) | ||||
|     garray_T	*regstack; | ||||
| regstack_pop(scan) | ||||
|     char_u	**scan; | ||||
| { | ||||
|     regitem_T	*rp; | ||||
|  | ||||
|     rp = (regitem_T *)((char *)regstack->ga_data + regstack->ga_len) - 1; | ||||
|     rp = (regitem_T *)((char *)regstack.ga_data + regstack.ga_len) - 1; | ||||
|     *scan = rp->rs_scan; | ||||
|  | ||||
|     regstack->ga_len -= sizeof(regitem_T); | ||||
|     regstack.ga_len -= sizeof(regitem_T); | ||||
| } | ||||
|  | ||||
| /* | ||||
|  | ||||
| @ -23,7 +23,8 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ | ||||
| 		test33.out test34.out test35.out test36.out test37.out \ | ||||
| 		test38.out test39.out test40.out test41.out test42.out \ | ||||
| 		test43.out test44.out test45.out test46.out test47.out \ | ||||
| 		test48.out test51.out test53.out test54.out test55.out | ||||
| 		test48.out test51.out test53.out test54.out test55.out \ | ||||
| 		test56.out | ||||
|  | ||||
| .SUFFIXES: .in .out | ||||
|  | ||||
| @ -98,3 +99,4 @@ test51.out: test51.in | ||||
| test53.out: test53.in | ||||
| test54.out: test54.in | ||||
| test55.out: test55.in | ||||
| test56.out: test56.in | ||||
|  | ||||
| @ -17,7 +17,8 @@ SCRIPTS16 =	test1.out test19.out test20.out test22.out \ | ||||
| 		test23.out test24.out test28.out test29.out \ | ||||
| 		test35.out test36.out test43.out \ | ||||
| 		test44.out test45.out test46.out test47.out \ | ||||
| 		test48.out test51.out test53.out test54.out test55.out | ||||
| 		test48.out test51.out test53.out test54.out \ | ||||
| 		test55.out test56.out | ||||
|  | ||||
| SCRIPTS =	test3.out test4.out test5.out test6.out test7.out \ | ||||
| 		test8.out test9.out test11.out test13.out test14.out \ | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| " Vim script language tests | ||||
| " Author:	Servatius Brandt <Servatius.Brandt@fujitsu-siemens.com> | ||||
| " Last Change:	2005 Feb 03 | ||||
| " Last Change:	2005 May 18 | ||||
|  | ||||
| "------------------------------------------------------------------------------- | ||||
| " Test environment							    {{{1 | ||||
|  | ||||
| @ -36,5 +36,5 @@ | ||||
| #define VIM_VERSION_NODOT	"vim70aa" | ||||
| #define VIM_VERSION_SHORT	"7.0aa" | ||||
| #define VIM_VERSION_MEDIUM	"7.0aa ALPHA" | ||||
| #define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2005 Apr 24)" | ||||
| #define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2005 Apr 24, compiled " | ||||
| #define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2005 May 18)" | ||||
| #define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2005 May 18, compiled " | ||||
|  | ||||
		Reference in New Issue
	
	Block a user