[gobject-introspection/gnome-42] giscanner: Support C99 designated initializers
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/gnome-42] giscanner: Support C99 designated initializers
- Date: Wed, 21 Sep 2022 12:31:13 +0000 (UTC)
commit 0358eaa6245d9003f0f5b44cd4ed6d0282853c51
Author: Jan Tojnar <jtojnar gmail com>
Date: Wed Aug 17 16:14:46 2022 +0200
giscanner: Support C99 designated initializers
https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
Based on
https://github.com/katef/kgt/blob/c9d8ad246855c6b65e42371be7898f4073c28d18/examples/c99-grammar.iso-ebnf#L247-L252
giscanner/scannerparser.y | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/giscanner/scannerparser.y b/giscanner/scannerparser.y
index e0709cde4..52fc19963 100644
--- a/giscanner/scannerparser.y
+++ b/giscanner/scannerparser.y
@@ -1406,8 +1406,23 @@ initializer
;
initializer_list
- : initializer
- | initializer_list ',' initializer
+ : initializer_list_item
+ | initializer_list ',' initializer_list_item
+ ;
+
+initializer_list_item
+ : designator_list '=' initializer
+ | initializer
+ ;
+
+designator_list
+ : designator
+ | designator_list designator
+ ;
+
+designator
+ : '[' constant_expression ']'
+ | '.' identifier
;
/* A.2.3 Statements. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]