Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Mon, 20 Apr 2015 17:42:38 UTC Commit: 5bed3b58f337c95f7069ffbc9fbd23e83f55ad04 https://github.com/geany/geany/commit/5bed3b58f337c95f7069ffbc9fbd23e83f55ad...
Log Message: ----------- make: Support for variable expansions in target names
Modified Paths: -------------- tagmanager/ctags/make.c tests/ctags/Makefile.am tests/ctags/make-target-with-parentheses.mak tests/ctags/make-target-with-parentheses.mak.tags tests/ctags/simple.mak.tags
Modified: tagmanager/ctags/make.c 37 lines changed, 8 insertions(+), 29 deletions(-) =================================================================== @@ -70,7 +70,7 @@ static int skipToNonWhite (void)
static boolean isIdentifier (int c) { - return (boolean)(c != '\0' && (isalnum (c) || strchr (".-_/", c) != NULL)); + return (boolean)(c != '\0' && (isalnum (c) || strchr (".-_/$(){}", c) != NULL)); }
static boolean isSpecialTarget (vString *const name) @@ -118,14 +118,19 @@ static void newMacroFromDefine (vString *const name)
static void readIdentifier (const int first, vString *const id) { + int depth = 0; int c = first; int c_prev = first; int c_next = first; vStringClear (id); - while (isIdentifier (c) || c == ' ') + while (isIdentifier (c) || c == ' ' || (depth > 0 && c != EOF && c != '\n')) { c_next = nextChar (); - if (c == ' ') { + if (c == '(' || c == '}') + depth++; + else if (depth > 0 && (c == ')' || c == '}')) + depth--; + if (depth < 1 && c == ' ') { /* add the space character only if the previous and * next character are valid identifiers */ if (isIdentifier (c_prev) && isIdentifier (c_next)) @@ -141,28 +146,6 @@ static void readIdentifier (const int first, vString *const id) vStringTerminate (id); }
-static void skipToMatch (const char *const pair) -{ - const int begin = pair [0], end = pair [1]; - const unsigned long inputLineNumber = getInputLineNumber (); - int matchLevel = 1; - int c = '\0'; - - while (matchLevel > 0) - { - c = nextChar (); - if (c == begin) - ++matchLevel; - else if (c == end) - --matchLevel; - else if (c == '\n' || c == EOF) - break; - } - if (c == EOF) - verbose ("%s: failed to find match for '%c' at line %lu\n", - getInputFileName (), begin, inputLineNumber); -} - static void findMakeTags (void) { vString *name = vStringNew (); @@ -195,10 +178,6 @@ static void findMakeTags (void) continue; else if (c == '#') skipLine (); - else if (c == '(') - skipToMatch ("()"); - else if (c == '{') - skipToMatch ("{}"); else if (c == ':') { variable_possible = TRUE;
Modified: tests/ctags/Makefile.am 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -200,6 +200,7 @@ test_sources = \ line_directives.c \ local.c \ macros.c \ + make-target-with-parentheses.mak \ make-variable-on-cmdline.mak \ masm.asm \ matlab_backtracking.m \
Modified: tests/ctags/make-target-with-parentheses.mak 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1 @@ +$(obj)/raid6int1.c: F := 6
Modified: tests/ctags/make-target-with-parentheses.mak.tags 3 lines changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,3 @@ +# format=tagmanager +$(obj)/raid6int1.c�16�0 +F�65536�0
Modified: tests/ctags/simple.mak.tags 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -1,4 +1,5 @@ # format=tagmanager +$(obj)/raid6int1.c�16�0 A�65536�0 B�65536�0 C�65536�0
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).