diff --git a/tagmanager/ctags/php.c b/tagmanager/ctags/php.c index 623bd25f..ffc23d71 100644 --- a/tagmanager/ctags/php.c +++ b/tagmanager/ctags/php.c @@ -672,9 +672,15 @@ static keywordId analyzeToken (vString *const name, langType language) return result; } +static boolean isSpace (int c) +{ + return (c == '\t' || c == ' ' || c == '\v' || + c == '\n' || c == '\r' || c == '\f'); +} + static int skipWhitespaces (int c) { - while (c == '\t' || c == ' ' || c == '\n' || c == '\r') + while (isSpace (c)) c = fileGetc (); return c; } @@ -695,10 +701,7 @@ static boolean isOpenScriptLanguagePhp (int c) tolower ((c = fileGetc ())) != 'i' || tolower ((c = fileGetc ())) != 'p' || tolower ((c = fileGetc ())) != 't' || - ((c = fileGetc ()) != '\t' && - c != ' ' && - c != '\n' && - c != '\r') || + ! isSpace ((c = fileGetc ())) || tolower ((c = skipWhitespaces (c))) != 'l' || tolower ((c = fileGetc ())) != 'a' || tolower ((c = fileGetc ())) != 'n' || @@ -806,10 +809,7 @@ getNextChar: else c = fileGetc (); - while (c == '\t' || c == ' ' || c == '\n' || c == '\r') - { - c = fileGetc (); - } + c = skipWhitespaces (c); token->lineNumber = getSourceLineNumber (); token->filePosition = getInputFilePosition (); diff --git a/tests/ctags/Makefile.am b/tests/ctags/Makefile.am index bf253ebb..5270b624 100644 --- a/tests/ctags/Makefile.am +++ b/tests/ctags/Makefile.am @@ -231,6 +231,7 @@ test_sources = \ traits.php \ union.f \ value.f \ + whitespaces.php \ $(NULL) test_results = $(test_sources:=.tags) diff --git a/tests/ctags/whitespaces.php b/tests/ctags/whitespaces.php new file mode 100644 index 00000000..ea7978dd --- /dev/null +++ b/tests/ctags/whitespaces.php @@ -0,0 +1,34 @@ +