summaryrefslogtreecommitdiff
path: root/giscanner/scannerparser.y
diff options
context:
space:
mode:
authorAndreas Rottmann <a.rottmann@gmx.at>2010-12-07 00:18:15 +0100
committerAndreas Rottmann <a.rottmann@gmx.at>2010-12-07 00:18:15 +0100
commitd85dbebee2c565a911c79dd199f0e70020f2918a (patch)
tree8e6c4f829c61b6d40647a53f1ed31bf2a81b1a81 /giscanner/scannerparser.y
parentf135e6f2f81e9dd52385cb1449779ef420c950c3 (diff)
downloadgobject-introspection-d85dbebee2c565a911c79dd199f0e70020f2918a.tar.gz
Support glib-mkenums comment /*< flags >*/
- Modify the lexer to consider all "trigraph" comments specially, and parse them for "flags" as well as "private" and "public" (which were previously hardcoded). This change allows for future support of multiple annotations inside a single trigraph comment. - Change the parser to consider the additional field "flags" set by the lexer when constructing enums. - Add a test case for the "flags" trigraph comment to the scanner annotation tests. See <https://bugzilla.gnome.org/show_bug.cgi?id=631530>.
Diffstat (limited to 'giscanner/scannerparser.y')
-rw-r--r--giscanner/scannerparser.y31
1 files changed, 17 insertions, 14 deletions
diff --git a/giscanner/scannerparser.y b/giscanner/scannerparser.y
index bac20980..fc4a2850 100644
--- a/giscanner/scannerparser.y
+++ b/giscanner/scannerparser.y
@@ -910,45 +910,48 @@ struct_declarator
;
enum_specifier
- : ENUM identifier_or_typedef_name '{' enumerator_list '}'
+ : enum_keyword identifier_or_typedef_name '{' enumerator_list '}'
{
- scanner->private = FALSE;
$$ = gi_source_enum_new ($2);
$$->child_list = $4;
- $$->is_bitfield = is_bitfield;
+ $$->is_bitfield = is_bitfield || scanner->flags;
last_enum_value = -1;
}
- | ENUM '{' enumerator_list '}'
+ | enum_keyword '{' enumerator_list '}'
{
- scanner->private = FALSE;
$$ = gi_source_enum_new (NULL);
$$->child_list = $3;
- $$->is_bitfield = is_bitfield;
+ $$->is_bitfield = is_bitfield || scanner->flags;
last_enum_value = -1;
}
- | ENUM identifier_or_typedef_name '{' enumerator_list ',' '}'
+ | enum_keyword identifier_or_typedef_name '{' enumerator_list ',' '}'
{
- scanner->private = FALSE;
$$ = gi_source_enum_new ($2);
$$->child_list = $4;
- $$->is_bitfield = is_bitfield;
+ $$->is_bitfield = is_bitfield || scanner->flags;
last_enum_value = -1;
}
- | ENUM '{' enumerator_list ',' '}'
+ | enum_keyword '{' enumerator_list ',' '}'
{
- scanner->private = FALSE;
$$ = gi_source_enum_new (NULL);
$$->child_list = $3;
- $$->is_bitfield = is_bitfield;
+ $$->is_bitfield = is_bitfield || scanner->flags;
last_enum_value = -1;
}
- | ENUM identifier_or_typedef_name
+ | enum_keyword identifier_or_typedef_name
{
- scanner->private = FALSE;
$$ = gi_source_enum_new ($2);
}
;
+enum_keyword
+ : ENUM
+ {
+ scanner->flags = FALSE;
+ scanner->private = FALSE;
+ }
+ ;
+
enumerator_list
:
{