compiler: Fixes to improve compatibility with MinGW/GCC 5 headers
[sdk] / compiler / libec / src / type.y
index db46806..5a50590 100644 (file)
@@ -2,6 +2,7 @@
 
 import "ecdefs"
 
+#define YYSIZE_T size_t
 #define YYLTYPE Location
 #include "grammar.h"
 
@@ -54,6 +55,9 @@ default:
    FunctionDefinition function;
    External external;
    Context context;
+   Attrib attrib;
+   ExtDecl extDecl;
+   Attribute attribute;
 
    Instantiation instance;
    MembersInit membersInit;
@@ -80,47 +84,53 @@ default:
             exclusive_or_expression inclusive_or_expression logical_and_expression
             logical_or_expression conditional_expression assignment_expression
             constant_expression
-            common_unary_expression simple_primary_expression simple_postfix_expression simple_unary_expression
+            common_unary_expression simple_primary_expression
             anon_instantiation_expression
 
+//simple_postfix_expression simple_unary_expression
+
 %type <list> argument_expression_list expression enumerator_list
-             struct_declarator_list struct_declaration_list 
+             struct_declarator_list struct_declaration_list
              declaration_specifiers identifier_list initializer_list init_declarator_list
-             parameter_list parameter_type_list declaration_list statement_list 
+             parameter_list parameter_type_list declaration_list statement_list
              members_initialization_list members_initialization_list_coloned data_member_initialization_list data_member_initialization_list_coloned
              guess_declaration_specifiers real_guess_declaration_specifiers
              specifier_qualifier_list guess_specifier_qualifier_list
              type_qualifier_list property_specifiers
              renew_specifiers
              default_property_list
-             template_arguments_list
-             
+             template_arguments_list attribs_list
+
 
 %type <specifier> storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier strict_type_specifier
                   struct_or_union_specifier_compound struct_or_union_specifier_nocompound guess_type type strict_type
                   real_guess_type ext_storage base_strict_type
 %type <enumerator> enumerator
 %type <declarator> declarator direct_declarator direct_abstract_declarator abstract_declarator
-                   struct_declarator direct_declarator_function direct_declarator_function_start declarator_function direct_declarator_nofunction 
+                   struct_declarator direct_declarator_function direct_declarator_function_start declarator_function direct_declarator_nofunction
                    direct_abstract_declarator_noarray abstract_declarator_noarray declarator_nofunction
-                   
+
 %type <pointer> pointer
 %type <initializer> initializer initializer_condition
-%type <initDeclarator> init_declarator 
+%type <initDeclarator> init_declarator
 %type <typeName> type_name guess_type_name parameter_declaration
-%type <stmt> statement labeled_statement compound_statement expression_statement 
+%type <stmt> statement labeled_statement compound_statement expression_statement
              selection_statement iteration_statement jump_statement compound_inside
 
 %type <declaration> declaration
-%type <classDef> struct_declaration 
-%type <string> string_literal ext_decl ext_attrib
+%type <classDef> struct_declaration
+%type <string> string_literal attribute_word
+%type <extDecl> ext_decl
+%type <attrib> attrib
+%type <attribute> attribute
+
 %type <instance> instantiation_named instantiation_unnamed guess_instantiation_named instantiation_anon
 /* %type <membersInit>  members_initialization */
 %type <memberInit> data_member_initialization default_property
-%type <classFunction> class_function_definition class_function_definition_start 
-                     virtual_class_function_definition_start 
-                     constructor_function_definition_start destructor_function_definition_start 
-%type <classFunction> instance_class_function_definition instance_class_function_definition_start 
+%type <classFunction> class_function_definition class_function_definition_start
+                     virtual_class_function_definition_start
+                     constructor_function_definition_start destructor_function_definition_start
+%type <classFunction> instance_class_function_definition instance_class_function_definition_start
 %type <prop> property
 
 %type <templateArgument> template_argument template_type_argument template_expression_argument
@@ -135,7 +145,7 @@ default:
 %token XOR_ASSIGN OR_ASSIGN TYPE_NAME
 
 %token TYPEDEF EXTERN STATIC AUTO REGISTER
-%token CHAR SHORT INT UINT INT64 LONG SIGNED UNSIGNED FLOAT DOUBLE CONST VOLATILE VOID VALIST
+%token CHAR SHORT INT UINT INT64 INT128 LONG SIGNED UNSIGNED FLOAT DOUBLE CONST VOLATILE VOID VALIST
 %token STRUCT UNION ENUM ELLIPSIS
 
 %token CASE DEFAULT IF SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN
@@ -143,15 +153,19 @@ default:
 %nonassoc IFX
 %nonassoc ELSE
 %token CLASS THISCLASS CLASS_NAME
-%token PROPERTY SETPROP GETPROP NEWOP RENEW DELETE EXT_DECL EXT_STORAGE IMPORT DEFINE VIRTUAL EXT_ATTRIB
+%token PROPERTY SETPROP GETPROP NEWOP RENEW DELETE EXT_DECL EXT_STORAGE IMPORT DEFINE VIRTUAL ATTRIB
 %token PUBLIC PRIVATE
 %token TYPED_OBJECT ANY_OBJECT _INCREF EXTENSION ASM TYPEOF
 %token WATCH STOPWATCHING FIREWATCHERS WATCHABLE CLASS_DESIGNER CLASS_NO_EXPANSION CLASS_FIXED ISPROPSET
 %token CLASS_DEFAULT_PROPERTY PROPERTY_CATEGORY CLASS_DATA CLASS_PROPERTY SUBCLASS NAMESPACE
 %token NEW0OP RENEW0 VAARG
 %token DBTABLE DBFIELD DBINDEX DATABASE_OPEN
+%token ALIGNOF ATTRIB_DEP __ATTRIB
+%token BOOL _BOOL _COMPLEX _IMAGINARY RESTRICT THREAD
+%token WIDE_STRING_LITERAL
+%token BUILTIN_OFFSETOF
 
-%destructor { FreeIdentifier($$); } identifier 
+%destructor { FreeIdentifier($$); } identifier
 %destructor { FreePointer($$); } pointer
 %destructor { FreeExpression($$); } primary_expression postfix_expression unary_expression cast_expression
                                     multiplicative_expression additive_expression shift_expression
@@ -171,7 +185,7 @@ default:
 %destructor { FreeInitializer($$); } initializer initializer_condition
 %destructor { FreeInitDeclarator($$); } init_declarator
 %destructor { FreeTypeName($$); } type_name guess_type_name parameter_declaration
-%destructor { FreeStatement($$); }  statement labeled_statement compound_statement expression_statement 
+%destructor { FreeStatement($$); }  statement labeled_statement compound_statement expression_statement
                                     selection_statement iteration_statement jump_statement compound_inside
 
 %destructor { FreeDeclaration($$); } declaration
@@ -180,23 +194,23 @@ default:
 
 %destructor { FreeMemberInit($$); } data_member_initialization default_property
 
-%destructor { FreeClassFunction($$); } class_function_definition class_function_definition_start 
+%destructor { FreeClassFunction($$); } class_function_definition class_function_definition_start
                                        virtual_class_function_definition_start
-                                       constructor_function_definition_start destructor_function_definition_start 
-                                       instance_class_function_definition instance_class_function_definition_start 
+                                       constructor_function_definition_start destructor_function_definition_start
+                                       instance_class_function_definition instance_class_function_definition_start
 %destructor { FreeClassDef($$); } struct_declaration
-%destructor { delete $$; } ext_decl string_literal
+%destructor { delete $$; } string_literal attribute_word
 %destructor { FreeProperty($$); } property
 
-%destructor { FreeList($$, FreeExpression); }  argument_expression_list expression 
-%destructor { FreeList($$, FreeEnumerator); }  enumerator_list 
+%destructor { FreeList($$, FreeExpression); }  argument_expression_list expression
+%destructor { FreeList($$, FreeEnumerator); }  enumerator_list
 %destructor { FreeList($$, FreeSpecifier); }   type_qualifier_list specifier_qualifier_list declaration_specifiers
                                                guess_declaration_specifiers guess_specifier_qualifier_list
 %destructor { FreeList($$, FreeDeclarator); }  struct_declarator_list
-%destructor { FreeList($$, FreeDeclaration); } declaration_list 
+%destructor { FreeList($$, FreeDeclaration); } declaration_list
 %destructor { FreeList($$, FreeInitializer); } initializer_list
-%destructor { FreeList($$, FreeInitDeclarator); } init_declarator_list 
-%destructor { FreeList($$, FreeTypeName); } parameter_list parameter_type_list identifier_list 
+%destructor { FreeList($$, FreeInitDeclarator); } init_declarator_list
+%destructor { FreeList($$, FreeTypeName); } parameter_list parameter_type_list identifier_list
 %destructor { FreeList($$, FreeStatement); } statement_list
 %destructor { FreeList($$, FreeClassDef); } struct_declaration_list
 %destructor { FreeList($$, FreeMemberInit); } default_property_list data_member_initialization_list data_member_initialization_list_coloned
@@ -204,6 +218,10 @@ default:
 %destructor { PopContext($$); FreeContext($$); delete $$; } compound_start
 %destructor { FreeTemplateArgument($$); } template_argument template_type_argument template_expression_argument
 %destructor { FreeTemplateDataType($$); } template_datatype
+%destructor { FreeAttrib($$); } attrib
+%destructor { FreeExtDecl($$); } ext_decl
+%destructor { FreeAttribute($$); } attribute
+%destructor { FreeList($$, FreeAttribute); }  attribs_list
 
 %start type_unit
 
@@ -213,11 +231,11 @@ guess_type:
    identifier '*'
    {
       $$ = null;
-      DeclClass(0, $1.string);
-      fileInput.Seek(@1.start.pos, start); 
+      DeclClass($1._class, $1.string);
+      fileInput.Seek(@1.start.pos, start);
       resetScannerPos(&@1.start);
       yyclearin;
-      
+
       FreeIdentifier($1);
 
       YYPOPSTACK(1);
@@ -232,21 +250,11 @@ guess_type:
    {
       $$ = null;
    #ifdef PRECOMPILER
-      // if($1._class && !$1._class.name)
-      if($1._class)
-      {
-         char name[1024];
-         strcpy(name,  $1._class.name ? $1._class.name : "");
-         strcat(name, "::");
-         strcat(name, $1.string);
-         _DeclClass(0, name);
-      }
-      else
-         _DeclClass(0, $1.string);
+      _DeclClass($1._class, $1.string);
 
       FreeIdentifier($1);
 
-      fileInput.Seek(@1.start.pos, start); 
+      fileInput.Seek(@1.start.pos, start);
       resetScannerPos(&@1.start);
       yyclearin;
 
@@ -264,8 +272,8 @@ guess_type:
 real_guess_type:
    identifier error
    {
-      DeclClass(0, $1.string);
-      fileInput.Seek(@1.start.pos, start); 
+      DeclClass($1._class, $1.string);
+      fileInput.Seek(@1.start.pos, start);
       parseTypeError = 0;
       resetScannerPos(&@1.start);
       yyclearin;
@@ -282,21 +290,11 @@ real_guess_type:
 /*   | identifier '<'
    {
    #ifdef PRECOMPILER
-      // if($1._class && !$1._class.name)
-      if($1._class)
-      {
-         char name[1024];
-         strcpy(name,  $1._class.name ? $1._class.name : "");
-         strcat(name, "::");
-         strcat(name, $1.string);
-         _DeclClass(0, name);
-      }
-      else
-         _DeclClass(0, $1.string);
+      _DeclClass($1._class, $1.string);
 
       FreeIdentifier($1);
 
-      fileInput.Seek(@1.start.pos, start); 
+      fileInput.Seek(@1.start.pos, start);
       resetScannerPos(&@1.start);
       yyclearin;
 
@@ -316,8 +314,8 @@ type:
    | identifier identifier
    {
    #ifdef PRECOMPILER
-      DeclClass(0, $1.string);
-      fileInput.Seek(@1.start.pos, start); 
+      DeclClass($1._class, $1.string);
+      fileInput.Seek(@1.start.pos, start);
       resetScannerPos(&@1.start);
       yyclearin;
 
@@ -332,8 +330,8 @@ type:
       YY_STACK_PRINT (yyss, yyssp);
       goto yysetstate;
    #else
-      Location tmpLoc = yylloc; $$ = $2; yylloc = @1; 
-      Compiler_Error($"Not a type: %s\n", $1.string);      
+      Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
+      Compiler_Error($"Not a type: %s\n", $1.string);
       yylloc = tmpLoc; $2.badID = $1; // FreeIdentifier($1);
    #endif
    }
@@ -346,14 +344,14 @@ base_strict_type:
 strict_type:
      base_strict_type
     | base_strict_type '<' template_arguments_list '>' { $$ = $1; SetClassTemplateArgs($$, $3); $$.loc = @$; }
-    | base_strict_type '<' template_arguments_list RIGHT_OP 
+    | base_strict_type '<' template_arguments_list RIGHT_OP
     {
       $$ = $1;
       SetClassTemplateArgs($$, $3);
       $$.loc = @$;
 
       @4.end.pos--;
-      fileInput.Seek(@4.end.pos, start); 
+      fileInput.Seek(@4.end.pos, start);
       resetScannerPos(&@4.end);
       yyclearin;
     }
@@ -364,26 +362,26 @@ strict_type:
 
 class_function_definition_start:
      guess_declaration_specifiers declarator_function
-      { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
+      { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; }
    | declarator_function
-      { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
+      { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; }
    ;
 
 constructor_function_definition_start:
    guess_declaration_specifiers '(' ')'
-      { $$ = MkClassFunction(null, null, null, null); $$.isConstructor = true; $$.loc = @$; $$.id = ++globalContext.nextID; FreeList /*FreeSpecifier*/($1, FreeSpecifier); }
+      { $$ = MkClassFunction(null, null, null, null); $$.isConstructor = true; $$.loc = @$; FreeList /*FreeSpecifier*/($1, FreeSpecifier); }
    ;
 
 destructor_function_definition_start:
    '~' guess_declaration_specifiers '(' ')'
-      { $$ = MkClassFunction(null, null, null, null); $$.isDestructor = true; $$.loc = @$; $$.id = ++globalContext.nextID; FreeList /*FreeSpecifier*/($2, FreeSpecifier); }
+      { $$ = MkClassFunction(null, null, null, null); $$.isDestructor = true; $$.loc = @$; FreeList /*FreeSpecifier*/($2, FreeSpecifier); }
    ;
 
 virtual_class_function_definition_start:
      VIRTUAL guess_declaration_specifiers declarator_function
-      { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
+      { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; }
    | VIRTUAL declarator_function
-      { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
+      { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; }
       ;
 
 identifier:
@@ -404,6 +402,7 @@ simple_primary_expression:
       { $$ = MkExpInstance($1); $$.loc = @$; }
        | CONSTANT
       { $$ = MkExpConstant(yytext); $$.loc = @$; }
+   | WIDE_STRING_LITERAL { $$ = MkExpWideString(yytext); $$.loc = @$; }
        | string_literal
       { $$ = MkExpString($1); delete $1; $$.loc = @$; }
    | '$' string_literal     { $$ = MkExpIntlString($2, null); delete $2; $$.loc = @$; }
@@ -428,6 +427,19 @@ postfix_expression:
        | postfix_expression '(' ')'                          { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
        | postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
        | postfix_expression '.' identifier                   { $$ = MkExpMember($1, $3); $$.loc = @$; }
+   | postfix_expression identifier
+   {
+      char * constant = $1.type == constantExp ? $1.constant : null;
+      int len = constant ? strlen(constant) : 0;
+      if(constant && constant[len-1] == '.')
+      {
+         constant[len-1] = 0;
+         $$ = MkExpMember($1, $2);
+         $$.loc = @$;
+      }
+      else
+         yyerror();
+   }
        | postfix_expression PTR_OP identifier                { $$ = MkExpPointer($1, $3); $$.loc = @$; }
        | postfix_expression INC_OP                           { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
        | postfix_expression DEC_OP                           { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
@@ -437,18 +449,31 @@ anon_instantiation_expression:
    instantiation_anon            { $$ = MkExpInstance($1); $$.loc = @$; }
    ;
 
-
+/*
 simple_postfix_expression:
          simple_primary_expression
    | simple_postfix_expression '[' expression ']'               { $$ = MkExpIndex($1, $3); $$.loc = @$; }
        | simple_postfix_expression '(' ')'                          { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
        | simple_postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
        | simple_postfix_expression '.' identifier                   { $$ = MkExpMember($1, $3); $$.loc = @$; }
+   | simple_postfix_expression identifier
+   {
+      char * constant = $1.type == constantExp ? $1.constant : null;
+      int len = constant ? strlen(constant) : 0;
+      if(constant && constant[len-1] == '.')
+      {
+         constant[len-1] = 0;
+         $$ = MkExpMember($1, $2);
+         $$.loc = @$;
+      }
+      else
+         yyerror();
+   }
        | simple_postfix_expression PTR_OP identifier                { $$ = MkExpPointer($1, $3); $$.loc = @$; }
        | simple_postfix_expression INC_OP                           { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
        | simple_postfix_expression DEC_OP                           { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
        ;
-
+*/
 argument_expression_list:
          assignment_expression          { $$ = MkList(); ListAdd($$, $1); }
    | anon_instantiation_expression  { $$ = MkList(); ListAdd($$, $1); }
@@ -460,21 +485,24 @@ common_unary_expression:
          INC_OP unary_expression           { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
        | DEC_OP unary_expression           { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
        | unary_operator cast_expression    { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
-       | SIZEOF '(' unary_expression ')'         { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
-   | SIZEOF simple_unary_expression          { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
+       //| SIZEOF '(' unary_expression ')'         { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
+   | SIZEOF unary_expression          { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
    | SIZEOF '(' guess_type_name ')'          { $$ = MkExpTypeSize($3); $$.loc = @$; }
+       //| ALIGNOF '(' unary_expression ')'         { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
+   | ALIGNOF unary_expression          { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
+   | ALIGNOF '(' guess_type_name ')'          { $$ = MkExpTypeAlign($3); $$.loc = @$; }
    ;
 
 unary_expression:
        common_unary_expression
          | postfix_expression
        ;
-
+/*
 simple_unary_expression:
      common_unary_expression
        | simple_postfix_expression
        ;
-
+*/
 unary_operator:
          '&'     { $$ = '&'; }
        | '*'     { $$ = '*'; }
@@ -665,17 +693,7 @@ property_specifiers:
    | property_specifiers identifier          { ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2); }
    | identifier '<' template_arguments_list '>'
       {
-         // if($1._class && !$1._class.name)
-         if($1._class)
-         {
-            char name[1024];
-            strcpy(name,  $1._class.name ? $1._class.name : "");
-            strcat(name, "::");
-            strcat(name, $1.string);
-            _DeclClass(0, name);
-         }
-         else
-            _DeclClass(0, $1.string);
+         _DeclClass($1._class, $1.string);
 
          $$ = MkList();
          ListAdd($$, MkSpecifierNameArgs($1.string, $3));
@@ -683,15 +701,7 @@ property_specifiers:
       }
    | property_specifiers identifier '<' template_arguments_list '>'
       {
-         if($2._class && !$2._class.name)
-         {
-            char name[1024];
-            strcpy(name, "::");
-            strcat(name, $2.string);
-            _DeclClass(0, name);
-         }
-         else
-            _DeclClass(0, $2.string);
+         _DeclClass($2._class, $2.string);
          ListAdd($1, MkSpecifierNameArgs($2.string, $4));
          FreeIdentifier($2);
       }
@@ -712,17 +722,7 @@ renew_specifiers:
    | renew_specifiers identifier          { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
    | identifier '<' template_arguments_list '>'
       {
-         // if($1._class && !$1._class.name)
-         if($1._class)
-         {
-            char name[1024];
-            strcpy(name,  $1._class.name ? $1._class.name : "");
-            strcat(name, "::");
-            strcat(name, $1.string);
-            _DeclClass(0, name);
-         }
-         else
-            _DeclClass(0, $1.string);
+         _DeclClass($1._class, $1.string);
 
          $$ = MkList();
          ListAdd($$, MkSpecifierNameArgs($1.string, $3));
@@ -730,15 +730,7 @@ renew_specifiers:
       }
    | renew_specifiers identifier '<' template_arguments_list '>'
       {
-         if($2._class && !$2._class.name)
-         {
-            char name[1024];
-            strcpy(name, "::");
-            strcat(name, $2.string);
-            _DeclClass(0, name);
-         }
-         else
-            _DeclClass(0, $2.string);
+         _DeclClass($2._class, $2.string);
          ListAdd($1, MkSpecifierNameArgs($2.string, $4));
          FreeIdentifier($2);
       }
@@ -760,21 +752,48 @@ storage_class_specifier:
        | STATIC        { $$ = MkSpecifier(STATIC); }
        | AUTO          { $$ = MkSpecifier(AUTO); }
        | REGISTER      { $$ = MkSpecifier(REGISTER); }
+   | THREAD        { $$ = MkSpecifier(THREAD); }
        ;
 
 ext_decl:
-     EXT_DECL { $$ = CopyString(yytext); }
-   | ext_attrib
+     EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
+   | EXT_STORAGE { $$ = MkExtDeclString(CopyString(yytext)); }
+   | attrib { $$ = MkExtDeclAttrib($1); }
+   ;
+
+_attrib:
+   ATTRIB      { $<i>$ = ATTRIB; }
+ | ATTRIB_DEP  { $<i>$ = ATTRIB_DEP; }
+ | __ATTRIB    { $<i>$ = __ATTRIB; }
+ ;
+
+
+attribute_word:
+     IDENTIFIER   { $$  = CopyString(yytext); }
+   | TYPE_NAME    { $$  = CopyString(yytext); }
+   | EXT_STORAGE  { $$  = CopyString(yytext); }
+   | EXT_DECL     { $$  = CopyString(yytext); }
+   | CONST        { $$  = CopyString(yytext); }
+   ;
+
+attribute:
+     attribute_word  { $$ = MkAttribute($1, null); $$.loc = @$; }
+   | attribute_word '(' expression ')'  { $$ = MkAttribute($1, MkExpBrackets($3)); $$.loc = @$; }
    ;
 
-ext_attrib:
-   EXT_ATTRIB  { $$ = CopyString(yytext); }
+attribs_list:
+     attribute { $$ = MkListOne($1); }
+   | attribs_list attribute { ListAdd($1, $2); $$ = $1; }
+   | attribs_list ',' attribute { ListAdd($1, $3); $$ = $1; }
+   ;
+
+attrib:
+     _attrib '(' '(' attribs_list ')' ')' { $$ = MkAttrib($<i>1, $4); $$.loc = @$; }
+   | _attrib '(' '('              ')' ')'  { $$ = MkAttrib($<i>1, null); $$.loc = @$; }
    ;
-   
 
 ext_storage:
-     EXT_STORAGE  { $$ = MkSpecifierExtended(yytext); }
-   | ext_decl   { $$ = MkSpecifierExtended($1); delete $1; }
+   ext_decl   { $$ = MkSpecifierExtended($1); }
    ;
 
 type_qualifier:
@@ -785,12 +804,13 @@ type_qualifier:
 
 
 type_specifier:
-         VOID            { $$ = MkSpecifier(VOID); }  
+         VOID            { $$ = MkSpecifier(VOID); }
        | CHAR            { $$ = MkSpecifier(CHAR); }
        | SHORT           { $$ = MkSpecifier(SHORT); }
        | INT             { $$ = MkSpecifier(INT); }
    | UINT            { $$ = MkSpecifier(UINT); }
    | INT64           { $$ = MkSpecifier(INT64); }
+   | INT128          { $$ = MkSpecifier(INT128); }
    | VALIST          { $$ = MkSpecifier(VALIST); }
        | LONG            { $$ = MkSpecifier(LONG); }
        | FLOAT           { $$ = MkSpecifier(FLOAT); }
@@ -798,59 +818,83 @@ type_specifier:
        | SIGNED          { $$ = MkSpecifier(SIGNED); }
        | UNSIGNED        { $$ = MkSpecifier(UNSIGNED); }
    | EXTENSION       { $$ = MkSpecifier(EXTENSION); }
+   | _BOOL           { $$ = MkSpecifier(_BOOL); }
+   | BOOL            { $$ = MkSpecifier(BOOL); }
        | struct_or_union_specifier_nocompound
        | enum_specifier_nocompound
        | type
+   | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
    | SUBCLASS '(' type ')'                { $$ = MkSpecifierSubClass($3); }
-   | SUBCLASS '(' identifier ')'          { DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
+   | SUBCLASS '(' identifier ')'          { _DeclClass($3._class, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
    | THISCLASS       { $$ = MkSpecifier(THISCLASS); }
+   | TYPED_OBJECT    { $$ = MkSpecifier(TYPED_OBJECT); }
+   | ANY_OBJECT      { $$ = MkSpecifier(ANY_OBJECT); }
        ;
 
 strict_type_specifier:
-         VOID            { $$ = MkSpecifier(VOID); }  
+         VOID            { $$ = MkSpecifier(VOID); }
        | CHAR            { $$ = MkSpecifier(CHAR); }
        | SHORT           { $$ = MkSpecifier(SHORT); }
        | INT             { $$ = MkSpecifier(INT); }
    | UINT            { $$ = MkSpecifier(UINT); }
    | INT64           { $$ = MkSpecifier(INT64); }
+   | INT128          { $$ = MkSpecifier(INT128); }
    | VALIST          { $$ = MkSpecifier(VALIST); }
        | LONG            { $$ = MkSpecifier(LONG); }
        | FLOAT           { $$ = MkSpecifier(FLOAT); }
        | DOUBLE          { $$ = MkSpecifier(DOUBLE); }
        | SIGNED          { $$ = MkSpecifier(SIGNED); }
        | UNSIGNED        { $$ = MkSpecifier(UNSIGNED); }
+   | EXTENSION       { $$ = MkSpecifier(EXTENSION); }
+   | _BOOL           { $$ = MkSpecifier(_BOOL); }
+   | BOOL            { $$ = MkSpecifier(BOOL); }
        | struct_or_union_specifier_nocompound
        | enum_specifier_nocompound
        | strict_type
+   | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
    | SUBCLASS '(' type ')'                { $$ = MkSpecifierSubClass($3); }
-   | SUBCLASS '(' identifier ')'          { DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
+   | SUBCLASS '(' identifier ')'          { _DeclClass($3._class, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
    | THISCLASS       { $$ = MkSpecifier(THISCLASS); }
        ;
 
 
 struct_or_union_specifier_compound:
-         struct_or_union identifier '{' struct_declaration_list '}'   { $$ = MkStructOrUnion($1, $2, $4); if(declMode) DeclClass(globalContext.nextID++, $2.string); }
+         struct_or_union identifier '{' struct_declaration_list '}'   { $$ = MkStructOrUnion($1, $2, $4); if(declMode) DeclClass($2._class, $2.string); }
        | struct_or_union '{' struct_declaration_list '}'              { $$ = MkStructOrUnion($1, null, $3); }
-   | struct_or_union identifier '{' '}'   { $$ = MkStructOrUnion($1, $2, null); if(declMode) DeclClass(globalContext.nextID++, $2.string); }
+   | struct_or_union identifier '{' '}'   { $$ = MkStructOrUnion($1, $2, null); if(declMode) DeclClass($2._class, $2.string); }
    | struct_or_union '{' '}'              { $$ = MkStructOrUnion($1, null, null); }
        | struct_or_union base_strict_type '{' struct_declaration_list '}'
-      { $$ = MkStructOrUnion($1, MkIdentifier($2.name), $4); if(declMode) DeclClass(globalContext.nextID++, $2.name); FreeSpecifier($2); }
+      { $$ = MkStructOrUnion($1, MkIdentifier($2.name), $4); if(declMode) DeclClass($2.nsSpec, $2.name); FreeSpecifier($2); }
+
+       | struct_or_union ext_decl identifier '{' struct_declaration_list '}'   { $$ = MkStructOrUnion($1, $3, $5); $$.extDeclStruct = $2; if(declMode) DeclClass($3._class, $3.string); }
+       | struct_or_union ext_decl '{' struct_declaration_list '}'              { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; }
+   | struct_or_union ext_decl identifier '{' '}'   { $$ = MkStructOrUnion($1, $3, null); $$.extDeclStruct = $2; if(declMode) DeclClass($3._class, $3.string); }
+   | struct_or_union ext_decl '{' '}'              { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; }
+       | struct_or_union ext_decl strict_type '{' struct_declaration_list '}'
+      { $$ = MkStructOrUnion($1, MkIdentifier($3.name), $5); $$.extDeclStruct = $2; if(declMode) DeclClass($3.nsSpec, $3.name); FreeSpecifier($3); }
        ;
 
 struct_or_union_specifier_nocompound:
-         struct_or_union identifier                                   { $$ = MkStructOrUnion($1, $2, null); if(declMode) DeclClass(0, $2.string); }
+         struct_or_union identifier                                   { $$ = MkStructOrUnion($1, $2, null); if(declMode) DeclClass($2._class, $2.string); }
        | struct_or_union strict_type
-      { $$ = MkStructOrUnion($1, MkIdentifier($2.name), null); if(declMode) DeclClass(0, $2.name); FreeSpecifier($2); }
+      { $$ = MkStructOrUnion($1, MkIdentifier($2.name), null); if(declMode) DeclClass($2.nsSpec, $2.name); FreeSpecifier($2); }
+
+       | struct_or_union ext_decl identifier
+      { $$ = MkStructOrUnion($1, $3, null); $$.extDeclStruct = $2;if(declMode) DeclClass($3._class, $3.string); }
+       | struct_or_union ext_decl strict_type
+      { $$ = MkStructOrUnion($1, MkIdentifier($3.name), null); $$.extDeclStruct = $2; if(declMode) DeclClass($3.nsSpec, $3.name); FreeSpecifier($3); }
        ;
 
 template_datatype:
-     declaration_specifiers { $$ = MkTemplateDatatype($1, null); }
-   | declaration_specifiers abstract_declarator { $$ = MkTemplateDatatype($1, $2); }
+     guess_declaration_specifiers { $$ = MkTemplateDatatype($1, null); }
+   | guess_declaration_specifiers abstract_declarator { $$ = MkTemplateDatatype($1, $2); }
    /*| identifier { $$ = MkTemplateDatatype(MkListOne(MkSpecifierName($1.string)), null); FreeIdentifier($1); }*/
    ;
 
 template_type_argument:
-     template_datatype { $$ = MkTemplateTypeArgument($1); }
+     guess_declaration_specifiers { $$ = MkTemplateTypeArgument(MkTemplateDatatype($1, null)); }
+   | guess_declaration_specifiers abstract_declarator { $$ = MkTemplateTypeArgument(MkTemplateDatatype($1, $2)); }
+     //template_datatype { $$ = MkTemplateTypeArgument($1); }
    ;
 
 /*
@@ -870,9 +914,9 @@ template_argument:
    | identifier '=' template_expression_argument   { $$ = $3; $$.name = $1; $$.loc = @$; }
    /*| identifier '=' template_identifier_argument   { $$ = $3; $$.name = $1; $$.loc = @$; }*/
    | identifier '=' template_type_argument         { $$ = $3; $$.name = $1; $$.loc = @$; }
-   | template_datatype '=' template_expression_argument 
+   | template_datatype '=' template_expression_argument
    {
-      $$ = $3; 
+      $$ = $3;
       if($1.specifiers && $1.specifiers->first)
       {
          Specifier spec = $1.specifiers->first;
@@ -884,7 +928,7 @@ template_argument:
    }
    /*| template_datatype '=' template_identifier_argument
    {
-      $$ = $3; 
+      $$ = $3;
       if($1.specifiers && $1.specifiers->first)
       {
          Specifier spec = $1.specifiers->first;
@@ -896,7 +940,7 @@ template_argument:
    } */
    | template_datatype '=' template_type_argument
    {
-      $$ = $3; 
+      $$ = $3;
       if($1.specifiers && $1.specifiers->first)
       {
          Specifier spec = $1.specifiers->first;
@@ -933,44 +977,44 @@ default_property_list:
    ;
 
 property:
-   PROPERTY property_specifiers identifier '{' SETPROP compound_statement GETPROP compound_statement '}'  
-      { $$ = MkProperty($2, null, $3, $6, $8); $$.loc = @$; } 
-   | PROPERTY property_specifiers identifier '{' GETPROP compound_statement SETPROP compound_statement '}'  
+   PROPERTY property_specifiers identifier '{' SETPROP compound_statement GETPROP compound_statement '}'
+      { $$ = MkProperty($2, null, $3, $6, $8); $$.loc = @$; }
+   | PROPERTY property_specifiers identifier '{' GETPROP compound_statement SETPROP compound_statement '}'
       { $$ = MkProperty($2, null, $3, $8, $6); $$.loc = @$; }
-   | PROPERTY property_specifiers identifier '{' SETPROP compound_statement '}'  
+   | PROPERTY property_specifiers identifier '{' SETPROP compound_statement '}'
       { $$ = MkProperty($2, null, $3, $6, null); $$.loc = @$; }
    | PROPERTY property_specifiers identifier '{' GETPROP compound_statement '}'
       { $$ = MkProperty($2, null, $3, null, $6); $$.loc = @$; }
    | PROPERTY property_specifiers identifier '{' '}'
       { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
 
-   | PROPERTY property_specifiers abstract_declarator identifier '{' SETPROP compound_statement GETPROP compound_statement '}'  
+   | PROPERTY property_specifiers abstract_declarator identifier '{' SETPROP compound_statement GETPROP compound_statement '}'
       { $$ = MkProperty($2, $3, $4, $7, $9); $$.loc = @$; }
-   | PROPERTY property_specifiers abstract_declarator identifier '{' GETPROP compound_statement SETPROP compound_statement '}'  
+   | PROPERTY property_specifiers abstract_declarator identifier '{' GETPROP compound_statement SETPROP compound_statement '}'
       { $$ = MkProperty($2, $3, $4, $9, $7); $$.loc = @$; }
-   | PROPERTY property_specifiers abstract_declarator identifier '{' SETPROP compound_statement '}'  
+   | PROPERTY property_specifiers abstract_declarator identifier '{' SETPROP compound_statement '}'
       { $$ = MkProperty($2, $3, $4, $7, null); $$.loc = @$; }
    | PROPERTY property_specifiers abstract_declarator identifier '{' GETPROP compound_statement '}'
       { $$ = MkProperty($2, $3, $4, null, $7); $$.loc = @$; }
    | PROPERTY property_specifiers abstract_declarator identifier '{' '}'
       { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
 
-   | PROPERTY property_specifiers '{' SETPROP compound_statement GETPROP compound_statement '}'  
+   | PROPERTY property_specifiers '{' SETPROP compound_statement GETPROP compound_statement '}'
       { $$ = MkProperty($2, null, null, $5, $7); $$.loc = @$; }
-   | PROPERTY property_specifiers '{' GETPROP compound_statement SETPROP compound_statement '}'  
+   | PROPERTY property_specifiers '{' GETPROP compound_statement SETPROP compound_statement '}'
       { $$ = MkProperty($2, null, null, $7, $5); $$.loc = @$; }
-   | PROPERTY property_specifiers '{' SETPROP compound_statement '}'  
+   | PROPERTY property_specifiers '{' SETPROP compound_statement '}'
       { $$ = MkProperty($2, null, null, $5, null); $$.loc = @$; }
    | PROPERTY property_specifiers '{' GETPROP compound_statement '}'
       { $$ = MkProperty($2, null, null, null, $5); $$.loc = @$; }
    | PROPERTY property_specifiers '{' '}'
       { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
 
-   | PROPERTY property_specifiers abstract_declarator '{' SETPROP compound_statement GETPROP compound_statement '}'  
+   | PROPERTY property_specifiers abstract_declarator '{' SETPROP compound_statement GETPROP compound_statement '}'
       { $$ = MkProperty($2, $3, null, $6, $8); $$.loc = @$; }
-   | PROPERTY property_specifiers abstract_declarator '{' GETPROP compound_statement SETPROP compound_statement '}'  
+   | PROPERTY property_specifiers abstract_declarator '{' GETPROP compound_statement SETPROP compound_statement '}'
       { $$ = MkProperty($2, $3, null, $8, $6); $$.loc = @$; }
-   | PROPERTY property_specifiers abstract_declarator '{' SETPROP compound_statement '}'  
+   | PROPERTY property_specifiers abstract_declarator '{' SETPROP compound_statement '}'
       { $$ = MkProperty($2, $3, null, $6, null); $$.loc = @$; }
    | PROPERTY property_specifiers abstract_declarator '{' GETPROP compound_statement '}'
       { $$ = MkProperty($2, $3, null, null, $6); $$.loc = @$; }
@@ -985,7 +1029,7 @@ struct_declaration:
    | guess_instantiation_named ';'                                   { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; }
    | class_function_definition                                       { $$ = MkClassDefFunction($1); $$.loc = @$; }
    | default_property_list ';' { $$ = MkClassDefDefaultProperty($1); if($1->last) ((MemberInit)$1->last).loc.end = @2.start; $$.loc = @$; }
-   | property { $$ = MkClassDefProperty($1); $$.loc = @$; globalContext.nextID++; }
+   | property { $$ = MkClassDefProperty($1); $$.loc = @$; }
    | ';' { $$ = null; }
        ;
 
@@ -998,9 +1042,9 @@ struct_declarator_list:
 
 struct_declarator:
          declarator_nofunction
-      { $$ = MkStructDeclarator($1, null); $$.loc = @$; }  
-       | declarator_nofunction ext_attrib
-      { $$ = MkStructDeclarator($1, null); $$.structDecl.attrib = $2; $$.loc = @$; }  
+      { $$ = MkStructDeclarator($1, null); $$.loc = @$; }
+       | declarator_nofunction attrib
+      { $$ = MkStructDeclarator($1, null); $$.structDecl.attrib = $2; $$.loc = @$; }
        | ':' constant_expression
       { $$ = MkStructDeclarator(null, $2);  $$.loc = @$; }
        | declarator_nofunction ':' constant_expression
@@ -1010,17 +1054,17 @@ struct_declarator:
        ;
 
 enum_specifier_nocompound:
-     ENUM identifier                            { $$ = MkEnum($2, null); if(declMode) DeclClass(0, $2.string); }
-   | ENUM strict_type                           { $$ = MkEnum(MkIdentifier($2.name), null); if(declMode) DeclClass(0, $2.name); FreeSpecifier($2); }
+     ENUM identifier                            { $$ = MkEnum($2, null); if(declMode) DeclClass($2._class, $2.string); }
+   | ENUM strict_type                           { $$ = MkEnum(MkIdentifier($2.name), null); if(declMode) DeclClass($2.nsSpec, $2.name); FreeSpecifier($2); }
    ;
 
 enum_specifier_compound:
-         ENUM '{' enumerator_list '}'               
+         ENUM '{' enumerator_list '}'
       { $$ = MkEnum(null, $3); }
-       | ENUM identifier '{' enumerator_list '}'    { $$ = MkEnum($2, $4); if(declMode) DeclClass(globalContext.nextID++, $2.string); }
-   | ENUM identifier '{' enumerator_list ';' struct_declaration_list '}'    { $$ = MkEnum($2, $4); $$.definitions = $6; if(declMode) DeclClass(globalContext.nextID++, $2.string); }
-       | ENUM strict_type '{' enumerator_list ';' struct_declaration_list '}'          { $$ = MkEnum(MkIdentifier($2.name), $4); $$.definitions = $6; if(declMode) DeclClass(globalContext.nextID++, $2.name); FreeSpecifier($2); }
-   | ENUM strict_type '{' enumerator_list '}'          { $$ = MkEnum(MkIdentifier($2.name), $4); if(declMode) DeclClass(globalContext.nextID++, $2.name); FreeSpecifier($2); }
+       | ENUM identifier '{' enumerator_list '}'    { $$ = MkEnum($2, $4); if(declMode) DeclClass($2._class, $2.string); }
+   | ENUM identifier '{' enumerator_list ';' struct_declaration_list '}'    { $$ = MkEnum($2, $4); $$.definitions = $6; if(declMode) DeclClass($2._class, $2.string); }
+       | ENUM strict_type '{' enumerator_list ';' struct_declaration_list '}'          { $$ = MkEnum(MkIdentifier($2.name), $4); $$.definitions = $6; if(declMode) DeclClass($2.nsSpec, $2.name); FreeSpecifier($2); }
+   | ENUM strict_type '{' enumerator_list '}'          { $$ = MkEnum(MkIdentifier($2.name), $4); if(declMode) DeclClass($2.nsSpec, $2.name); FreeSpecifier($2); }
        ;
 
 enumerator_list:
@@ -1101,14 +1145,14 @@ abstract_declarator:
        | direct_abstract_declarator
        | pointer direct_abstract_declarator
       { $$ = MkDeclaratorPointer($1, $2); }
-   
+
    | ext_decl pointer
       { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
        | ext_decl direct_abstract_declarator
       { $$ = MkDeclaratorExtended($1, $2); }
        | ext_decl pointer direct_abstract_declarator
       { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
-      
+
        ;
 
 direct_abstract_declarator:
@@ -1151,7 +1195,7 @@ direct_declarator_nofunction:
       { $$ = MkDeclaratorIdentifier($1); }
        | '(' declarator ')'
       { $$ = MkDeclaratorBrackets($2); }
-       | direct_declarator_nofunction '[' constant_expression ']' 
+       | direct_declarator_nofunction '[' constant_expression ']'
       { $$ = MkDeclaratorArray($1, $3); }
        | direct_declarator_nofunction '[' ']'
       { $$ = MkDeclaratorArray($1, null); }
@@ -1163,14 +1207,14 @@ declarator_function:
      direct_declarator_function
        | pointer direct_declarator_function
       { $$ = MkDeclaratorPointer($1, $2); }
-     
+
    | ext_decl direct_declarator_function
       { $$ = MkDeclaratorExtended($1, $2); }
        | ext_decl pointer direct_declarator_function
       { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
        | pointer ext_decl direct_declarator_function
-      { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }      
-     
+      { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
+
    ;
 
 direct_declarator_function_start:
@@ -1178,7 +1222,7 @@ direct_declarator_function_start:
    ;
 
 direct_declarator_function:
-         direct_declarator_function_start parameter_type_list ')' 
+         direct_declarator_function_start parameter_type_list ')'
       { $$ = MkDeclaratorFunction($1, $2); }
        | direct_declarator_function_start identifier_list ')'
       { $$ = MkDeclaratorFunction($1, $2); }
@@ -1216,7 +1260,7 @@ pointer:
        ;
 
 parameter_type_list:
-         parameter_list                 
+         parameter_list
        | parameter_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
        ;
 
@@ -1228,37 +1272,41 @@ parameter_list:
 parameter_declaration:
          guess_declaration_specifiers declarator          { $$ = MkTypeName($1, $2); }
        | guess_declaration_specifiers abstract_declarator { $$ = MkTypeName($1, $2); }
+   | guess_declaration_specifiers '&'                 { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), null)); }
+   | guess_declaration_specifiers '&' declarator      { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), $3)); }
    | real_guess_declaration_specifiers                { $$ = MkTypeName($1, null); }
 /*
-   | CLASS                                            
+   | CLASS
       { $$ = MkTypeName(MkList(), null); $$.typedObject = true; }                        // Confusion with ellipsis? MkList()?
-   | CLASS '&'                                        
+   | CLASS '&'
       { $$ = MkTypeName(null, null); $$.typedObject = true; $$.byReference = true; }
-   | CLASS declarator                                           
+   | CLASS declarator
       { $$ = MkTypeName(MkList(), $2); $$.typedObject = true; }                        // Confusion with ellipsis? MkList()?
-   | CLASS '&' declarator                                       
+   | CLASS '&' declarator
       { $$ = MkTypeName(null, $3); $$.typedObject = true; $$.byReference = true; }
 */
    | CLASS
       { $$ = MkTypeName(MkListOne(MkSpecifier(CLASS)), null); }
-   | TYPED_OBJECT                                            
+/*
+   | TYPED_OBJECT
       { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), null); }
-   | TYPED_OBJECT '&'                                        
+   | TYPED_OBJECT '&'
       { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), null)); }
-   | TYPED_OBJECT declarator                                           
+   | TYPED_OBJECT declarator
       { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), $2);  }
-   | TYPED_OBJECT '&' declarator                                       
+   | TYPED_OBJECT '&' declarator
       { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), $3)); }
    | ANY_OBJECT
       { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), null); }
    | ANY_OBJECT declarator
       { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), $2); }
 
-   | error                                               
+   | error
       { $$ = MkTypeName(MkListOne(MkSpecifier(INT)), null); }
    | error declarator             { $$ = MkTypeName(MkListOne(MkSpecifier(INT)), $2); }
    //| error struct_declarator             { $$ = MkTypeName(MkListOne(MkSpecifier(INT)), $2); }
-   | error abstract_declarator          { $$ = MkTypeName(MkListOne(MkSpecifier(INT)), $2); }  
+   | error abstract_declarator          { $$ = MkTypeName(MkListOne(MkSpecifier(INT)), $2); }
+*/
        ;
 
 identifier_list:
@@ -1282,16 +1330,16 @@ initializer:
        | '{' initializer_list '}'
       { $$ = MkInitializerList($2); $$.loc = @$; }
        | '{' initializer_list ',' '}'
-      { 
-         $$ = MkInitializerList($2); 
-         $$.loc = @$; 
+      {
+         $$ = MkInitializerList($2);
+         $$.loc = @$;
 
          {
             Expression exp = MkExpDummy();
             Initializer init = MkInitializerAssignment(exp);
             init.loc = @3;
             exp.loc = @3;
-            ListAdd($2, init); 
+            ListAdd($2, init);
          }
       }
        ;
@@ -1305,16 +1353,16 @@ initializer_condition:
        | '{' initializer_list '}'
       { $$ = MkInitializerList($2); $$.loc = @$; }
        | '{' initializer_list ',' '}'
-      { 
-         $$ = MkInitializerList($2); 
-         $$.loc = @$; 
+      {
+         $$ = MkInitializerList($2);
+         $$.loc = @$;
 
          {
             Expression exp = MkExpDummy();
             Initializer init = MkInitializerAssignment(exp);
             init.loc = @3;
             exp.loc = @3;
-            ListAdd($2, init); 
+            ListAdd($2, init);
          }
       }
 */
@@ -1365,19 +1413,19 @@ compound_inside:
    ;
 
 compound_start:
-    '{' { $<context>$ = PushContext(); } 
+    '{' { $<context>$ = PushContext(); }
     ;
 
 compound_statement:
    '{' '}'
-   { 
-      $$ = MkCompoundStmt(null, null); 
-      $$.compound.context = PushContext(); 
+   {
+      $$ = MkCompoundStmt(null, null);
+      $$.compound.context = PushContext();
       PopContext($$.compound.context);
-      $$.loc = @$; 
+      $$.loc = @$;
    }
 
-       | compound_start compound_inside '}' 
+       | compound_start compound_inside '}'
       { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; }
        ;
 
@@ -1427,15 +1475,15 @@ guess_instantiation_named:
       { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
    |  guess_declaration_specifiers identifier '{' '}'
       { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList());  $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
-      
+
    /*| guess_declaration_specifiers identifier '{' members_initialization_list error
-      { 
+      {
          int l = 0;
          $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;
 
          for(;;)
          {
-            if(yychar == '}') 
+            if(yychar == '}')
                l--;
             else if(yychar == '{')
                l++;
@@ -1450,20 +1498,20 @@ guess_instantiation_named:
    ;
 
 instantiation_unnamed:
-     type '{' members_initialization_list '}' 
+     type '{' members_initialization_list '}'
       { $$ = MkInstantiation($1, null, $3);  $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
-   | type '{' '}' 
+   | type '{' '}'
       { $$ = MkInstantiation($1, null, MkList());  $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start;}
-   | identifier '{' members_initialization_list '}' 
+   | identifier '{' members_initialization_list '}'
       { Location tmpLoc = yylloc; yylloc = @1; yylloc = tmpLoc;  $$ = MkInstantiation(MkSpecifierName($1.string), null, $3);$$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
-   | identifier '{' '}' 
+   | identifier '{' '}'
       { Location tmpLoc = yylloc; yylloc = @1; yylloc = tmpLoc;  $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList());  $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start; FreeIdentifier($1); }
    ;
 
 instantiation_anon:
-     '{' members_initialization_list '}' 
+     '{' members_initialization_list '}'
       { $$ = MkInstantiation(null, null, $2);  $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
-   | '{' '}' 
+   | '{' '}'
       { $$ = MkInstantiation(null, null, MkList());  $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.start;}
    ;
 class_function_definition:
@@ -1482,10 +1530,10 @@ class_function_definition:
 instance_class_function_definition_start:
    // Guess here conflicts with an expression...
      declaration_specifiers declarator_function
-      { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
+      { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; }
     | declaration_specifiers declarator_nofunction
-      { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
-      ; 
+      { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; }
+      ;
 
 instance_class_function_definition:
          instance_class_function_definition_start compound_statement
@@ -1519,7 +1567,7 @@ members_initialization_list_coloned:
    ;
 
 members_initialization_list:
-     members_initialization_list_coloned 
+     members_initialization_list_coloned
    | data_member_initialization_list                                       { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
    | members_initialization_list_coloned data_member_initialization_list   { ListAdd($1, MkMembersInitList($2));   ((MembersInit)$$->last).loc = @2; }
    ;