From 491bbbffc6152e6e9f473f3d0d7be7f497d47b81 Mon Sep 17 00:00:00 2001 From: ketmar Date: Tue, 4 Nov 2014 07:01:44 +0200 Subject: [PATCH] workaround for buggy re9 --- src/headers.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/headers.c b/src/headers.c index 36fe01d..0e6128c 100644 --- a/src/headers.c +++ b/src/headers.c @@ -155,9 +155,9 @@ LIST *headers1 (const char *file, LIST *hdrscan) { } */ if (dlang) { - re[rec++] = regexp_compile("\\bimport\\s+(.+?)\\s*;", 0); - re[rec++] = regexp_compile("\\bimport\\s*\\((.+?)\\)", 0); - re_dlinc = regexp_compile("\\s*([^,;]+?)\\s*", 0); + re[rec++] = regexp_compile("\\bimport\\s+([^;]+)\\s*;", 0); // don't use ".+n?;", it's buggy + re[rec++] = regexp_compile("\\bimport\\s*\\(([^)]+)\\)", 0); + re_dlinc = regexp_compile("\\s*([^,;]+)\\s*", 0); } if (!dlang) { while (rec < MAXINC && hdrscan) { @@ -186,12 +186,14 @@ LIST *headers1 (const char *file, LIST *hdrscan) { if (i == 0) { /* this is DLang 'import' directive */ const char *s = dstr_cstr(&buf2); + //fprintf(stderr, "=== %d; [%s]\n", l, dstr_cstr(&buf2)); while (*s) { char *p, *t; if (!regexp_execute(re_dlinc, s, mt, 2) || mt[1].sp == NULL) break; dstr_set_buf(&buf3, mt[1].sp, mt[1].ep-mt[1].sp); dstr_push_cstr(&buf3, ".d"); p = dstr_cstr(&buf3); + //fprintf(stderr, "*** [%s]\n", dstr_cstr(&buf3)); if ((t = strchr(p, ':')) != NULL) *t = 0; if ((t = strchr(p, '=')) != NULL) p = t+1; while (*p && isspace(*p)) ++p; @@ -202,6 +204,7 @@ LIST *headers1 (const char *file, LIST *hdrscan) { } if (*p) { for (t = p; *t; ++t) if (*t == '.') *t = '/'; + //fprintf(stderr, "+++ [%s]\n", dstr_cstr(&buf3)); *(strrchr(p, '/')) = '.'; // restore '.d' //fprintf(stderr, "dlang include: [%s]\n", p); result = list_new(result, p, 0); -- 2.11.4.GIT