diff options
author | Johan Dahlin <johan@gnome.org> | 2010-09-19 11:33:38 -0300 |
---|---|---|
committer | Johan Dahlin <johan@gnome.org> | 2010-09-19 12:04:20 -0300 |
commit | cb61330eb495786bf8232ebcb51b0d6d9a753ce7 (patch) | |
tree | 544f43868003c027ad127e497ba9f959da12da37 /giscanner/scannerlexer.l | |
parent | 9180641a496b26b5d5a720a2f2a61c710f094d2a (diff) | |
download | gobject-introspection-cb61330eb495786bf8232ebcb51b0d6d9a753ce7.tar.gz |
Save the line number of a source comment
Diffstat (limited to 'giscanner/scannerlexer.l')
-rw-r--r-- | giscanner/scannerlexer.l | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/giscanner/scannerlexer.l b/giscanner/scannerlexer.l index ff1ee0ff..4fa40f63 100644 --- a/giscanner/scannerlexer.l +++ b/giscanner/scannerlexer.l @@ -210,17 +210,21 @@ yywrap (void) static void parse_comment (GISourceScanner *scanner) { - GString *comment; + GString *string; int c1, c2; + GISourceComment *comment; + int comment_lineno; c1 = input(); c2 = input(); - comment = g_string_new (""); + string = g_string_new (""); + + comment_lineno = lineno; while (c2 != EOF && !(c1 == '*' && c2 == '/')) { - g_string_append_c (comment, c1); + g_string_append_c (string, c1); if (c1 == '\n') lineno++; @@ -230,8 +234,13 @@ parse_comment (GISourceScanner *scanner) } + comment = g_slice_new (GISourceComment); + comment->comment = g_string_free (string, FALSE); + comment->line = comment_lineno; + comment->filename = g_strdup(scanner->current_filename); + scanner->comments = g_slist_prepend (scanner->comments, - g_string_free (comment, FALSE)); + comment); } static int |