Mercurial > vim
comparison src/regexp.c @ 4460:fe8a0a6a1c2a v7.3.978
updated for version 7.3.978
Problem: Regexp debug logs don't have a good name.
Solution: Use clear names and make it possible to write logs for the old and
new engines separately. (Taro Muraoka)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Mon, 20 May 2013 21:49:13 +0200 |
parents | ccecb03e5e8b |
children | 4ff8fa416a0d |
comparison
equal
deleted
inserted
replaced
4459:ad0f082ea18e | 4460:fe8a0a6a1c2a |
---|---|
49 #ifdef DEBUG | 49 #ifdef DEBUG |
50 /* show/save debugging data when BT engine is used */ | 50 /* show/save debugging data when BT engine is used */ |
51 # define BT_REGEXP_DUMP | 51 # define BT_REGEXP_DUMP |
52 /* save the debugging data to a file instead of displaying it */ | 52 /* save the debugging data to a file instead of displaying it */ |
53 # define BT_REGEXP_LOG | 53 # define BT_REGEXP_LOG |
54 # define BT_REGEXP_DEBUG_LOG | |
55 # define BT_REGEXP_DEBUG_LOG_NAME "bt_regexp_debug.log" | |
54 #endif | 56 #endif |
55 | 57 |
56 /* | 58 /* |
57 * The "internal use only" fields in regexp.h are present to pass info from | 59 * The "internal use only" fields in regexp.h are present to pass info from |
58 * compile to execute that permits the execute phase to run lots faster on | 60 * compile to execute that permits the execute phase to run lots faster on |
7826 else | 7828 else |
7827 prog = bt_regengine.regcomp(expr, re_flags); | 7829 prog = bt_regengine.regcomp(expr, re_flags); |
7828 | 7830 |
7829 if (prog == NULL) /* error compiling regexp with initial engine */ | 7831 if (prog == NULL) /* error compiling regexp with initial engine */ |
7830 { | 7832 { |
7831 #ifdef DEBUG | 7833 #ifdef BT_REGEXP_DEBUG_LOG |
7832 if (regexp_engine != BACKTRACKING_ENGINE) /* debugging log for NFA */ | 7834 if (regexp_engine != BACKTRACKING_ENGINE) /* debugging log for NFA */ |
7833 { | 7835 { |
7834 FILE *f; | 7836 FILE *f; |
7835 f = fopen("debug.log", "a"); | 7837 f = fopen(BT_REGEXP_DEBUG_LOG_NAME, "a"); |
7836 if (f) | 7838 if (f) |
7837 { | 7839 { |
7838 if (!syntax_error) | 7840 if (!syntax_error) |
7839 fprintf(f, "NFA engine could not handle \"%s\"\n", expr); | 7841 fprintf(f, "NFA engine could not handle \"%s\"\n", expr); |
7840 else | 7842 else |
7841 fprintf(f, "Syntax error in \"%s\"\n", expr); | 7843 fprintf(f, "Syntax error in \"%s\"\n", expr); |
7842 fclose(f); | 7844 fclose(f); |
7843 } | 7845 } |
7844 else | 7846 else |
7845 EMSG("(NFA) Could not open \"debug.log\" to write !!!"); | 7847 EMSG2("(NFA) Could not open \"%s\" to write !!!", |
7848 BT_REGEXP_DEBUG_LOG_NAME); | |
7846 /* | 7849 /* |
7847 if (syntax_error) | 7850 if (syntax_error) |
7848 EMSG("NFA Regexp: Syntax Error !"); | 7851 EMSG("NFA Regexp: Syntax Error !"); |
7849 */ | 7852 */ |
7850 } | 7853 } |