From: Jamie McCracken Date: Sun, 23 Aug 2009 04:03:46 +0000 (-0400) Subject: Fix scanning of case where single line comments are appended to end of a line X-Git-Tag: 0.7.6~171 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1382bccbdf331238fbae094835942fcd140887a0;p=thirdparty%2Fvala.git Fix scanning of case where single line comments are appended to end of a line Fixes GNOME Bug 592369 - compiler is complaining about indentation if there are comments --- diff --git a/vala/valageniescanner.vala b/vala/valageniescanner.vala index d28ff761a..ecbb426a4 100644 --- a/vala/valageniescanner.vala +++ b/vala/valageniescanner.vala @@ -1040,13 +1040,16 @@ public class Vala.Genie.Scanner { // single-line comment current += 2; char* begin = current; + // skip until end of line or end of file while (current < end && current[0] != '\n') { current++; } + push_comment (((string) begin).ndup ((long) (current - begin)), line == 1); - if (current[0] == '\n') { + /* do not ignore EOL if comment does not exclusively occupy the line */ + if (current[0] == '\n' && last_token == TokenType.EOL) { current++; line++; column = 1;