This commit is contained in:
Jan Edmund Lazo 2018-08-11 14:32:56 -04:00
parent 5f4a231e3f
commit d624aea454
2 changed files with 26 additions and 20 deletions

View File

@ -2038,9 +2038,10 @@ static int nfa_regpiece(void)
break; break;
} /* end switch */ } /* end switch */
if (re_multi_type(peekchr()) != NOT_MULTI) if (re_multi_type(peekchr()) != NOT_MULTI) {
/* Can't have a multi follow a multi. */ // Can't have a multi follow a multi.
EMSG_RET_FAIL(_("E871: (NFA regexp) Can't have a multi follow a multi")); EMSG_RET_FAIL(_("E871: (NFA regexp) Can't have a multi follow a multi"));
}
return OK; return OK;
} }
@ -2453,7 +2454,8 @@ static void nfa_set_code(int c)
} }
static FILE *log_fd; static FILE *log_fd;
static char_u e_log_open_failed[] = N_("Could not open temporary log file for writing, displaying on stderr... "); static char_u e_log_open_failed[] = N_(
"Could not open temporary log file for writing, displaying on stderr... ");
/* /*
* Print the postfix notation of the current regexp. * Print the postfix notation of the current regexp.
@ -2466,10 +2468,11 @@ static void nfa_postfix_dump(char_u *expr, int retval)
f = fopen(NFA_REGEXP_DUMP_LOG, "a"); f = fopen(NFA_REGEXP_DUMP_LOG, "a");
if (f != NULL) { if (f != NULL) {
fprintf(f, "\n-------------------------\n"); fprintf(f, "\n-------------------------\n");
if (retval == FAIL) if (retval == FAIL) {
fprintf(f, ">>> NFA engine failed... \n"); fprintf(f, ">>> NFA engine failed... \n");
else if (retval == OK) } else if (retval == OK) {
fprintf(f, ">>> NFA engine succeeded !\n"); fprintf(f, ">>> NFA engine succeeded !\n");
}
fprintf(f, "Regexp: \"%s\"\nPostfix notation (char): \"", expr); fprintf(f, "Regexp: \"%s\"\nPostfix notation (char): \"", expr);
for (p = post_start; *p && p < post_ptr; p++) { for (p = post_start; *p && p < post_ptr; p++) {
nfa_set_code(*p); nfa_set_code(*p);
@ -5067,8 +5070,9 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start,
fprintf(log_fd, "------------------------------------------\n"); fprintf(log_fd, "------------------------------------------\n");
fprintf(log_fd, ">>> Reginput is \"%s\"\n", reginput); fprintf(log_fd, ">>> Reginput is \"%s\"\n", reginput);
fprintf(log_fd, fprintf(log_fd,
">>> Advanced one character... Current char is %c (code %d) \n", curc, ">>> Advanced one character... Current char is %c (code %d) \n",
(int)curc); curc,
(int)curc);
fprintf(log_fd, ">>> Thislist has %d states available: ", thislist->n); fprintf(log_fd, ">>> Thislist has %d states available: ", thislist->n);
{ {
int i; int i;
@ -5100,16 +5104,17 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start,
{ {
int col; int col;
if (t->subs.norm.in_use <= 0) if (t->subs.norm.in_use <= 0) {
col = -1; col = -1;
else if (REG_MULTI) } else if (REG_MULTI) {
col = t->subs.norm.list.multi[0].start_col; col = t->subs.norm.list.multi[0].start_col;
else } else {
col = (int)(t->subs.norm.list.line[0].start - regline); col = (int)(t->subs.norm.list.line[0].start - regline);
}
nfa_set_code(t->state->c); nfa_set_code(t->state->c);
fprintf(log_fd, "(%d) char %d %s (start col %d)%s... \n", fprintf(log_fd, "(%d) char %d %s (start col %d)%s... \n",
abs(t->state->id), (int)t->state->c, code, col, abs(t->state->id), (int)t->state->c, code, col,
pim_info(&t->pim)); pim_info(&t->pim));
} }
#endif #endif
@ -6263,8 +6268,9 @@ static long nfa_regtry(nfa_regprog_T *prog, colnr_T col, proftime_T *tm)
nfa_print_state(f, start); nfa_print_state(f, start);
fprintf(f, "\n\n"); fprintf(f, "\n\n");
fclose(f); fclose(f);
} else } else {
EMSG("Could not open temporary log file for writing"); EMSG("Could not open temporary log file for writing");
}
#endif #endif
clear_sub(&subs.norm); clear_sub(&subs.norm);
@ -6490,10 +6496,10 @@ static regprog_T *nfa_regcomp(char_u *expr, int re_flags)
FILE *f = fopen(NFA_REGEXP_RUN_LOG, "a"); FILE *f = fopen(NFA_REGEXP_RUN_LOG, "a");
if (f != NULL) { if (f != NULL) {
fprintf( fprintf(f,
f, "\n*****************************\n\n\n\n\t"
"\n*****************************\n\n\n\n\tCompiling regexp \"%s\"... hold on !\n", "Compiling regexp \"%s\"... hold on !\n",
expr); expr);
fclose(f); fclose(f);
} }
} }

View File

@ -3032,7 +3032,7 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
hash_init(&ht); hash_init(&ht);
vim_snprintf((char *)IObuff, IOSIZE, vim_snprintf((char *)IObuff, IOSIZE,
_("Reading dictionary file %s..."), fname); _("Reading dictionary file %s..."), fname);
spell_message(spin, IObuff); spell_message(spin, IObuff);
// start with a message for the first line // start with a message for the first line
@ -4998,7 +4998,7 @@ static void sug_write(spellinfo_T *spin, char_u *fname)
} }
vim_snprintf((char *)IObuff, IOSIZE, vim_snprintf((char *)IObuff, IOSIZE,
_("Writing suggestion file %s..."), fname); _("Writing suggestion file %s..."), fname);
spell_message(spin, IObuff); spell_message(spin, IObuff);
// <SUGHEADER>: <fileID> <versionnr> <timestamp> // <SUGHEADER>: <fileID> <versionnr> <timestamp>
@ -5234,7 +5234,7 @@ mkspell (
if (!error && !got_int) { if (!error && !got_int) {
// Write the info in the spell file. // Write the info in the spell file.
vim_snprintf((char *)IObuff, IOSIZE, vim_snprintf((char *)IObuff, IOSIZE,
_("Writing spell file %s..."), wfname); _("Writing spell file %s..."), wfname);
spell_message(&spin, IObuff); spell_message(&spin, IObuff);
error = write_vim_spell(&spin, wfname) == FAIL; error = write_vim_spell(&spin, wfname) == FAIL;