Lines Matching refs:prog
2940 nfa_dump(nfa_regprog_T *prog) in nfa_dump() argument
2946 nfa_print_state(debugf, prog->start); in nfa_dump()
2948 if (prog->reganch) in nfa_dump()
2949 fprintf(debugf, "reganch: %d\n", prog->reganch); in nfa_dump()
2950 if (prog->regstart != NUL) in nfa_dump()
2952 prog->regstart, prog->regstart); in nfa_dump()
2953 if (prog->match_text != NULL) in nfa_dump()
2954 fprintf(debugf, "match_text: \"%s\"\n", prog->match_text); in nfa_dump()
3928 nfa_postprocess(nfa_regprog_T *prog) in nfa_postprocess() argument
3933 for (i = 0; i < prog->nstate; ++i) in nfa_postprocess()
3935 c = prog->state[i].c; in nfa_postprocess()
3945 if (match_follows(prog->state[i].out1->out, 0)) in nfa_postprocess()
3949 int ch_invisible = failure_chance(prog->state[i].out, 0); in nfa_postprocess()
3950 int ch_follows = failure_chance(prog->state[i].out1->out, 0); in nfa_postprocess()
3961 if (prog->state[i].val <= 0 && ch_follows > 0) in nfa_postprocess()
3975 ++prog->state[i].c; in nfa_postprocess()
5235 nfa_save_listids(nfa_regprog_T *prog, int *list) in nfa_save_listids() argument
5241 p = &prog->state[0]; in nfa_save_listids()
5242 for (i = prog->nstate; --i >= 0; ) in nfa_save_listids()
5254 nfa_restore_listids(nfa_regprog_T *prog, int *list) in nfa_restore_listids() argument
5259 p = &prog->state[0]; in nfa_restore_listids()
5260 for (i = prog->nstate; --i >= 0; ) in nfa_restore_listids()
5275 static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *submatch, regsubs_T *m);
5286 nfa_regprog_T *prog, in recursive_regmatch() argument
5390 if (*listids == NULL || *listids_len < prog->nstate) in recursive_regmatch()
5393 *listids = ALLOC_MULT(int, prog->nstate); in recursive_regmatch()
5399 *listids_len = prog->nstate; in recursive_regmatch()
5401 nfa_save_listids(prog, *listids); in recursive_regmatch()
5418 result = nfa_regmatch(prog, state->out, submatch, m); in recursive_regmatch()
5421 nfa_restore_listids(prog, *listids); in recursive_regmatch()
5728 nfa_regprog_T *prog, in nfa_regmatch() argument
5775 size = (prog->nstate + 1) * sizeof(nfa_thread_T); in nfa_regmatch()
5778 list[0].len = prog->nstate + 1; in nfa_regmatch()
5780 list[1].len = prog->nstate + 1; in nfa_regmatch()
5870 if (prog->re_engine == AUTOMATIC_ENGINE in nfa_regmatch()
6076 result = recursive_regmatch(t->state, NULL, prog, in nfa_regmatch()
6198 result = recursive_regmatch(t->state, NULL, prog, in nfa_regmatch()
6969 prog, submatch, m, &listids, &listids_len); in nfa_regmatch()
7082 if (prog->regstart != NUL && clen != 0) in nfa_regmatch()
7090 if (skip_to_start(prog->regstart, &col) == FAIL) in nfa_regmatch()
7103 if (c != prog->regstart && (!rex.reg_ic in nfa_regmatch()
7104 || MB_CASEFOLD(c) != MB_CASEFOLD(prog->regstart))) in nfa_regmatch()
7200 nfa_regprog_T *prog, in nfa_regtry() argument
7207 nfa_state_T *start = prog->start; in nfa_regtry()
7245 result = nfa_regmatch(prog, start, &subs, &m); in nfa_regtry()
7297 if (prog->reghasz == REX_SET) in nfa_regtry()
7347 nfa_regprog_T *prog; in nfa_regexec_both() local
7354 prog = (nfa_regprog_T *)rex.reg_mmatch->regprog; in nfa_regexec_both()
7361 prog = (nfa_regprog_T *)rex.reg_match->regprog; in nfa_regexec_both()
7367 if (prog == NULL || line == NULL) in nfa_regexec_both()
7374 if (prog->regflags & RF_ICASE) in nfa_regexec_both()
7376 else if (prog->regflags & RF_NOICASE) in nfa_regexec_both()
7380 if (prog->regflags & RF_ICOMBINE) in nfa_regexec_both()
7386 rex.nfa_has_zend = prog->has_zend; in nfa_regexec_both()
7387 rex.nfa_has_backref = prog->has_backref; in nfa_regexec_both()
7388 rex.nfa_nsubexpr = prog->nsubexp; in nfa_regexec_both()
7392 nfa_regengine.expr = prog->pattern; in nfa_regexec_both()
7395 if (prog->reganch && col > 0) in nfa_regexec_both()
7401 if (prog->reghasz == REX_SET) in nfa_regexec_both()
7413 if (prog->regstart != NUL) in nfa_regexec_both()
7417 if (skip_to_start(prog->regstart, &col) == FAIL) in nfa_regexec_both()
7422 if (prog->match_text != NULL && !rex.reg_icombine) in nfa_regexec_both()
7423 return find_match_text(col, prog->regstart, prog->match_text); in nfa_regexec_both()
7433 for (i = 0; i < prog->nstate; ++i) in nfa_regexec_both()
7435 prog->state[i].id = i; in nfa_regexec_both()
7436 prog->state[i].lastlist[0] = 0; in nfa_regexec_both()
7437 prog->state[i].lastlist[1] = 0; in nfa_regexec_both()
7440 retval = nfa_regtry(prog, col, tm, timed_out); in nfa_regexec_both()
7477 nfa_regprog_T *prog = NULL; in nfa_regcomp() local
7525 prog = alloc(prog_size); in nfa_regcomp()
7526 if (prog == NULL) in nfa_regcomp()
7528 state_ptr = prog->state; in nfa_regcomp()
7529 prog->re_in_use = FALSE; in nfa_regcomp()
7535 prog->start = post2nfa(postfix, post_ptr, FALSE); in nfa_regcomp()
7536 if (prog->start == NULL) in nfa_regcomp()
7539 prog->regflags = regflags; in nfa_regcomp()
7540 prog->engine = &nfa_regengine; in nfa_regcomp()
7541 prog->nstate = nstate; in nfa_regcomp()
7542 prog->has_zend = rex.nfa_has_zend; in nfa_regcomp()
7543 prog->has_backref = rex.nfa_has_backref; in nfa_regcomp()
7544 prog->nsubexp = regnpar; in nfa_regcomp()
7546 nfa_postprocess(prog); in nfa_regcomp()
7548 prog->reganch = nfa_get_reganch(prog->start, 0); in nfa_regcomp()
7549 prog->regstart = nfa_get_regstart(prog->start, 0); in nfa_regcomp()
7550 prog->match_text = nfa_get_match_text(prog->start); in nfa_regcomp()
7554 nfa_dump(prog); in nfa_regcomp()
7558 prog->reghasz = re_has_z; in nfa_regcomp()
7560 prog->pattern = vim_strsave(expr); in nfa_regcomp()
7569 return (regprog_T *)prog; in nfa_regcomp()
7572 VIM_CLEAR(prog); in nfa_regcomp()
7586 nfa_regfree(regprog_T *prog) in nfa_regfree() argument
7588 if (prog != NULL) in nfa_regfree()
7590 vim_free(((nfa_regprog_T *)prog)->match_text); in nfa_regfree()
7591 vim_free(((nfa_regprog_T *)prog)->pattern); in nfa_regfree()
7592 vim_free(prog); in nfa_regfree()