Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Fri, 14 Feb 2014 23:33:05 UTC Commit: 497bfaed465ac3aa3baf394029189a01a043ff2e https://github.com/geany/geany/commit/497bfaed465ac3aa3baf394029189a01a043ff...
Log Message: ----------- Fortran: fix line continuation inside comments
Fix improperly handling '&' at the end of the first comment line after a non-comment line as a line continuation.
Part of bug #1023.
Modified Paths: -------------- tagmanager/ctags/fortran.c tests/ctags/Makefile.am tests/ctags/fortran_line_continuation.f90 tests/ctags/fortran_line_continuation.f90.tags
Modified: tagmanager/ctags/fortran.c 8 files changed, 4 insertions(+), 4 deletions(-) =================================================================== @@ -698,7 +698,7 @@ static int skipToNextLine (void) return c; }
-static int getFreeFormChar (void) +static int getFreeFormChar (boolean inComment) { static boolean newline = TRUE; boolean advanceLine = FALSE; @@ -708,7 +708,7 @@ static int getFreeFormChar (void) * free-format text line is an ampersand then the next non-comment * line is a continuation line. */ - if (c == '&') + if (! inComment && c == '&') { do c = fileGetc (); @@ -757,7 +757,7 @@ static int getChar (void) Ungetc = '\0'; } else if (FreeSourceForm) - c = getFreeFormChar (); + c = getFreeFormChar (FALSE); else c = getFixedFormChar (); return c; @@ -992,7 +992,7 @@ static void readToken (tokenInfo *const token) if (FreeSourceForm) { do - c = getChar (); + c = getFreeFormChar (TRUE); while (c != '\n' && c != EOF); } else
Modified: tests/ctags/Makefile.am 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -127,6 +127,7 @@ test_sources = \ forall_module.f90 \ format.pl \ fortran_associate.f90 \ + fortran_line_continuation.f90 \ func_typedef.h \ general.cs \ hex2dec.sql \
Modified: tests/ctags/fortran_line_continuation.f90 17 files changed, 17 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,17 @@ +! this is a comment and continuation must not be handled in it & +! this is another line of comment + +#if dummy +function & + ! just a test for support of comments after a line continuation + ! below is a preprocessor line, also just to test continuation + #endif + ! still testing +& do_stuff(a) +end function do_stuff + +function & + ! actually the ampersand isn't required at the start of the continuation line + #pragma stuff +do_stuff_again(b) +end function do_stuff_again
Modified: tests/ctags/fortran_line_continuation.f90.tags 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,3 @@ +# format=tagmanager +do_stuffÌ16Ö0 +do_stuff_againÌ16Ö0
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).