diff options
author | Dieter Verfaillie <dieterv@optionexplicit.be> | 2015-12-27 13:11:40 +0100 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2015-12-27 10:50:35 -0500 |
commit | bbbf8e9bc016b1be1bbc0b21aa653f9451a5d944 (patch) | |
tree | 4c3d56c4c2ac00ac006a3684dc4a5d1265e355a9 | |
parent | f7b2e1c5e948bfabb7c51eb73d42689bced6cb79 (diff) | |
download | gobject-introspection-bbbf8e9bc016b1be1bbc0b21aa653f9451a5d944.tar.gz |
scanner: fix line number counting
https://bugzilla.gnome.org/show_bug.cgi?id=752047
-rw-r--r-- | giscanner/scannerlexer.l | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/giscanner/scannerlexer.l b/giscanner/scannerlexer.l index d6c5e659..21ef5701 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 */ } |