[gobject-introspection] scanner: fix line number counting



commit bbbf8e9bc016b1be1bbc0b21aa653f9451a5d944
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date:   Sun Dec 27 13:11:40 2015 +0100

    scanner: fix line number counting
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752047

 giscanner/scannerlexer.l |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/giscanner/scannerlexer.l b/giscanner/scannerlexer.l
index d6c5e65..21ef570 100644
--- a/giscanner/scannerlexer.l
+++ b/giscanner/scannerlexer.l
@@ -88,18 +88,18 @@ stringtext                          ([^\\\"])|(\\.)
 
 "#define "[a-zA-Z_][a-zA-Z_0-9]*"("    { yyless (yyleng - 1); return FUNCTION_MACRO; }
 "#define "[a-zA-Z_][a-zA-Z_0-9]*       { return OBJECT_MACRO; }
-"#ifdef"[\t ]+"__GI_SCANNER__"[\t ]?.*"\n" { return IFDEF_GI_SCANNER; }
-"#ifndef"[\t ]+"__GI_SCANNER__"[\t ]?.*"\n" { return IFNDEF_GI_SCANNER; }
-"#ifndef ".*"\n"                       { return IFNDEF_COND; }
-"#ifdef ".*"\n"                                { return IFDEF_COND; }
-"#if ".*"\n"                           { return IF_COND; }
-"#elif ".*"\n"                         { return ELIF_COND; }
-"#else".*"\n"                          { return ELSE_COND; }
-"#endif".*"\n"                         { return ENDIF_COND; }
-"#pragma ".*"\n"                       { /* Ignore pragma. */ }
-
-"# "[0-9]+" ".*"\n"                    { process_linemarks(scanner, FALSE); }
-"#line "[0-9]+" ".*"\n"                        { process_linemarks(scanner, TRUE); }
+"#ifdef"[\t ]+"__GI_SCANNER__"[\t ]?.*"\n" { ++lineno; return IFDEF_GI_SCANNER; }
+"#ifndef"[\t ]+"__GI_SCANNER__"[\t ]?.*"\n" { ++lineno; return IFNDEF_GI_SCANNER; }
+"#ifndef ".*"\n"                       { ++lineno; return IFNDEF_COND; }
+"#ifdef ".*"\n"                                { ++lineno; return IFDEF_COND; }
+"#if ".*"\n"                           { ++lineno; return IF_COND; }
+"#elif ".*"\n"                         { ++lineno; return ELIF_COND; }
+"#else".*"\n"                          { ++lineno; return ELSE_COND; }
+"#endif".*"\n"                         { ++lineno; return ENDIF_COND; }
+"#pragma ".*"\n"                       { ++lineno; /* Ignore pragma. */ }
+
+"# "[0-9]+" ".*"\n"                    { ++lineno; process_linemarks(scanner, FALSE); }
+"#line "[0-9]+" ".*"\n"                        { ++lineno; process_linemarks(scanner, TRUE); }
 "#"                                    { }
 "{"                                    { return '{'; }
 "<%"                                   { return '{'; }
@@ -173,7 +173,7 @@ stringtext                          ([^\\\"])|(\\.)
 "__volatile"                           { return VOLATILE; }
 "__volatile__"                         { return VOLATILE; }
 "_Bool"                                        { return BOOL; }
-"typedef char __static_assert_t".*"\n" { /* Ignore */ }
+"typedef char __static_assert_t".*"\n" { ++lineno; /* Ignore */ }
 "__cdecl"                              { /* Ignore */ }
 "__declspec(deprecated(".*"))"         { /* Ignore */ }
 "__declspec"[\t ]*"("[a-z\t ]+")"      { /* Ignore */ }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]