avoid more casts of type structs
[cparser] / ast_t.h
diff --git a/ast_t.h b/ast_t.h
index b893982..f7598b8 100644 (file)
--- a/ast_t.h
+++ b/ast_t.h
@@ -2,6 +2,7 @@
 #define AST_T_H
 
 #include <libfirm/firm_types.h>
+#include <assert.h>
 
 #include "ast.h"
 #include "symbol.h"
@@ -47,7 +48,7 @@ struct expression_t {
 struct const_t {
        expression_t  expression;
        union {
-               int         int_value;
+               long long   int_value;
                long double float_value;
        } v;
 };
@@ -153,6 +154,7 @@ struct array_access_expression_t {
        expression_t  expression;
        expression_t *array_ref;
        expression_t *index;
+       bool          flipped; /* index/ref was written in a 5[a] way */
 };
 
 struct sizeof_expression_t {
@@ -217,21 +219,36 @@ typedef enum {
 typedef enum {
        INITIALIZER_VALUE,
        INITIALIZER_LIST,
+       INITIALIZER_STRING,
+       INITIALIZER_COUNT
 } initializer_type_t;
 
-struct initializer_t {
-       initializer_type_t  type;
+struct initializer_base_t {
+       initializer_type_t type;
 };
 
 struct initializer_value_t {
-       initializer_t initializer;
-       expression_t *value;
+       initializer_base_t  initializer;
+       expression_t       *value;
 };
 
 struct initializer_list_t {
-       initializer_t  initializer;
-       size_t         len;
-       initializer_t *initializers[];
+       initializer_base_t  initializer;
+       size_t              len;
+       initializer_t      *initializers[];
+};
+
+struct initializer_string_t {
+       initializer_base_t  initializer;
+       const char         *string;
+};
+
+union initializer_t {
+       initializer_type_t   type;
+       initializer_base_t   base;
+       initializer_value_t  value;
+       initializer_list_t   list;
+       initializer_string_t string;
 };
 
 struct declaration_t {
@@ -246,6 +263,7 @@ struct declaration_t {
                bool            is_defined;
                statement_t    *statement;
                initializer_t  *initializer;
+               expression_t   *enum_value;
        } init;
        context_t           context;
        context_t          *parent_context;
@@ -260,6 +278,7 @@ struct declaration_t {
                unsigned int    value_number;     /* used in ast2firm module */
                ir_entity      *entity;           /* used in ast2firm module */
                ir_node        *block;            /* used in ast2firm module */
+               tarval         *enum_val;         /* used in ast2firm module */
        } v;
 };
 
@@ -325,6 +344,7 @@ struct goto_statement_t {
 struct case_label_statement_t {
        statement_t   statement;
        expression_t *expression;
+       statement_t  *label_statement;
 };
 
 struct label_statement_t {