diff options
author | Johan Dahlin <jdahlin@async.com.br> | 2009-01-12 23:24:01 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2009-01-12 23:24:01 +0000 |
commit | 9256e916164ec557ed66f92a0d6d95bb286cdf8b (patch) | |
tree | e481541d55ca9eafb63684f2ee41d48096b8eac5 /giscanner/scannerparser.y | |
parent | e81c4681cc88a00fcd841c5a68d860d3714b55d7 (diff) | |
download | gobject-introspection-9256e916164ec557ed66f92a0d6d95bb286cdf8b.tar.gz |
Bug 563591 – Flags not recognized when there is no introspection data
2009-01-12 Johan Dahlin <jdahlin@async.com.br>
Bug 563591 – Flags not recognized when there is no introspection data
* giscanner/ast.py:
* giscanner/girwriter.py:
* giscanner/giscannermodule.c (type_get_is_bitfield):
* giscanner/glibast.py:
* giscanner/glibtransformer.py:
* giscanner/scannerparser.y:
* giscanner/sourcescanner.c (gi_source_type_copy):
* giscanner/sourcescanner.h:
* giscanner/sourcescanner.py:
* giscanner/transformer.py:
* tests/scanner/foo-1.0-expected.gir:
* tests/scanner/foo-1.0-expected.tgir:
* tests/scanner/foo.h:
Large parts of this patch was done by Jürg Billeter.
svn path=/trunk/; revision=1025
Diffstat (limited to 'giscanner/scannerparser.y')
-rw-r--r-- | giscanner/scannerparser.y | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/giscanner/scannerparser.y b/giscanner/scannerparser.y index 64cf11b3..dffe90e2 100644 --- a/giscanner/scannerparser.y +++ b/giscanner/scannerparser.y @@ -46,6 +46,7 @@ static void yyerror (GISourceScanner *scanner, const char *str); extern void ctype_free (GISourceType * type); static int last_enum_value = -1; +static gboolean is_bitfield; static GHashTable *const_table = NULL; %} @@ -381,6 +382,12 @@ shift_expression $$ = gi_source_symbol_new (CSYMBOL_TYPE_CONST); $$->const_int_set = TRUE; $$->const_int = $1->const_int << $3->const_int; + + /* assume this is a bitfield/flags declaration + * if a left shift operator is sued in an enum value + * This mimics the glib-mkenum behavior. + */ + is_bitfield = TRUE; } | shift_expression SR additive_expression { @@ -818,24 +825,28 @@ enum_specifier { $$ = gi_source_enum_new ($2); $$->child_list = $4; + $$->is_bitfield = is_bitfield; last_enum_value = -1; } | ENUM '{' enumerator_list '}' { $$ = gi_source_enum_new (NULL); $$->child_list = $3; + $$->is_bitfield = is_bitfield; last_enum_value = -1; } | ENUM identifier_or_typedef_name '{' enumerator_list ',' '}' { $$ = gi_source_enum_new ($2); $$->child_list = $4; + $$->is_bitfield = is_bitfield; last_enum_value = -1; } | ENUM '{' enumerator_list ',' '}' { $$ = gi_source_enum_new (NULL); $$->child_list = $3; + $$->is_bitfield = is_bitfield; last_enum_value = -1; } | ENUM identifier_or_typedef_name @@ -845,9 +856,14 @@ enum_specifier ; enumerator_list - : enumerator + : { - $$ = g_list_append (NULL, $1); + /* reset flag before the first enum value */ + is_bitfield = FALSE; + } + enumerator + { + $$ = g_list_append (NULL, $2); } | enumerator_list ',' enumerator { |