Next wchar_t step: Initialization with wide string literals.
[cparser] / ast_t.h
diff --git a/ast_t.h b/ast_t.h
index 5e2819b..1f67819 100644 (file)
--- a/ast_t.h
+++ b/ast_t.h
@@ -18,6 +18,7 @@ typedef enum {
        EXPR_REFERENCE,
        EXPR_CONST,
        EXPR_STRING_LITERAL,
+       EXPR_WIDE_STRING_LITERAL,
        EXPR_CALL,
        EXPR_UNARY,
        EXPR_BINARY,
@@ -33,16 +34,16 @@ typedef enum {
        EXPR_OFFSETOF,
        EXPR_VA_ARG,
        EXPR_STATEMENT
-} expresion_type_t;
+} expression_type_t;
 
 struct context_t {
        declaration_t   *declarations;
 };
 
 struct expression_base_t {
-       expresion_type_t   type;
-       type_t            *datatype;
-       source_position_t  source_position;
+       expression_type_t   type;
+       type_t             *datatype;
+       source_position_t   source_position;
 };
 
 struct const_expression_t {
@@ -58,6 +59,11 @@ struct string_literal_expression_t {
        const char        *value;
 };
 
+struct wide_string_literal_expression_t {
+       expression_base_t  expression;
+       wide_string_t      value;
+};
+
 struct builtin_symbol_expression_t {
        expression_base_t  expression;
        symbol_t          *symbol;
@@ -92,7 +98,8 @@ typedef enum {
        UNEXPR_POSTFIX_DECREMENT,
        UNEXPR_PREFIX_INCREMENT,
        UNEXPR_PREFIX_DECREMENT,
-       UNEXPR_CAST
+       UNEXPR_CAST,
+       UNEXPR_CAST_IMPLICIT /* compiler generated cast */
 } unary_expression_type_t;
 
 struct unary_expression_t {
@@ -199,23 +206,24 @@ struct classify_type_expression_t {
 };
 
 union expression_t {
-       expresion_type_t             type;
-       expression_base_t            base;
-       const_expression_t           conste;
-       string_literal_expression_t  string_literal;
-       builtin_symbol_expression_t  builtin_symbol;
-       reference_expression_t       reference;
-       call_expression_t            call;
-       unary_expression_t           unary;
-       binary_expression_t          binary;
-       select_expression_t          select;
-       array_access_expression_t    array_access;
-       sizeof_expression_t          sizeofe;
-       offsetof_expression_t        offsetofe;
-       va_arg_expression_t          va_arg;
-       conditional_expression_t     conditional;
-       statement_expression_t       statement;
-       classify_type_expression_t   classify_type;
+       expression_type_t                type;
+       expression_base_t                base;
+       const_expression_t               conste;
+       string_literal_expression_t      string;
+       wide_string_literal_expression_t wide_string;
+       builtin_symbol_expression_t      builtin_symbol;
+       reference_expression_t           reference;
+       call_expression_t                call;
+       unary_expression_t               unary;
+       binary_expression_t              binary;
+       select_expression_t              select;
+       array_access_expression_t        array_access;
+       sizeof_expression_t              sizeofe;
+       offsetof_expression_t            offsetofe;
+       va_arg_expression_t              va_arge;
+       conditional_expression_t         conditional;
+       statement_expression_t           statement;
+       classify_type_expression_t       classify_type;
 };
 
 typedef enum {
@@ -225,22 +233,25 @@ typedef enum {
        STORAGE_CLASS_STATIC,
        STORAGE_CLASS_AUTO,
        STORAGE_CLASS_REGISTER,
-       STORAGE_CLASS_ENUM_ENTRY
-} storage_class_t;
+       STORAGE_CLASS_ENUM_ENTRY,
+       STORAGE_CLASS_THREAD,
+       STORAGE_CLASS_THREAD_EXTERN,
+       STORAGE_CLASS_THREAD_STATIC
+} storage_class_tag_t;
 
 typedef enum {
        NAMESPACE_NORMAL,
        NAMESPACE_STRUCT,
        NAMESPACE_UNION,
        NAMESPACE_ENUM,
-       NAMESPACE_LABEL
+       NAMESPACE_LABEL,
 } namespace_t;
 
 typedef enum {
        INITIALIZER_VALUE,
        INITIALIZER_LIST,
        INITIALIZER_STRING,
-       INITIALIZER_COUNT
+       INITIALIZER_WIDE_STRING
 } initializer_type_t;
 
 struct initializer_base_t {
@@ -263,12 +274,18 @@ struct initializer_string_t {
        const char         *string;
 };
 
+struct initializer_wide_string_t {
+       initializer_base_t  initializer;
+       wide_string_t       string;
+};
+
 union initializer_t {
-       initializer_type_t   type;
-       initializer_base_t   base;
-       initializer_value_t  value;
-       initializer_list_t   list;
-       initializer_string_t string;
+       initializer_type_t        type;
+       initializer_base_t        base;
+       initializer_value_t       value;
+       initializer_list_t        list;
+       initializer_string_t      string;
+       initializer_wide_string_t wide_string;
 };
 
 struct declaration_t {
@@ -317,7 +334,8 @@ typedef enum {
        STATEMENT_CASE_LABEL,
        STATEMENT_WHILE,
        STATEMENT_DO_WHILE,
-       STATEMENT_FOR
+       STATEMENT_FOR,
+       STATEMENT_ASM
 } statement_type_t;
 
 struct statement_base_t {
@@ -399,6 +417,27 @@ struct for_statement_t {
        context_t         context;
 };
 
+struct asm_constraint_t {
+       const char       *constraints;
+       expression_t     *expression;
+       symbol_t         *symbol;
+       asm_constraint_t *next;
+};
+
+struct asm_clobber_t {
+       const char    *clobber;
+       asm_clobber_t *next;
+};
+
+struct asm_statement_t {
+       statement_base_t  statement;
+       const char       *asm_text;
+       asm_constraint_t *inputs;
+       asm_constraint_t *outputs;
+       asm_clobber_t    *clobbers;
+       bool              is_volatile;
+};
+
 union statement_t {
        statement_type_t         type;
        statement_base_t         base;
@@ -414,6 +453,7 @@ union statement_t {
        while_statement_t        whiles;
        do_while_statement_t     do_while;
        for_statement_t          fors;
+       asm_statement_t          asms;
 };
 
 struct translation_unit_t {