import "ecdefs"
+#define YYSIZE_T size_t
#define YYLTYPE Location
#include "grammar.h"
%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
%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 { FreePointer($$); } pointer
identifier '*'
{
$$ = null;
- DeclClass(0, $1.string);
+ DeclClass($1._class, $1.string);
fileInput.Seek(@1.start.pos, start);
resetScannerPos(&@1.start);
yyclearin;
{
$$ = 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);
real_guess_type:
identifier error
{
- DeclClass(0, $1.string);
+ DeclClass($1._class, $1.string);
fileInput.Seek(@1.start.pos, start);
parseTypeError = 0;
resetScannerPos(&@1.start);
/* | 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);
| identifier identifier
{
#ifdef PRECOMPILER
- DeclClass(0, $1.string);
+ DeclClass($1._class, $1.string);
fileInput.Seek(@1.start.pos, start);
resetScannerPos(&@1.start);
yyclearin;
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:
{ $$ = 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 = @$; }
| 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));
}
| 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);
}
| 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));
}
| 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);
}
| INT { $$ = MkSpecifier(INT); }
| UINT { $$ = MkSpecifier(UINT); }
| INT64 { $$ = MkSpecifier(INT64); }
+ | INT128 { $$ = MkSpecifier(INT128); }
| VALIST { $$ = MkSpecifier(VALIST); }
| LONG { $$ = MkSpecifier(LONG); }
| FLOAT { $$ = MkSpecifier(FLOAT); }
| 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); }
| INT { $$ = MkSpecifier(INT); }
| UINT { $$ = MkSpecifier(UINT); }
| INT64 { $$ = MkSpecifier(INT64); }
+ | INT128 { $$ = MkSpecifier(INT128); }
| VALIST { $$ = MkSpecifier(VALIST); }
| LONG { $$ = MkSpecifier(LONG); }
| FLOAT { $$ = MkSpecifier(FLOAT); }
| 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(globalContext.nextID++, $3.string); }
+ | 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(globalContext.nextID++, $3.string); }
+ | 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(globalContext.nextID++, $3.name); FreeSpecifier($3); }
+ { $$ = 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(0, $3.string); }
+ { $$ = 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(0, $3.name); FreeSpecifier($3); }
+ { $$ = MkStructOrUnion($1, MkIdentifier($3.name), null); $$.extDeclStruct = $2; if(declMode) DeclClass($3.nsSpec, $3.name); FreeSpecifier($3); }
;
template_datatype:
| 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; }
;
;
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 '}'
{ $$ = 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:
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: