4 #define YYLTYPE Location
7 # define YYLLOC_DEFAULT(Current, Rhs, N) \
8 (Current).start = (Rhs)[1].start; \
9 (Current).end = (Rhs)[N].end;
13 extern File fileInput;
19 bool deleteWatchable = false;
21 #define MAX_STRUCT_LEVELS 256
22 AccessMode memberAccessStack[MAX_STRUCT_LEVELS];
23 int defaultMemberAccess = -1;
25 #define POP_DEFAULT_ACCESS if(defaultMemberAccess > -1) defaultMemberAccess--;
35 SpecifierType specifierType;
42 Enumerator enumerator;
43 Declarator declarator;
45 Initializer initializer;
46 InitDeclarator initDeclarator;
48 Declaration declaration;
50 FunctionDefinition function;
55 Instantiation instance;
56 MembersInit membersInit;
57 MemberInit memberInit;
58 ClassFunction classFunction;
59 ClassDefinition _class;
64 PropertyWatch propertyWatch;
65 TemplateParameter templateParameter;
66 TemplateArgument templateArgument;
67 TemplateDatatype templateDatatype;
69 DBTableEntry dbtableEntry;
70 DBIndexItem dbindexItem;
71 DBTableDef dbtableDef;
76 %type <symbol> class_decl
77 %type <specifierType> struct_or_union
78 %type <i> unary_operator assignment_operator
79 %type <declMode> member_access declaration_mode
80 %type <id> identifier enum_decl
81 %type <exp> primary_expression primary_expression_error postfix_expression unary_expression cast_expression
82 multiplicative_expression additive_expression shift_expression
83 relational_expression relational_expression_smaller_than equality_expression and_expression
84 exclusive_or_expression inclusive_or_expression logical_and_expression
85 logical_or_expression conditional_expression assignment_expression
86 constant_expression constant_expression_error
87 anon_instantiation_expression anon_instantiation_expression_error
89 %type <exp> postfix_expression_error unary_expression_error cast_expression_error
90 multiplicative_expression_error additive_expression_error shift_expression_error
91 relational_expression_error equality_expression_error and_expression_error
92 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
93 logical_or_expression_error conditional_expression_error assignment_expression_error
94 simple_primary_expression
95 simple_postfix_expression simple_postfix_expression_error
96 common_unary_expression common_unary_expression_error
97 simple_unary_expression simple_unary_expression_error
98 database_open dbfield dbindex dbtable
100 %type <list> argument_expression_list expression expression_anon_inst expression_anon_inst_error enumerator_list type_qualifier_list
101 struct_declarator_list struct_declaration_list
102 declaration_specifiers identifier_list identifier_list_error initializer_list init_declarator_list
103 parameter_list parameter_list_error parameter_type_list parameter_type_list_error declaration_list declaration_list_error statement_list statement_list_error
104 translation_unit members_initialization_list members_initialization_list_coloned members_initialization_list_error data_member_initialization_list data_member_initialization_list_coloned
105 default_property_list data_member_initialization_list_error
106 expression_error init_declarator_list_error argument_expression_list_error default_property_list_error struct_declaration_list_error
107 translation_unit_error
108 guess_declaration_specifiers
109 external_guess_declaration_specifiers external_guess_declaration_specifiers_error
110 specifier_qualifier_list guess_specifier_qualifier_list
111 _inheritance_specifiers inheritance_specifiers property_specifiers
112 new_specifiers renew_specifiers asm_field_list
113 property_watch_list watch_property_list
114 dbindex_item_list dbfield_definition_list
115 template_arguments_list template_parameters_list
117 %type <asmField> asm_field
118 %type <specifier> storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier class_specifier class_specifier_error
119 struct_or_union_specifier_compound struct_or_union_specifier_nocompound ext_storage type strict_type guess_type enum_class strict_type_specifier struct_class
120 struct_or_union_specifier_compound_error struct_class_error struct_decl
121 enum_specifier_compound_error enum_class_error external_storage_class_specifier
122 base_strict_type struct_head struct_entry
123 %type <enumerator> enumerator
124 %type <declarator> declarator direct_declarator direct_abstract_declarator abstract_declarator
125 direct_abstract_declarator_noarray abstract_declarator_noarray
126 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction
127 declarator_nofunction
128 %type <pointer> pointer
129 %type <initializer> initializer initializer_error initializer_condition initializer_condition_error
130 %type <initDeclarator> init_declarator init_declarator_error
131 %type <typeName> type_name guess_type_name parameter_declaration parameter_declaration_error
132 %type <stmt> statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
133 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
134 iteration_statement_error statement_error asm_statement
135 stopwatching watch_definition firewatchers
137 %type <declaration> declaration declaration_error external_guess_declaration external_guess_declaration_error
138 %type <function> function_definition function_definition_error
139 %type <external> external_declaration external_declaration_error
141 %type <instance> instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error guess_instantiation_named guess_instantiation_named_error external_guess_instantiation_named
142 instantiation_anon instantiation_anon_error
143 %type <memberInit> data_member_initialization data_member_initialization_error default_property default_property_error
144 %type <classFunction> class_function_definition class_function_definition_error class_function_definition_start
145 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
146 constructor_function_definition_start destructor_function_definition_start
147 %type <classFunction> instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
148 %type <_class> class class_error class_head
149 %type <classDef> struct_declaration struct_declaration_error
150 %type <string> ext_decl string_literal ext_attrib base_strict_type_name
151 %type <prop> property property_start property_body class_property class_property_start class_property_body
152 %type <propertyWatch> property_watch self_watch_definition
154 %type <templateParameter> template_parameter template_type_parameter template_identifier_parameter template_expression_parameter
155 %type <templateArgument> template_argument template_type_argument template_identifier_argument template_expression_argument
156 %type <templateDatatype> template_datatype
158 %type <dbtableEntry> dbindex_entry dbfield_entry
159 %type <dbindexItem> dbindex_item
160 %type <dbtableDef> dbtable_definition
162 %token IDENTIFIER CONSTANT STRING_LITERAL SIZEOF
163 %token PTR_OP INC_OP DEC_OP LEFT_OP RIGHT_OP LE_OP GE_OP EQ_OP NE_OP
164 %token AND_OP OR_OP MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN
165 %token SUB_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN
166 %token XOR_ASSIGN OR_ASSIGN TYPE_NAME
168 %token TYPEDEF EXTERN STATIC AUTO REGISTER
169 %token CHAR SHORT INT UINT INT64 LONG SIGNED UNSIGNED FLOAT DOUBLE CONST VOLATILE VOID VALIST
170 %token STRUCT UNION ENUM ELLIPSIS
172 %token CASE DEFAULT IF SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN
176 %token CLASS THISCLASS CLASS_NAME
177 %token PROPERTY SETPROP GETPROP NEWOP RENEW DELETE EXT_DECL EXT_STORAGE IMPORT DEFINE VIRTUAL EXT_ATTRIB
178 %token PUBLIC PRIVATE
179 %token TYPED_OBJECT ANY_OBJECT _INCREF EXTENSION ASM TYPEOF
180 %token WATCH STOPWATCHING FIREWATCHERS WATCHABLE CLASS_DESIGNER CLASS_NO_EXPANSION CLASS_FIXED ISPROPSET
181 %token CLASS_DEFAULT_PROPERTY PROPERTY_CATEGORY CLASS_DATA CLASS_PROPERTY SUBCLASS NAMESPACE
182 %token NEW0OP RENEW0 VAARG
183 %token DBTABLE DBFIELD DBINDEX DATABASE_OPEN
186 %destructor { FreeIdentifier($$); } identifier
187 %destructor { FreePointer($$); } pointer
188 %destructor { FreeExpression($$); } primary_expression primary_expression_error postfix_expression unary_expression cast_expression
189 multiplicative_expression additive_expression shift_expression
190 relational_expression equality_expression and_expression
191 exclusive_or_expression inclusive_or_expression logical_and_expression
192 logical_or_expression conditional_expression assignment_expression
193 constant_expression constant_expression_error
194 postfix_expression_error unary_expression_error cast_expression_error
195 multiplicative_expression_error additive_expression_error shift_expression_error
196 relational_expression_error equality_expression_error and_expression_error
197 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
198 logical_or_expression_error conditional_expression_error assignment_expression_error
199 %destructor { FreeSpecifier($$); } storage_class_specifier external_storage_class_specifier type_qualifier type_specifier
200 struct_or_union_specifier_compound struct_or_union_specifier_nocompound type ext_storage class_specifier class_specifier_error
201 struct_or_union_specifier_compound_error struct_class struct_class_error
202 enum_specifier_compound_error
203 %destructor { FreeEnumerator($$); } enumerator
204 %destructor { FreeDeclarator($$); } declarator direct_declarator direct_abstract_declarator abstract_declarator
205 direct_abstract_declarator_noarray abstract_declarator_noarray
206 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction
207 declarator_nofunction
209 %destructor { FreeInitializer($$); } initializer initializer_error initializer_condition initializer_condition_error
210 %destructor { FreeInitDeclarator($$); } init_declarator init_declarator_error
211 %destructor { FreeTypeName($$); } type_name guess_type_name parameter_declaration parameter_declaration_error
212 %destructor { FreeStatement($$); } statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
213 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
214 iteration_statement_error statement_error
216 %destructor { FreeDeclaration($$); } declaration
217 %destructor { FreeFunction($$); } function_definition function_definition_error
218 %destructor { FreeExternal($$); } external_declaration external_declaration_error
220 %destructor { FreeInstance($$); } instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error
222 %destructor { FreeMemberInit($$); } data_member_initialization data_member_initialization_error default_property default_property_error
224 %destructor { FreeClassFunction($$); } class_function_definition class_function_definition_error class_function_definition_start
225 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
226 constructor_function_definition_start destructor_function_definition_start
227 instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
228 %destructor { FreeClass($$); } class class_error
229 %destructor { FreeClassDef($$); } struct_declaration struct_declaration_error
230 %destructor { delete $$; } ext_decl string_literal
231 %destructor { FreeProperty($$); } property
233 %destructor { FreeList($$, FreeExpression); } argument_expression_list expression expression_error argument_expression_list_error
234 %destructor { FreeList($$, FreeEnumerator); } enumerator_list
235 %destructor { FreeList($$, FreeSpecifier); } type_qualifier_list specifier_qualifier_list declaration_specifiers inheritance_specifiers _inheritance_specifiers
236 %destructor { FreeList($$, FreeDeclarator); } struct_declarator_list
237 %destructor { FreeList($$, FreeDeclaration); } declaration_list declaration_list_error
238 %destructor { FreeList($$, FreeInitializer); } initializer_list
239 %destructor { FreeList($$, FreeInitDeclarator); } init_declarator_list init_declarator_list_error
240 %destructor { FreeList($$, FreeTypeName); } parameter_list parameter_list_error parameter_type_list parameter_type_list_error identifier_list identifier_list_error
241 %destructor { FreeList($$, FreeStatement); } statement_list statement_list_error
242 %destructor { if($$ != ast) FreeList($$, FreeExternal); } translation_unit translation_unit_error
243 %destructor { FreeList($$, FreeClassDef); } struct_declaration_list struct_declaration_list_error
244 %destructor { FreeList($$, FreeMemberInit); } default_property_list default_property_list_error data_member_initialization_list data_member_initialization_list_coloned data_member_initialization_list_error
245 %destructor { FreeList($$, FreeMembersInit); } members_initialization_list members_initialization_list_coloned members_initialization_list_error
246 %destructor { } declaration_mode
256 // if($1._class && !$1._class.name)
260 strcpy(name, $1._class.name ? $1._class.name : "");
262 strcat(name, $1.string);
266 _DeclClass(0, $1.string);
270 fileInput.Seek(@1.start.pos, start);
271 resetScannerPos(&@1.start);
276 YY_STACK_PRINT (yyss, yyssp);
279 YY_STACK_PRINT (yyss, yyssp);
285 // if($1._class && !$1._class.name)
289 strcpy(name, $1._class.name ? $1._class.name : "");
291 strcat(name, $1.string);
295 _DeclClass(0, $1.string);
299 fileInput.Seek(@1.start.pos, start);
300 resetScannerPos(&@1.start);
305 YY_STACK_PRINT (yyss, yyssp);
308 YY_STACK_PRINT (yyss, yyssp);
312 /* | identifier '*' '<' template_arguments_list '>'
314 //if($1._class && !$1._class.name)
318 strcpy(name, $1._class.name ? $1._class.name : "");
320 strcat(name, $1.string);
324 _DeclClass(0, $1.string);
325 fileInput.Seek(@1.start.pos, start);
326 resetScannerPos(&@1.start);
331 YY_STACK_PRINT (yyss, yyssp);
334 YY_STACK_PRINT (yyss, yyssp);
340 strict_type { $$ = $1; }
341 | identifier identifier
344 // if($1._class && !$1._class.name)
348 strcpy(name, $1._class.name ? $1._class.name : "");
350 strcat(name, $1.string);
354 _DeclClass(0, $1.string);
358 fileInput.Seek(@1.start.pos, start);
359 resetScannerPos(&@1.start);
364 YY_STACK_PRINT (yyss, yyssp);
367 YY_STACK_PRINT (yyss, yyssp);
370 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
371 Compiler_Error("Not a type: %s\n", $1.string);
372 yylloc = tmpLoc; $2.badID = $1;
379 //if($1._class && !$1._class.name)
383 strcpy(name, $1._class.name ? $1._class.name : "");
385 strcat(name, $1.string);
389 _DeclClass(0, $1.string);
390 fileInput.Seek(@1.start.pos, start);
391 resetScannerPos(&@1.start);
396 YY_STACK_PRINT (yyss, yyssp);
399 YY_STACK_PRINT (yyss, yyssp);
403 /* | strict_type '<' template_arguments_list '>' { $$ = $1; }
404 | identifier identifier '<' template_arguments_list '>'
407 // if($1._class && !$1._class.name)
411 strcpy(name, $1._class.name ? $1._class.name : "");
413 strcat(name, $1.string);
417 _DeclClass(0, $1.string);
421 fileInput.Seek(@1.start.pos, start);
422 resetScannerPos(&@1.start);
427 YY_STACK_PRINT (yyss, yyssp);
430 YY_STACK_PRINT (yyss, yyssp);
433 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
434 Compiler_Error("Not a type: %s\n", $1.string);
435 yylloc = tmpLoc; $2.badID = $1;
441 TYPE_NAME { $$ = MkSpecifierName(yytext); }
444 base_strict_type_name:
445 TYPE_NAME { $$ = CopyString(yytext); }
449 | base_strict_type '<' template_arguments_list '>' { $$ = $1; SetClassTemplateArgs($$, $3); $$.loc = @$; }
450 | base_strict_type '<' template_arguments_list RIGHT_OP
453 SetClassTemplateArgs($$, $3);
457 fileInput.Seek(@4.end.pos, start);
458 resetScannerPos(&@4.end);
462 /* | identifier '<' template_arguments_list '>' */
463 /*| identifier '<' error
465 // if($1._class && !$1._class.name)
469 strcpy(name, $1._class.name ? $1._class.name : "");
471 strcat(name, $1.string);
475 _DeclClass(0, $1.string);
479 fileInput.Seek(@1.start.pos, start);
480 resetScannerPos(&@1.start);
485 YY_STACK_PRINT (yyss, yyssp);
488 YY_STACK_PRINT (yyss, yyssp);
491 YY_STACK_PRINT (yyss, yyssp);
494 /* $$ = MkSpecifierNameArgs($1.string, $3); $$.loc = @$; FreeIdentifier($1); */
498 class_function_definition_start:
499 guess_declaration_specifiers declarator_function
500 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
501 | declarator_function
502 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
505 constructor_function_definition_start:
506 guess_declaration_specifiers '(' ')'
507 { $$ = MkClassFunction(null, null, null, null); $$.isConstructor = true; $$.loc = @$; $$.id = ++globalContext.nextID; FreeList($1, FreeSpecifier); }
510 destructor_function_definition_start:
511 '~' guess_declaration_specifiers '(' ')'
512 { $$ = MkClassFunction(null, null, null, null); $$.isDestructor = true; $$.loc = @$; $$.id = ++globalContext.nextID; FreeList($2, FreeSpecifier) }
515 virtual_class_function_definition_start:
516 VIRTUAL guess_declaration_specifiers declarator_function
517 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
518 | VIRTUAL declarator_function
519 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
522 class_function_definition_start_error:
523 guess_declaration_specifiers declarator_function_error
524 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
525 | declarator_function_error
526 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
529 virtual_class_function_definition_start_error:
530 VIRTUAL guess_declaration_specifiers declarator_function_error
531 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
532 | VIRTUAL declarator_function_error
533 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
536 class_function_definition:
537 class_function_definition_start compound_statement
538 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
539 | virtual_class_function_definition_start compound_statement
540 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
541 | virtual_class_function_definition_start ';'
542 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
543 | constructor_function_definition_start compound_statement
544 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
545 | destructor_function_definition_start compound_statement
546 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
549 | class_function_definition_start ';'
550 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
553 class_function_definition_error:
554 class_function_definition_start compound_statement_error
555 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
556 | class_function_definition_start_error
557 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
558 | virtual_class_function_definition_start compound_statement_error
559 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
560 | virtual_class_function_definition_start_error
561 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
562 | virtual_class_function_definition_start_error ';'
563 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
566 // In Instances, return type is required to distinguish from calling the function
567 instance_class_function_definition_start:
568 declaration_specifiers declarator_function
569 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
570 | declaration_specifiers declarator_nofunction
571 { $$ = MkClassFunction($1, null, MkDeclaratorFunction($2, null), null); $$.loc = @$; $$.id = ++globalContext.nextID; }
574 instance_class_function_definition_start_error:
575 declaration_specifiers declarator_function_error
576 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
579 instance_class_function_definition:
580 instance_class_function_definition_start compound_statement
581 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
584 instance_class_function_definition_error:
585 instance_class_function_definition_start compound_statement_error
586 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; $$.loc.end.charPos++; $$.loc.end.pos++;}
587 | instance_class_function_definition_start_error
588 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
589 | instance_class_function_definition_start
590 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
593 data_member_initialization:
594 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
595 | initializer_condition { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
598 data_member_initialization_error:
599 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
600 | postfix_expression '=' error
602 $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy()));
603 $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = $$.initializer.loc.end = @2.end;
605 fileInput.Seek(@2.end.pos, start);
607 resetScannerPos(&@2.end);
611 | initializer_condition_error { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
614 data_member_initialization_list:
615 data_member_initialization { $$ = MkList(); ListAdd($$, $1); }
616 | data_member_initialization_list ',' data_member_initialization
617 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); }
618 | data_member_initialization_list_error ',' data_member_initialization
619 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); }
622 data_member_initialization_list_error:
623 data_member_initialization_error { $$ = MkList(); ListAdd($$, $1); }
624 | data_member_initialization_list ',' data_member_initialization_error
625 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); }
626 | data_member_initialization_list_error ',' data_member_initialization_error
627 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); }
629 | data_member_initialization_list ',' error
630 { ((MemberInit)$1->last).loc.end = @2.end;
632 Initializer dummy = MkInitializerAssignment(MkExpDummy());
633 MemberInit memberInit = MkMemberInit(null, dummy);
634 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
635 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
636 ListAdd($1, memberInit);
640 data_member_initialization_list_error ',' error
641 { ((MemberInit)$1->last).loc.end = @2.end;
643 Initializer dummy = MkInitializerAssignment(MkExpDummy());
644 MemberInit memberInit = MkMemberInit(null, dummy);
645 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
646 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
647 ListAdd($1, memberInit);
652 Initializer dummy = MkInitializerAssignment(MkExpDummy());
653 MemberInit memberInit = MkMemberInit(null, dummy);
654 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.start;
655 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.start;
658 ListAdd($$, memberInit);
660 dummy = MkInitializerAssignment(MkExpDummy());
661 memberInit = MkMemberInit(null, dummy);
662 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.end;
663 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.end;
664 ListAdd($$, memberInit);
668 data_member_initialization_list_coloned:
669 data_member_initialization_list ';'
670 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; }
671 | data_member_initialization_list_error ';'
672 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; }
675 members_initialization_list_coloned:
676 data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($1); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
677 | instance_class_function_definition { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
678 | members_initialization_list_error data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; }
679 | members_initialization_list_error instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; }
680 | members_initialization_list_coloned data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; }
681 | members_initialization_list_coloned instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; }
682 | ';' { MembersInit members = MkMembersInitList(MkList()); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
683 | members_initialization_list_error ';'
684 | members_initialization_list_coloned ';' { MembersInit members = MkMembersInitList(MkList()); ListAdd($$, members); members.loc = @2; }
687 members_initialization_list:
688 members_initialization_list_coloned
689 | data_member_initialization_list { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
690 | members_initialization_list_coloned data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
691 | members_initialization_list_error data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
694 members_initialization_list_error:
695 instance_class_function_definition_error { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
696 | members_initialization_list instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; }
697 | members_initialization_list_error instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; }
698 | members_initialization_list_coloned instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; }
699 | members_initialization_list_coloned data_member_initialization_list_error { ListAdd($$, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
700 | data_member_initialization_list_error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
701 | data_member_initialization_list error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @2; }
705 instantiation_named_error '}'
706 { $$.loc = @$; $$.insideLoc.end = @2.start; }
707 | instantiation_named_error error '}'
708 { $$.loc = @$; $$.insideLoc.end = @2.start; }
711 instantiation_named_error:
712 declaration_specifiers identifier '{' members_initialization_list_error
713 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
714 | declaration_specifiers identifier '{' members_initialization_list error
715 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
716 | declaration_specifiers identifier '{' members_initialization_list
717 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
718 | declaration_specifiers identifier '{'
719 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
720 | declaration_specifiers identifier '{' error
721 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
726 declaration_specifiers identifier '{' members_initialization_list '}'
727 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
728 | declaration_specifiers identifier '{' members_initialization_list_error '}'
729 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
730 | declaration_specifiers identifier '{' '}'
731 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
734 instantiation_named_error:
735 declaration_specifiers identifier '{' members_initialization_list_error
736 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
737 | declaration_specifiers identifier '{' members_initialization_list error
738 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
739 | declaration_specifiers identifier '{' members_initialization_list
740 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
741 | declaration_specifiers identifier '{'
742 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
743 | declaration_specifiers identifier '{' error
744 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
749 guess_instantiation_named:
750 guess_instantiation_named_error '}'
751 { $$.loc = @$; $$.insideLoc.end = @2.start; }
752 | guess_instantiation_named_error error '}'
753 { $$.loc = @$; $$.insideLoc.end = @2.start; }
756 guess_instantiation_named_error:
757 guess_declaration_specifiers identifier '{' members_initialization_list_error
758 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
759 | guess_declaration_specifiers identifier '{' members_initialization_list error
760 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
761 | guess_declaration_specifiers identifier '{' members_initialization_list
762 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
763 | guess_declaration_specifiers identifier '{'
764 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
765 | guess_declaration_specifiers identifier '{' error
766 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
770 guess_instantiation_named:
771 guess_declaration_specifiers identifier '{' members_initialization_list '}'
772 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
773 | guess_declaration_specifiers identifier '{' members_initialization_list_error '}'
774 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
775 | guess_declaration_specifiers identifier '{' '}'
776 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
779 guess_instantiation_named_error:
780 guess_declaration_specifiers identifier '{' members_initialization_list_error
781 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
782 | guess_declaration_specifiers identifier '{' members_initialization_list error
783 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
784 | guess_declaration_specifiers identifier '{' members_initialization_list
785 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
786 | guess_declaration_specifiers identifier '{'
787 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
788 | guess_declaration_specifiers identifier '{' error
789 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
793 external_guess_instantiation_named:
794 external_guess_declaration_specifiers identifier '{' members_initialization_list '}'
795 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
796 | external_guess_declaration_specifiers identifier '{' members_initialization_list_error '}'
797 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
798 | external_guess_declaration_specifiers identifier '{' '}'
799 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
802 instantiation_unnamed:
803 instantiation_unnamed_error '}'
804 { $$.loc = @$; $$.insideLoc.end = @2.start; }
805 | instantiation_unnamed_error error '}'
806 { $$.loc = @$; $$.insideLoc.end = @2.start; }
809 instantiation_unnamed_error:
810 strict_type '{' members_initialization_list
811 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
812 | identifier '{' members_initialization_list
813 { Location tmpLoc = yylloc; yylloc = @1;
814 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; FreeIdentifier($1); }
816 | strict_type '{' members_initialization_list_error
817 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
819 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
820 | strict_type '{' members_initialization_list error
821 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
822 | strict_type '{' error
823 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
827 | identifier '{' members_initialization_list_error
828 { Location tmpLoc = yylloc; yylloc = @1;
829 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
831 { Location tmpLoc = yylloc; yylloc = @1;
832 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
833 | identifier '{' members_initialization_list error
834 { Location tmpLoc = yylloc; yylloc = @1;
835 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
836 | identifier '{' error
837 { Location tmpLoc = yylloc; yylloc = @1;
838 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
842 instantiation_unnamed:
843 strict_type '{' members_initialization_list '}'
844 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
845 | strict_type '{' members_initialization_list error '}'
846 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; }
847 | strict_type '{' members_initialization_list_error '}'
848 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
849 | strict_type '{' '}'
850 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start;}
851 | strict_type '{' error '}'
852 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start;}
855 | identifier '{' members_initialization_list '}'
856 { Location tmpLoc = yylloc; yylloc = @1;
857 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
858 | identifier '{' members_initialization_list_error '}'
859 { Location tmpLoc = yylloc; yylloc = @1;
860 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
861 | identifier '{' members_initialization_list error '}'
863 $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; FreeIdentifier($1); }
865 { Location tmpLoc = yylloc; yylloc = @1;
866 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start; FreeIdentifier($1);}
867 | identifier '{' error '}'
868 { Location tmpLoc = yylloc; yylloc = @1;
869 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
873 instantiation_unnamed_error:
874 strict_type '{' members_initialization_list_error
875 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
877 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
878 | strict_type '{' members_initialization_list error
879 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
880 | strict_type '{' error
881 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
885 | identifier '{' members_initialization_list_error
886 { Location tmpLoc = yylloc; yylloc = @1;
887 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
889 { Location tmpLoc = yylloc; yylloc = @1;
890 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
891 | identifier '{' members_initialization_list error
892 { Location tmpLoc = yylloc; yylloc = @1;
893 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
894 | identifier '{' error
895 { Location tmpLoc = yylloc; yylloc = @1;
896 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
901 instantiation_anon_error '}'
902 { $$.loc = @$; $$.insideLoc.end = @2.start; }
903 | instantiation_anon_error error '}'
904 { $$.loc = @$; $$.insideLoc.end = @2.start; }
907 instantiation_anon_error:
908 '{' members_initialization_list_error
909 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
910 | '{' members_initialization_list error
911 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
913 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
915 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
916 | '{' members_initialization_list
917 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
922 '{' members_initialization_list '}'
923 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
924 | '{' members_initialization_list error '}'
925 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @4.start; }
926 | '{' members_initialization_list_error '}'
927 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
929 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.start;}
931 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start;}
934 instantiation_anon_error:
935 '{' members_initialization_list_error
936 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
938 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
939 | '{' members_initialization_list error
940 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
942 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
947 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; }
950 default_property_error:
951 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; }
952 | postfix_expression '=' error { $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; $$.initializer.loc.end = @2.end; }
953 | postfix_expression error { $$ = MkMemberInitExp($1, null); $$.loc = @$; $$.realLoc = @$; }
956 default_property_list:
957 default_property { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
958 | default_property_list ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); }
959 | default_property_list_error ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); }
962 default_property_list_error:
963 default_property_error { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
964 | default_property_list ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); }
965 | default_property_list_error ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); }
966 | default_property_list error
970 PROPERTY property_specifiers identifier '{'
971 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
973 | PROPERTY property_specifiers abstract_declarator identifier '{'
974 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
976 | PROPERTY property_specifiers '{'
977 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
979 | PROPERTY property_specifiers abstract_declarator '{'
980 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
983 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
988 | property_body SETPROP compound_statement
990 | property_body GETPROP compound_statement
992 | property_body ISPROPSET compound_statement
993 { $1.issetStmt = $3; }
994 | property_body WATCHABLE
995 { $1.isWatchable = true; }
996 | property_body PROPERTY_CATEGORY string_literal
997 { $1.category = $3; }
1001 property_body '}' { $1.loc.end = @2.end; }
1004 class_property_start:
1005 CLASS_PROPERTY property_specifiers identifier '{'
1006 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
1008 | CLASS_PROPERTY property_specifiers abstract_declarator identifier '{'
1009 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
1011 | CLASS_PROPERTY property_specifiers '{'
1012 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
1014 | CLASS_PROPERTY property_specifiers abstract_declarator '{'
1015 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
1017 | CLASS_PROPERTY error '{'
1018 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
1021 class_property_body:
1022 class_property_start
1023 | class_property_body SETPROP compound_statement
1024 { $1.setStmt = $3; }
1025 | class_property_body GETPROP compound_statement
1026 { $1.getStmt = $3; }
1030 class_property_body '}' { $1.loc.end = @2.end; }
1033 watch_property_list:
1035 { $$ = MkListOne($1); }
1036 | watch_property_list identifier
1037 { ListAdd($1, $2); }
1041 watch_property_list compound_statement
1042 { $$ = MkPropertyWatch($1, $2); }
1043 | DELETE compound_statement
1044 { $$ = MkDeleteWatch($2); }
1047 property_watch_list:
1049 { $$ = MkListOne($1); }
1050 | property_watch_list property_watch
1051 { ListAdd($1, $2); }
1054 self_watch_definition:
1055 WATCH '(' watch_property_list ')' compound_statement
1056 { $$ = MkPropertyWatch($3, $5); }
1060 WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1061 { $$ = MkWatchStmt(null, $3, $6); }
1062 | assignment_expression '.' WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1063 { $$ = MkWatchStmt($1, $5, $8); }
1067 STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1068 { $$ = MkStopWatchingStmt(null, $3, $5); }
1069 | assignment_expression '.' STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1070 { $$ = MkStopWatchingStmt($1, $5, $7); }
1071 | STOPWATCHING '(' assignment_expression ')'
1072 { $$ = MkStopWatchingStmt(null, $3, null); }
1073 | assignment_expression '.' STOPWATCHING '(' assignment_expression ')'
1074 { $$ = MkStopWatchingStmt($1, $5, null); }
1079 { $$ = MkFireWatchersStmt(null, null); }
1080 | FIREWATCHERS watch_property_list
1081 { $$ = MkFireWatchersStmt(null, $2); }
1082 | postfix_expression '.' FIREWATCHERS
1083 { $$ = MkFireWatchersStmt($1, null); }
1084 | assignment_expression '.' FIREWATCHERS watch_property_list
1085 { $$ = MkFireWatchersStmt($1, $4); }
1089 guess_declaration_specifiers struct_declarator_list ';' { $$ = MkClassDefDeclaration(MkStructDeclaration($1, $2, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1090 | guess_declaration_specifiers ';' { $$ = MkClassDefDeclaration(MkStructDeclaration($1, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1091 | instantiation_unnamed ';' { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1092 | guess_instantiation_named ';' { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1093 | class_function_definition { $$ = MkClassDefFunction($1); $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1094 | property { $$ = MkClassDefProperty($1); $$.loc = @$; globalContext.nextID++; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1096 | member_access guess_declaration_specifiers struct_declarator_list ';' { $$ = MkClassDefDeclaration(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1097 | member_access guess_declaration_specifiers ';' { $$ = MkClassDefDeclaration(MkStructDeclaration($2, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1098 | member_access instantiation_unnamed ';' { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1099 | member_access guess_instantiation_named ';' { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1100 | member_access class_function_definition { $$ = MkClassDefFunction($2); $$.loc = @$; $$.memberAccess = $1; }
1101 | member_access property { $$ = MkClassDefProperty($2); $$.loc = @$; globalContext.nextID++; $$.memberAccess = $1; }
1103 | default_property_list ';' { $$ = MkClassDefDefaultProperty($1); if($1->last) ((MemberInit)$1->last).loc.end = @2.start; $$.loc = @$; }
1104 | CLASS_DATA guess_declaration_specifiers struct_declarator_list ';' { $$ = MkClassDefClassData(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; }
1105 | class_property { $$ = MkClassDefClassProperty($1); $$.loc = @$; globalContext.nextID++; }
1106 | self_watch_definition ';' { $$ = MkClassDefPropertyWatch($1); $$.loc = @$; globalContext.nextID++; }
1107 | WATCHABLE { $$ = null; deleteWatchable = true; }
1108 | CLASS_DESIGNER identifier ';' { $$ = MkClassDefDesigner($2.string); FreeIdentifier($2); }
1109 | CLASS_DESIGNER strict_type ';' { $$ = MkClassDefDesigner($2.name); FreeSpecifier($2); }
1110 | CLASS_NO_EXPANSION { $$ = MkClassDefNoExpansion(); }
1111 | CLASS_FIXED { $$ = MkClassDefFixed(); }
1112 | CLASS_DEFAULT_PROPERTY identifier ';' { $$ = MkClassDefDesignerDefaultProperty($2); }
1113 | CLASS_PROPERTY '(' identifier ')' '=' initializer_condition ';' { $$ = MkClassDefClassPropertyValue($3, $6); $$.loc = @$; }
1115 | ';' { $$ = null; }
1116 | member_access ':' { memberAccessStack[defaultMemberAccess] = $1; if(defaultMemberAccess == 0) { $$ = MkClassDefMemberAccess(); $$.memberAccess = $1; $$.loc = @$; } else $$ = null; }
1118 | member_access '(' identifier ')' { $$ = MkClassDefAccessOverride($1, $3); $$.loc = @$; }
1121 struct_declaration_error:
1122 class_function_definition_error { $$ = MkClassDefFunction($1); $$.loc = $1.loc; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1123 | guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1124 | instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1125 | guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1126 | instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1128 | member_access class_function_definition_error { $$ = MkClassDefFunction($2); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = $1; }
1129 | member_access guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1130 | member_access instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1131 | member_access guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1132 | member_access instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1134 | default_property_list_error { $$ = MkClassDefDefaultProperty($1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
1137 struct_declaration_list:
1138 struct_declaration { $$ = MkList(); ListAdd($$, $1); }
1139 | struct_declaration_list struct_declaration { ListAdd($1, $2); }
1140 | struct_declaration_list_error struct_declaration { ListAdd($1, $2); }
1143 struct_declaration_list_error:
1144 struct_declaration_error { $$ = MkList(); ListAdd($$, $1); }
1145 | struct_declaration_list error
1146 | struct_declaration_list_error error
1147 | struct_declaration_list struct_declaration_error { ListAdd($$, $2); }
1148 | struct_declaration_list_error struct_declaration_error { ListAdd($$, $2); }
1152 declaration_specifiers { $$ = MkTemplateDatatype($1, null); }
1153 | declaration_specifiers abstract_declarator { $$ = MkTemplateDatatype($1, $2); }
1154 | identifier { $$ = MkTemplateDatatype(MkListOne(MkSpecifierName($1.string)), null); FreeIdentifier($1); }
1157 template_type_argument:
1158 template_datatype { $$ = MkTemplateTypeArgument($1); }
1161 template_type_parameter:
1162 CLASS identifier { $$ = MkTypeTemplateParameter($2, null, null); }
1163 | CLASS identifier '=' template_type_argument { $$ = MkTypeTemplateParameter($2, null, $4); }
1164 | CLASS identifier ':' template_datatype { $$ = MkTypeTemplateParameter($2, $4, null); }
1165 | CLASS identifier ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter($2, $4, $6); }
1166 | CLASS base_strict_type_name { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, null); delete $2; }
1167 | CLASS base_strict_type_name '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, $4); }
1168 | CLASS base_strict_type_name ':' template_datatype { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, null); }
1169 | CLASS base_strict_type_name ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, $6); }
1172 template_identifier_argument:
1173 identifier { $$ = MkTemplateIdentifierArgument($1); }
1176 template_identifier_parameter:
1177 identifier { $$ = MkIdentifierTemplateParameter($1, dataMember, null); }
1178 | identifier '=' template_identifier_argument { $$ = MkIdentifierTemplateParameter($1, dataMember, $3); }
1181 template_expression_argument:
1182 constant_expression { $$ = MkTemplateExpressionArgument($1); }
1185 template_expression_parameter:
1186 template_datatype identifier { $$ = MkExpressionTemplateParameter($2, $1, null); }
1187 | template_datatype identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($2, $1, $4); }
1191 template_type_parameter
1192 | template_identifier_parameter
1193 | template_expression_parameter
1196 template_parameters_list:
1197 template_parameter { $$ = MkList(); ListAdd($$, $1); }
1198 | template_parameters_list ',' template_parameter { ListAdd($1, $3); }
1202 template_expression_argument
1203 | template_identifier_argument
1204 | template_type_argument
1205 | identifier '=' template_expression_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1206 | identifier '=' template_identifier_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1207 | identifier '=' template_type_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1208 | template_datatype '=' template_expression_argument
1211 if($1.specifiers && $1.specifiers->first)
1213 Specifier spec = $1.specifiers->first;
1214 if(spec.type == nameSpecifier)
1215 $$.name = MkIdentifier(spec.name);
1217 FreeTemplateDataType($1);
1220 | template_datatype '=' template_identifier_argument
1223 if($1.specifiers && $1.specifiers->first)
1225 Specifier spec = $1.specifiers->first;
1226 if(spec.type == nameSpecifier)
1227 $$.name = MkIdentifier(spec.name);
1229 FreeTemplateDataType($1);
1232 | template_datatype '=' template_type_argument
1235 if($1.specifiers && $1.specifiers->first)
1237 Specifier spec = $1.specifiers->first;
1238 if(spec.type == nameSpecifier)
1239 $$.name = MkIdentifier(spec.name);
1241 FreeTemplateDataType($1);
1246 template_arguments_list:
1247 template_argument { $$ = MkList(); ListAdd($$, $1); }
1248 | template_arguments_list ',' template_argument { ListAdd($1, $3); }
1258 class_entry identifier { $$ = DeclClassAddNameSpace(globalContext.nextID++, $2.string); FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1259 | class_entry base_strict_type
1261 $$ = DeclClass(globalContext.nextID++, $2.name);
1264 ++defaultMemberAccess;
1265 memberAccessStack[defaultMemberAccess] = privateAccess;
1267 | identifier class_entry identifier { $$ = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($1); FreeIdentifier($3); $$.nameLoc = @3; $$.isRemote = true; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1268 | identifier class_entry base_strict_type { $$ = DeclClass(globalContext.nextID++, $3.name); FreeIdentifier($1); $$.nameLoc = @3; $$.isRemote = true; FreeSpecifier($3); memberAccessStack[++defaultMemberAccess] = privateAccess; }
1270 | class_entry identifier '<' template_parameters_list '>' { $$ = DeclClassAddNameSpace(globalContext.nextID++, $2.string); $$.templateParams = $4; FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1271 | class_entry base_strict_type '<' template_parameters_list '>'
1273 $$ = DeclClass(globalContext.nextID++, $2.name);
1274 $$.templateParams = $4;
1277 ++defaultMemberAccess;
1278 memberAccessStack[defaultMemberAccess] = privateAccess;
1280 | identifier class_entry identifier '<' template_parameters_list '>' { $$ = DeclClassAddNameSpace(globalContext.nextID++, $3.string); $$.templateParams = $5; FreeIdentifier($1); FreeIdentifier($3); $$.nameLoc = @3; $$.isRemote = true; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1281 | identifier class_entry base_strict_type '<' template_parameters_list '>' { $$ = DeclClass(globalContext.nextID++, $3.name); $$.templateParams = $5; FreeIdentifier($1); $$.nameLoc = @3; $$.isRemote = true; FreeSpecifier($3); memberAccessStack[++defaultMemberAccess] = privateAccess; }
1290 // Added this for unit classes...
1293 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1295 PopContext(curContext);
1298 | class_decl '{' '}'
1300 $$ = MkClass($1, null, MkList()); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1302 PopContext(curContext);
1304 | class_head '{' '}'
1306 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1308 PopContext(curContext);
1311 | class_entry identifier ';'
1313 $$ = MkClass(DeclClassAddNameSpace(0, $2.string), null, null); FreeIdentifier($2);
1315 PopContext(curContext);
1317 | class_entry type ';'
1319 $$ = MkClass(DeclClass(0, $2.name), null, null); FreeSpecifier($2);
1321 PopContext(curContext);
1326 class_decl ':' inheritance_specifiers
1328 $$ = MkClass($1, $3, null);
1333 class_decl '{' struct_declaration_list_error
1335 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1337 PopContext(curContext);
1339 | class_head '{' struct_declaration_list_error
1341 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1343 PopContext(curContext);
1345 | class_decl '{' struct_declaration_list
1347 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1349 PopContext(curContext);
1351 | class_head '{' struct_declaration_list
1353 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1355 PopContext(curContext);
1357 | class_decl '{' error
1359 $$ = MkClass($1, null, MkList()); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1361 PopContext(curContext);
1363 | class_head '{' error
1365 $$ = $1; $$.definitions = MkList(); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1367 PopContext(curContext);
1371 /**** EXPRESSIONS ********************************************************************/
1375 { $$ = MkIdentifier(yytext); $$.loc = @1; }
1379 simple_primary_expression
1380 | '(' expression ')'
1381 { $$ = MkExpBrackets($2); $$.loc = @$; }
1384 simple_primary_expression:
1385 identifier { $$ = MkExpIdentifier($1); $$.loc = @$; }
1386 | instantiation_unnamed { $$ = MkExpInstance($1); $$.loc = @$; }
1387 | EXTENSION '(' compound_statement ')' { $$ = MkExpExtensionCompound($3); $$.loc = @$; }
1388 | EXTENSION '(' expression ')' { $$ = MkExpExtensionExpression($3); $$.loc = @$; }
1389 | EXTENSION '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, $5); $$.loc = @$; }
1390 | EXTENSION '(' type_name ')' '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, MkInitializerAssignment(MkExpExtensionInitializer($6, $8))); $$.loc = @$; }
1391 | CONSTANT { $$ = MkExpConstant(yytext); $$.loc = @$; }
1392 | string_literal { $$ = MkExpString($1); delete $1; $$.loc = @$; }
1393 | '$' string_literal { $$ = MkExpIntlString($2, null); delete $2; $$.loc = @$; }
1394 | '$' string_literal '.' string_literal { $$ = MkExpIntlString($4, $2); delete $2; delete $4; $$.loc = @$; }
1395 | '(' ')' { Expression exp = MkExpDummy(); exp.loc.start = @1.end; exp.loc.end = @2.start; $$ = MkExpBrackets(MkListOne(exp)); $$.loc = @$; yyerror(); }
1396 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1397 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1398 | NEWOP new_specifiers '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1399 | NEWOP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1400 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1401 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1402 | NEW0OP new_specifiers '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1403 | NEW0OP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1404 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1405 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1406 | RENEW constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1407 | RENEW constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1408 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1409 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1410 | RENEW0 constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1411 | RENEW0 constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1412 | CLASS '(' declaration_specifiers ')' { $$ = MkExpClass($3, null); $$.loc = @$; }
1413 | CLASS '(' declaration_specifiers abstract_declarator ')' { $$ = MkExpClass($3, $4); $$.loc = @$; }
1414 | CLASS '(' identifier ')' { $$ = MkExpClass(MkListOne(MkSpecifierName($3.string)), null); FreeIdentifier($3); $$.loc = @$; }
1415 | VAARG '(' assignment_expression ',' type_name ')' { $$ = MkExpVaArg($3, $5); $$.loc = @$; }
1417 | CLASS_DATA '(' identifier ')' { $$ = MkExpClassData($3); $$.loc = @$; }
1423 | '[' argument_expression_list /*expression*/ ']' { $$ = MkExpArray($2); $$.loc = @$; }
1426 anon_instantiation_expression:
1427 instantiation_anon { $$ = MkExpInstance($1); $$.loc = @$; }
1430 anon_instantiation_expression_error:
1431 instantiation_anon_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1434 primary_expression_error:
1435 '(' expression { $$ = MkExpBrackets($2); $$.loc = @$; }
1436 | '(' expression_error { $$ = MkExpBrackets($2); $$.loc = @$; }
1442 | postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1443 | postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1444 | postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1445 | postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1446 | postfix_expression '(' argument_expression_list_error ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; if($3->last) ((Expression)$3->last).loc.end = @4.start; }
1447 | postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1448 | postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1449 | postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1450 | postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1452 | postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1453 | postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1454 | postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1455 | postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1456 | postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1457 | postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1458 | postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1459 | postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1462 simple_postfix_expression:
1463 simple_primary_expression
1465 | simple_postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1466 | simple_postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1467 | simple_postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1468 | simple_postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1469 | simple_postfix_expression '(' argument_expression_list_error ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; if($3->last) ((Expression)$3->last).loc.end = @4.start; }
1470 | simple_postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1471 | simple_postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1472 | simple_postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1473 | simple_postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1475 | simple_postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1476 | simple_postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1477 | simple_postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1478 | simple_postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1479 | simple_postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1480 | simple_postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1481 | simple_postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1482 | simple_postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1485 argument_expression_list:
1486 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1487 | anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1488 | argument_expression_list ',' assignment_expression { ListAdd($1, $3); }
1489 | argument_expression_list ',' anon_instantiation_expression { ListAdd($1, $3); }
1492 argument_expression_list_error:
1493 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
1494 | anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
1495 | argument_expression_list ',' assignment_expression_error { ListAdd($1, $3); }
1496 | argument_expression_list ',' anon_instantiation_expression_error { ListAdd($1, $3); }
1497 | argument_expression_list ',' { Expression exp = MkExpDummy(); exp.loc.start = @2.end; exp.loc.end = @2.end; ListAdd($1, exp); }
1500 common_unary_expression:
1501 INC_OP unary_expression { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1502 | DEC_OP unary_expression { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1503 | unary_operator cast_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1504 | unary_operator anon_instantiation_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1505 | SIZEOF '(' unary_expression ')' { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1506 | SIZEOF simple_unary_expression { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1507 | SIZEOF '(' guess_type_name ')' { $$ = MkExpTypeSize($3); $$.loc = @$; }
1508 | SIZEOF '(' CLASS type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1509 | SIZEOF '(' CLASS guess_type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1513 common_unary_expression
1514 | postfix_expression
1517 simple_unary_expression:
1518 common_unary_expression
1519 | simple_postfix_expression
1529 | DELETE { $$ = DELETE; }
1530 | _INCREF { $$ = _INCREF; }
1535 | '(' type_name ')' cast_expression { $$ = MkExpCast($2, $4); $$.loc = @$; }
1538 multiplicative_expression:
1540 | multiplicative_expression '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1541 | multiplicative_expression '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1542 | multiplicative_expression '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1543 | multiplicative_expression_error '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1544 | multiplicative_expression_error '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1545 | multiplicative_expression_error '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1548 additive_expression:
1549 multiplicative_expression
1550 | additive_expression '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1551 | additive_expression '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1552 | additive_expression_error '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1553 | additive_expression_error '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1558 | shift_expression LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1559 | shift_expression RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1560 | shift_expression_error LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1561 | shift_expression_error RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1564 relational_expression_smaller_than:
1565 relational_expression '<'
1572 relational_expression:
1574 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression { skipErrors = false; $$ = MkExpOp($1, '<', $2/*$3*/); $$.loc = @$; }
1575 | relational_expression '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1576 | relational_expression LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1577 | relational_expression GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1578 | relational_expression_error '<' shift_expression { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1579 | relational_expression_error '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1580 | relational_expression_error LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1581 | relational_expression_error GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1585 : relational_expression
1586 | equality_expression EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1587 | equality_expression NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1588 | equality_expression_error EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1589 | equality_expression_error NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1591 | equality_expression EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1592 | equality_expression NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1593 | equality_expression_error EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1594 | equality_expression_error NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1598 : equality_expression
1599 | and_expression '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1600 | and_expression_error '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1602 | and_expression '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1603 | and_expression_error '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1606 exclusive_or_expression
1608 | exclusive_or_expression '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1609 | exclusive_or_expression_error '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1611 | exclusive_or_expression '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1612 | exclusive_or_expression_error '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1615 inclusive_or_expression
1616 : exclusive_or_expression
1617 | inclusive_or_expression '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1618 | inclusive_or_expression_error '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1620 | inclusive_or_expression '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1621 | inclusive_or_expression_error '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1624 logical_and_expression
1625 : inclusive_or_expression
1626 | logical_and_expression AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1627 | logical_and_expression_error AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1630 logical_or_expression
1631 : logical_and_expression
1632 | logical_or_expression OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1633 | logical_or_expression_error OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1636 conditional_expression
1637 : logical_or_expression
1638 | logical_or_expression '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1639 | logical_or_expression '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1640 | logical_or_expression_error '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1641 | logical_or_expression_error '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1643 | logical_or_expression '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1644 | logical_or_expression '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1645 | logical_or_expression_error '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1646 | logical_or_expression_error '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1648 | logical_or_expression '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1649 | logical_or_expression '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1650 | logical_or_expression_error '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1651 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1653 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1654 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1655 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1656 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1659 assignment_expression:
1660 conditional_expression
1661 | unary_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1662 | unary_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1663 | conditional_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; } // TODO: Generate error here:
1664 | conditional_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; } // TODO: Generate error here:
1666 | unary_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1667 | unary_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1668 | conditional_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1669 | conditional_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1672 assignment_operator:
1674 | MUL_ASSIGN { $$ = MUL_ASSIGN; }
1675 | DIV_ASSIGN { $$ = DIV_ASSIGN; }
1676 | MOD_ASSIGN { $$ = MOD_ASSIGN; }
1677 | ADD_ASSIGN { $$ = ADD_ASSIGN; }
1678 | SUB_ASSIGN { $$ = SUB_ASSIGN; }
1679 | LEFT_ASSIGN { $$ = LEFT_ASSIGN; }
1680 | RIGHT_ASSIGN { $$ = RIGHT_ASSIGN; }
1681 | AND_ASSIGN { $$ = AND_ASSIGN; }
1682 | XOR_ASSIGN { $$ = XOR_ASSIGN; }
1683 | OR_ASSIGN { $$ = OR_ASSIGN; }
1687 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1688 | expression ',' assignment_expression { ListAdd($1, $3); }
1689 | expression_error ',' assignment_expression { ListAdd($1, $3); }
1690 | expression_error ')'
1693 expression_anon_inst:
1694 anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1695 | expression ',' anon_instantiation_expression { ListAdd($1, $3); }
1696 | expression_error ',' anon_instantiation_expression { ListAdd($1, $3); }
1699 postfix_expression_error:
1700 primary_expression_error
1701 | error { $$ = MkExpDummy(); $$.loc = @$; /*printf("Sorry, didn't mean that syntax error\n");*/ }
1702 | postfix_expression error
1703 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1705 | postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1706 | postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1708 | postfix_expression '(' argument_expression_list { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1709 | postfix_expression '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1710 | postfix_expression '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; $$.call.argLoc.end.charPos++;}
1711 | postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; /*@2.end; $$.call.argLoc.end.charPos++;*/ }
1712 | postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1714 | postfix_expression_error '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.call.argLoc.end.charPos++;}
1715 | postfix_expression_error '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.call.argLoc.end.charPos++;}
1716 | postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1717 | postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1720 simple_postfix_expression_error:
1721 error { $$ = MkExpDummy(); $$.loc = @$; }
1722 | simple_postfix_expression error
1723 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1725 | simple_postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1726 | simple_postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1728 | simple_postfix_expression '(' argument_expression_list { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1729 | simple_postfix_expression '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1730 | simple_postfix_expression '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; $$.call.argLoc.end.charPos++;}
1731 | simple_postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; /*@2.end; $$.call.argLoc.end.charPos++;*/ }
1732 | simple_postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1734 | simple_postfix_expression_error '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.call.argLoc.end.charPos++;}
1735 | simple_postfix_expression_error '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.call.argLoc.end.charPos++;}
1736 | simple_postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1737 | simple_postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1740 common_unary_expression_error:
1741 INC_OP unary_expression_error { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1742 | DEC_OP unary_expression_error { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1743 | unary_operator cast_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1744 | unary_operator anon_instantiation_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1745 | SIZEOF '(' unary_expression_error { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1746 | SIZEOF simple_unary_expression_error { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1747 | SIZEOF '(' guess_type_name ')' error { $$ = MkExpTypeSize($3); $$.loc = @$; }
1748 | SIZEOF '(' CLASS type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1749 | SIZEOF '(' CLASS guess_type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1752 unary_expression_error:
1753 common_unary_expression_error
1754 | postfix_expression_error
1757 simple_unary_expression_error:
1758 common_unary_expression_error
1759 | simple_postfix_expression_error
1763 cast_expression_error:
1764 unary_expression_error
1765 | '(' type_name ')' cast_expression_error { $$ = MkExpCast($2, $4); $$.loc = @$; }
1768 multiplicative_expression_error:
1769 cast_expression_error
1770 | multiplicative_expression '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1771 | multiplicative_expression '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1772 | multiplicative_expression '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1773 | multiplicative_expression_error '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1774 | multiplicative_expression_error '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1775 | multiplicative_expression_error '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1778 additive_expression_error:
1779 multiplicative_expression_error
1780 | additive_expression '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1781 | additive_expression '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1782 | additive_expression '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1783 | additive_expression '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1784 | additive_expression_error '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1785 | additive_expression_error '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1786 | additive_expression_error '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1787 | additive_expression_error '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1790 shift_expression_error:
1791 additive_expression_error
1792 | shift_expression LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1793 | shift_expression RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1794 | shift_expression_error LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1795 | shift_expression_error RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1798 relational_expression_error:
1799 shift_expression_error
1800 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression_error
1802 if($1.type == identifierExp)
1804 if($1.identifier._class && !$1.identifier._class.name)
1808 strcat(name, $1.identifier.string);
1809 _DeclClass(0, name);
1812 _DeclClass(0, $1.identifier.string);
1814 // printf("Declaring Class %s\n", $1.identifier.string);
1819 fileInput.Seek(@1.start.pos, start);
1820 resetScannerPos(&@1.start);
1825 YY_STACK_PRINT (yyss, yyssp);
1829 YY_STACK_PRINT (yyss, yyssp);
1833 YY_STACK_PRINT (yyss, yyssp);
1837 YY_STACK_PRINT (yyss, yyssp);
1845 $$ = MkExpOp($1, '<', $2);
1850 | relational_expression '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1851 | relational_expression LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1852 | relational_expression GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1853 | relational_expression_error '<' shift_expression_error { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1854 | relational_expression_error '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1855 | relational_expression_error LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1856 | relational_expression_error GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1859 equality_expression_error:
1860 relational_expression_error
1861 | equality_expression EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1862 | equality_expression NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1863 | equality_expression_error EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1864 | equality_expression_error NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1866 | equality_expression EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1867 | equality_expression NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1868 | equality_expression_error EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1869 | equality_expression_error NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1871 | equality_expression EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1872 | equality_expression NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1873 | equality_expression_error EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1874 | equality_expression_error NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1877 and_expression_error:
1878 equality_expression_error
1879 | and_expression '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1880 | and_expression_error '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1882 | and_expression '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1883 | and_expression_error '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1886 exclusive_or_expression_error:
1887 and_expression_error
1888 | exclusive_or_expression '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1889 | exclusive_or_expression_error '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1891 | exclusive_or_expression '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1892 | exclusive_or_expression_error '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1895 inclusive_or_expression_error:
1896 exclusive_or_expression_error
1897 | inclusive_or_expression '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1898 | inclusive_or_expression_error '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1900 | inclusive_or_expression '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1901 | inclusive_or_expression_error '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1904 logical_and_expression_error:
1905 inclusive_or_expression_error
1906 | logical_and_expression AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1907 | logical_and_expression_error AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1910 logical_or_expression_error:
1911 logical_and_expression_error
1912 | logical_or_expression OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1913 | logical_or_expression_error OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1916 conditional_expression_error:
1917 logical_or_expression_error
1918 | logical_or_expression '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1919 | logical_or_expression '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1920 | logical_or_expression_error '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1921 | logical_or_expression_error '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1922 | logical_or_expression '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1923 | logical_or_expression '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1924 | logical_or_expression_error '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1925 | logical_or_expression_error '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1927 | logical_or_expression '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1928 | logical_or_expression '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1929 | logical_or_expression_error '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1930 | logical_or_expression_error '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1931 | logical_or_expression '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1932 | logical_or_expression '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1933 | logical_or_expression_error '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1934 | logical_or_expression_error '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1936 | logical_or_expression '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1937 | logical_or_expression '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1938 | logical_or_expression_error '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1939 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1941 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1942 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1943 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1944 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1946 | logical_or_expression '?' ':'
1948 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy());
1950 ((Expression)$$.cond.exp->last).loc = @2;
1951 $$.cond.elseExp.loc = @3;
1953 | logical_or_expression_error '?' ':'
1955 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @3;
1957 | logical_or_expression '?'
1959 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
1961 | logical_or_expression_error '?'
1963 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
1967 assignment_expression_error:
1968 conditional_expression_error
1969 | unary_expression assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1970 | unary_expression assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
1971 | unary_expression_error assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1972 | unary_expression_error assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
1974 | unary_expression assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1975 | unary_expression_error assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1979 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
1980 | assignment_expression error { $$ = MkList(); ListAdd($$, $1); }
1981 | expression ',' assignment_expression_error { ListAdd($1, $3); }
1982 | expression_error ',' assignment_expression_error { ListAdd($1, $3); }
1983 | expression ',' error
1984 | expression_error ',' error
1986 | expression expression { FreeList($2, FreeExpression); }
1987 | expression_error expression { FreeList($2, FreeExpression); }
1988 | expression expression_error { FreeList($2, FreeExpression); }
1991 expression_anon_inst_error:
1992 anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
1993 | anon_instantiation_expression error { $$ = MkList(); ListAdd($$, $1); }
1994 | expression ',' anon_instantiation_expression_error { ListAdd($1, $3); }
1995 | expression_error ',' anon_instantiation_expression_error { ListAdd($1, $3); }
1999 constant_expression: conditional_expression;
2001 constant_expression_error: conditional_expression_error;
2003 /**** TYPES **************************************************************************/
2004 storage_class_specifier:
2005 TYPEDEF { $$ = MkSpecifier(TYPEDEF); }
2006 | EXTERN { $$ = MkSpecifier(EXTERN); }
2007 | STATIC { $$ = MkSpecifier(STATIC); }
2008 | AUTO { $$ = MkSpecifier(AUTO); }
2009 | REGISTER { $$ = MkSpecifier(REGISTER); }
2012 external_storage_class_specifier:
2013 TYPEDEF { $$ = MkSpecifier(TYPEDEF); declMode = defaultAccess; }
2014 | EXTERN { $$ = MkSpecifier(EXTERN); }
2015 | STATIC { $$ = MkSpecifier(STATIC); declMode = staticAccess; }
2016 | AUTO { $$ = MkSpecifier(AUTO); }
2017 | REGISTER { $$ = MkSpecifier(REGISTER); }
2021 identifier { $$ = MkEnumerator($1, null); }
2022 | identifier '=' constant_expression { $$ = MkEnumerator($1, $3); }
2023 | identifier '=' constant_expression_error { $$ = MkEnumerator($1, $3); }
2027 enumerator { $$ = MkList(); ListAdd($$, $1); }
2028 | enumerator_list ',' enumerator { ListAdd($1, $3); }
2029 | enumerator_list ','
2033 ENUM { memberAccessStack[++defaultMemberAccess] = publicAccess; }
2036 enum_specifier_nocompound:
2037 enum_specifier identifier { $$ = MkEnum($2, null); POP_DEFAULT_ACCESS }
2038 | enum_specifier strict_type { $$ = MkEnum(MkIdentifier($2.name), null); POP_DEFAULT_ACCESS }
2041 enum_specifier_compound:
2042 enum_specifier_compound_error '}' { $$.loc = @$; POP_DEFAULT_ACCESS }
2043 | enum_specifier identifier '{' '}' { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2044 | enum_specifier strict_type '{' '}' { $$ = MkEnum(MkIdentifier($2.name), null); FreeSpecifier($2); $$.loc = @$; POP_DEFAULT_ACCESS }
2047 enum_specifier_compound_error:
2048 enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2049 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2051 | enum_specifier identifier '{' enumerator_list { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2052 | enum_specifier identifier '{' enumerator_list error { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2053 | enum_specifier identifier '{' error { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2054 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2055 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2057 | enum_specifier strict_type '{' enumerator_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2058 | enum_specifier strict_type '{' enumerator_list error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2059 | enum_specifier strict_type '{' error { $$ = MkEnum(MkIdentifier($2.name), null); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2060 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2061 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2065 enum_specifier identifier { $$ = $2; if(declMode) DeclClassAddNameSpace(globalContext.nextID++, $2.string); }
2066 | enum_specifier strict_type { $$ = MkIdentifier($2.name); if(declMode) DeclClass(globalContext.nextID++, $2.name); FreeSpecifier($2); }
2070 enum_class_error '}' { $$.loc = @$; }
2071 | enum_decl ':' inheritance_specifiers '{' '}' { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2072 | enum_decl '{' '}' { $$ = MkEnum($1, null); POP_DEFAULT_ACCESS }
2076 enum_decl ':' inheritance_specifiers '{' enumerator_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2077 | enum_decl ':' inheritance_specifiers '{' enumerator_list error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2078 | enum_decl ':' inheritance_specifiers '{' error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2079 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2080 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2081 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2082 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2083 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2084 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list_error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2086 | enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2087 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2089 | enum_decl '{' enumerator_list { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2090 | enum_decl '{' enumerator_list error { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2091 | enum_decl '{' error { $$ = MkEnum($1, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2092 | enum_decl '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2093 | enum_decl '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2101 class_specifier_error:
2103 | struct_class_error
2107 EXT_STORAGE { $$ = MkSpecifierExtended(yytext); }
2108 | ext_decl { $$ = MkSpecifierExtended($1); delete $1; }
2112 CONST { $$ = MkSpecifier(CONST); }
2113 | VOLATILE { $$ = MkSpecifier(VOLATILE); }
2114 | ext_storage { $$ = $1; }
2118 type_qualifier_list:
2119 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2120 | type_qualifier_list type_qualifier { ListAdd($1, $2); }
2124 VOID { $$ = MkSpecifier(VOID); }
2125 | CHAR { $$ = MkSpecifier(CHAR); }
2126 | SHORT { $$ = MkSpecifier(SHORT); }
2127 | INT { $$ = MkSpecifier(INT); }
2128 | UINT { $$ = MkSpecifier(UINT); }
2129 | INT64 { $$ = MkSpecifier(INT64); }
2130 | VALIST { $$ = MkSpecifier(VALIST); }
2131 | LONG { $$ = MkSpecifier(LONG); }
2132 | FLOAT { $$ = MkSpecifier(FLOAT); }
2133 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2134 | SIGNED { $$ = MkSpecifier(SIGNED); }
2135 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2136 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2137 | struct_or_union_specifier_nocompound
2138 | enum_specifier_nocompound
2140 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2141 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2142 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2143 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2144 | TYPED_OBJECT { $$ = MkSpecifier(TYPED_OBJECT); }
2145 | ANY_OBJECT { $$ = MkSpecifier(ANY_OBJECT); }
2148 strict_type_specifier:
2149 VOID { $$ = MkSpecifier(VOID); }
2150 | CHAR { $$ = MkSpecifier(CHAR); }
2151 | SHORT { $$ = MkSpecifier(SHORT); }
2152 | INT { $$ = MkSpecifier(INT); }
2153 | UINT { $$ = MkSpecifier(UINT); }
2154 | INT64 { $$ = MkSpecifier(INT64); }
2155 | VALIST { $$ = MkSpecifier(VALIST); }
2156 | LONG { $$ = MkSpecifier(LONG); }
2157 | FLOAT { $$ = MkSpecifier(FLOAT); }
2158 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2159 | SIGNED { $$ = MkSpecifier(SIGNED); }
2160 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2161 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2162 | struct_or_union_specifier_nocompound
2163 | enum_specifier_nocompound
2165 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2166 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2167 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2168 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2171 // TESTING declarator_nofunction here... For function declarations
2174 declarator_nofunction
2175 { $$ = MkStructDeclarator($1, null); $$.loc = @$; }
2176 | declarator_nofunction ext_attrib
2177 { $$ = MkStructDeclarator($1, null); $$.structDecl.attrib = $2; $$.loc = @$; }
2178 | ':' constant_expression
2179 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2180 | declarator_nofunction ':' constant_expression
2181 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2182 | declarator_nofunction ':' constant_expression ':' constant_expression
2183 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2184 | ':' constant_expression_error
2185 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2186 | declarator_nofunction ':' constant_expression_error
2187 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2188 | declarator_nofunction ':' constant_expression ':' constant_expression_error
2189 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2190 | declarator_nofunction ':' constant_expression_error ':' constant_expression_error
2191 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2192 | declarator_nofunction ':' constant_expression_error ':' constant_expression
2193 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2196 struct_declarator_list:
2197 struct_declarator { $$ = MkList(); ListAdd($$, $1); }
2198 | struct_declarator_list ',' struct_declarator { ListAdd($1, $3); }
2202 struct_or_union identifier
2204 $$ = MkStructOrUnion($1, $2, null);
2205 $$.addNameSpace = true;
2206 $$.ctx = PushContext();
2208 | struct_or_union base_strict_type
2210 $$ = MkStructOrUnion($1, MkIdentifier($2.name), null);
2211 $$.ctx = PushContext();
2216 struct_or_union_specifier_compound:
2217 struct_or_union_specifier_compound_error '}' { $$.loc = @$; }
2218 | struct_entry '{' '}' { $$ = $1; $$.loc = @$; POP_DEFAULT_ACCESS PopContext(curContext); }
2219 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2222 struct_or_union_specifier_compound_error:
2223 struct_entry '{' struct_declaration_list { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2224 | struct_entry '{' struct_declaration_list_error { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2225 | struct_entry '{' error { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2227 | struct_or_union '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2228 | struct_or_union '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2229 | struct_or_union '{' error { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2232 struct_or_union_specifier_nocompound:
2233 struct_entry { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2242 ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2245 | struct_entry '<' template_parameters_list '>'
2247 Symbol symbol = ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2249 symbol.templateParams = $3;
2254 struct_decl ':' inheritance_specifiers
2258 SetupBaseSpecs(null, $3);
2263 struct_class_error '}' { $$.loc = @$; }
2264 | struct_head '{' '}'
2265 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2266 | struct_decl '{' '}' { POP_DEFAULT_ACCESS PopContext(curContext); }
2267 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2271 struct_head '{' struct_declaration_list
2274 $$.definitions = $3;
2276 PopContext(curContext);
2278 | struct_head '{' struct_declaration_list_error
2281 $$.definitions = $3;
2283 PopContext(curContext);
2285 | struct_head '{' error
2286 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext);}
2288 | struct_decl '{' struct_declaration_list
2290 PopContext(curContext);
2293 $$ = MkStructOrUnion($1.type, $1.id, $3);
2298 $$.definitions = $3;
2301 | struct_decl '{' struct_declaration_list_error
2303 PopContext(curContext);
2307 $$ = MkStructOrUnion($1.type, $1.id, $3);
2312 $$.definitions = $3;
2315 | struct_decl '{' error
2316 { POP_DEFAULT_ACCESS PopContext(curContext); }
2318 | struct_or_union '{' struct_declaration_list
2319 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2320 | struct_or_union '{' struct_declaration_list_error
2321 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2322 | struct_or_union '{' error
2323 { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2327 STRUCT { $$ = structSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2328 | UNION { $$ = unionSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2331 specifier_qualifier_list:
2332 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2333 | specifier_qualifier_list type_qualifier { ListAdd($1, $2); }
2334 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2335 | specifier_qualifier_list type_specifier { ListAdd($1, $2); }
2336 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2337 | specifier_qualifier_list enum_specifier_compound { ListAdd($1, $2); }
2338 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2339 | specifier_qualifier_list struct_or_union_specifier_compound { ListAdd($1, $2); }
2342 guess_specifier_qualifier_list:
2343 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2344 | guess_specifier_qualifier_list type_qualifier { ListAdd($1, $2); }
2345 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2346 | guess_specifier_qualifier_list type_specifier { ListAdd($1, $2); }
2347 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2348 | guess_specifier_qualifier_list guess_type { ListAdd($1, $2); }
2349 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2350 | guess_specifier_qualifier_list enum_specifier_compound { ListAdd($1, $2); }
2351 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2352 | guess_specifier_qualifier_list struct_or_union_specifier_compound { ListAdd($1, $2); }
2355 declaration_specifiers:
2356 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2357 | declaration_specifiers storage_class_specifier { ListAdd($1, $2); }
2358 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2359 | declaration_specifiers type_qualifier { ListAdd($1, $2); }
2360 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2361 | declaration_specifiers strict_type_specifier { ListAdd($1, $2); }
2362 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2363 | declaration_specifiers enum_specifier_compound { ListAdd($1, $2); }
2364 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2365 | declaration_specifiers struct_or_union_specifier_compound { ListAdd($1, $2); }
2368 guess_declaration_specifiers:
2369 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2370 | guess_declaration_specifiers storage_class_specifier { ListAdd($1, $2); }
2371 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2372 | guess_declaration_specifiers type_qualifier { ListAdd($1, $2); }
2373 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2374 | guess_declaration_specifiers type_specifier { ListAdd($1, $2); }
2375 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2376 | guess_declaration_specifiers guess_type { ListAdd($1, $2); }
2377 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2378 | guess_declaration_specifiers struct_or_union_specifier_compound { ListAdd($1, $2); }
2379 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2380 | guess_declaration_specifiers enum_specifier_compound { ListAdd($1, $2); }
2383 external_guess_declaration_specifiers:
2384 external_storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2385 | external_guess_declaration_specifiers external_storage_class_specifier { ListAdd($1, $2); }
2386 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2387 | external_guess_declaration_specifiers type_qualifier { ListAdd($1, $2); }
2388 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2389 | external_guess_declaration_specifiers type_specifier { ListAdd($1, $2); }
2390 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2391 | external_guess_declaration_specifiers guess_type { ListAdd($1, $2); }
2392 | class_specifier { $$ = MkList(); ListAdd($$, $1); }
2393 | external_guess_declaration_specifiers class_specifier { ListAdd($1, $2); }
2396 external_guess_declaration_specifiers_error:
2397 class_specifier_error { $$ = MkList(); ListAdd($$, $1); }
2398 | external_guess_declaration_specifiers class_specifier_error { ListAdd($1, $2); }
2401 _inheritance_specifiers:
2402 PRIVATE { $$ = MkList(); ListAdd($$, MkSpecifier(PRIVATE)); }
2403 | PUBLIC { $$ = MkList(); ListAdd($$, MkSpecifier(PUBLIC)); }
2404 | storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2405 | _inheritance_specifiers storage_class_specifier { ListAdd($1, $2); }
2406 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2407 | _inheritance_specifiers type_qualifier { ListAdd($1, $2); }
2408 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2409 | _inheritance_specifiers strict_type_specifier { ListAdd($1, $2); }
2411 { _DeclClass(0, $1.string); $$ = MkListOne(MkSpecifierName($1.string)); FreeIdentifier($1); }
2412 | _inheritance_specifiers identifier { _DeclClass(0, $2.string); ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2); }
2414 | identifier '<' template_arguments_list '>'
2416 // if($1._class && !$1._class.name)
2420 strcpy(name, $1._class.name ? $1._class.name : "");
2422 strcat(name, $1.string);
2423 _DeclClass(0, name);
2426 _DeclClass(0, $1.string);
2429 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2432 | _inheritance_specifiers identifier '<' template_arguments_list '>'
2434 if($2._class && !$2._class.name)
2438 strcat(name, $2.string);
2439 _DeclClass(0, name);
2442 _DeclClass(0, $2.string);
2443 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2448 inheritance_specifiers:
2449 _inheritance_specifiers
2450 | struct_or_union { $$ = MkListOne(MkStructOrUnion($1, null, null)); POP_DEFAULT_ACCESS }
2453 property_specifiers:
2454 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2455 | property_specifiers storage_class_specifier { ListAdd($1, $2); }
2456 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2457 | property_specifiers type_qualifier { ListAdd($1, $2); }
2458 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2459 | property_specifiers strict_type_specifier { ListAdd($1, $2); }
2460 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2461 | property_specifiers identifier { ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2462 | identifier '<' template_arguments_list '>'
2464 // if($1._class && !$1._class.name)
2468 strcpy(name, $1._class.name ? $1._class.name : "");
2470 strcat(name, $1.string);
2471 _DeclClass(0, name);
2474 _DeclClass(0, $1.string);
2477 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2480 | property_specifiers identifier '<' template_arguments_list '>'
2482 if($2._class && !$2._class.name)
2486 strcat(name, $2.string);
2487 _DeclClass(0, name);
2490 _DeclClass(0, $2.string);
2491 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2497 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2498 | renew_specifiers storage_class_specifier { ListAdd($1, $2); }
2499 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2500 | renew_specifiers type_qualifier { ListAdd($1, $2); }
2501 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2502 | renew_specifiers strict_type_specifier { ListAdd($1, $2); }
2503 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2504 | renew_specifiers struct_or_union_specifier_compound { ListAdd($1, $2); }
2505 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2506 | renew_specifiers enum_specifier_compound { ListAdd($1, $2); }
2507 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2508 | renew_specifiers identifier { ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2509 | identifier '<' template_arguments_list '>'
2511 // if($1._class && !$1._class.name)
2515 strcpy(name, $1._class.name ? $1._class.name : "");
2517 strcat(name, $1.string);
2518 _DeclClass(0, name);
2521 _DeclClass(0, $1.string);
2524 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2527 | renew_specifiers identifier '<' template_arguments_list '>'
2529 if($2._class && !$2._class.name)
2533 strcat(name, $2.string);
2534 _DeclClass(0, name);
2537 _DeclClass(0, $2.string);
2538 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2544 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2545 | new_specifiers storage_class_specifier { ListAdd($1, $2); }
2546 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2547 | new_specifiers type_qualifier { ListAdd($1, $2); }
2548 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2549 | new_specifiers strict_type_specifier { ListAdd($1, $2); }
2550 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2551 | new_specifiers struct_or_union_specifier_compound { ListAdd($1, $2); }
2552 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2553 | new_specifiers enum_specifier_compound { ListAdd($1, $2); }
2554 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2555 | new_specifiers identifier { ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2556 | identifier '<' template_arguments_list '>'
2558 // if($1._class && !$1._class.name)
2562 strcpy(name, $1._class.name ? $1._class.name : "");
2564 strcat(name, $1.string);
2565 _DeclClass(0, name);
2568 _DeclClass(0, $1.string);
2571 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2574 | new_specifiers identifier '<' template_arguments_list '>'
2576 if($2._class && !$2._class.name)
2580 strcat(name, $2.string);
2581 _DeclClass(0, name);
2584 _DeclClass(0, $2.string);
2585 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2590 identifier_list_error:
2591 identifier_list ',' error { ListAdd($1, null); }
2592 | identifier_list_error ',' error { ListAdd($1, null); }
2596 identifier { $$ = MkList(); ListAdd($$, MkTypeName(null, MkDeclaratorIdentifier($1))); }
2597 | identifier_list ',' identifier { ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2598 | identifier_list_error ',' identifier { ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2599 | parameter_list ',' identifier { ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2600 | parameter_list_error ',' identifier { ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2603 direct_declarator_nofunction:
2604 identifier { $$ = MkDeclaratorIdentifier($1); }
2605 | '(' declarator ')' { $$ = MkDeclaratorBrackets($2); }
2606 | direct_declarator_nofunction '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2607 | direct_declarator_nofunction '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2608 | direct_declarator_nofunction '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2609 | direct_declarator_nofunction '[' ']' { $$ = MkDeclaratorArray($1, null); }
2612 direct_declarator_function_start:
2613 direct_declarator_nofunction '('
2616 direct_declarator_function:
2617 direct_declarator_function_start parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2618 | direct_declarator_function_start parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2619 | direct_declarator_function_start identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2620 | direct_declarator_function_start identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2621 | direct_declarator_function_start ')' { $$ = MkDeclaratorFunction($1, null); }
2624 // Tricky stuff here for overriding...
2625 direct_declarator_function_error:
2626 direct_declarator_function_start identifier_list_error
2628 $$ = MkDeclaratorFunction($1, null);
2629 fileInput.Seek(@1.end.pos, start);
2631 resetScannerPos(&@1.end);
2632 @$.start = @1.start;
2635 | direct_declarator_function_start error
2637 $$ = MkDeclaratorFunction($1, null);
2638 fileInput.Seek(@1.end.pos, start);
2640 resetScannerPos(&@1.end);
2641 @$.start = @1.start;
2644 | direct_declarator_function_start parameter_list '('
2646 $$ = MkDeclaratorFunction($1, null);
2647 fileInput.Seek(@1.end.pos, start);
2649 resetScannerPos(&@1.end);
2650 @$.start = @1.start;
2653 | direct_declarator_function_start guess_declaration_specifiers identifier '('
2655 $$ = MkDeclaratorFunction($1, null);
2656 fileInput.Seek(@1.end.pos, start);
2658 resetScannerPos(&@1.end);
2659 @$.start = @1.start;
2666 direct_declarator_function
2667 | direct_declarator_nofunction
2668 | ext_decl direct_declarator_function
2669 { $$ = MkDeclaratorExtended($1, $2); }
2670 | ext_decl direct_declarator_nofunction
2671 { $$ = MkDeclaratorExtended($1, $2); }
2676 ASM '(' STRING_LITERAL { $<string>$ = CopyString(yytext); } STRING_LITERAL { $<string>$ = CopyString(yytext); }
2679 strcpy(temp, "__asm__(");
2680 strcat(temp, $<string>4);
2682 strcat(temp, $<string>6);
2685 $<string>$ = CopyString(temp);
2690 EXT_DECL { $$ = CopyString(yytext); }
2695 strcpy(temp, $<string>1);
2698 $$ = CopyString(temp);
2700 | asm_start STRING_LITERAL { $$ = CopyString(yytext); } ')'
2703 strcpy(temp, $<string>1);
2705 strcat(temp, $<string>3);
2709 $$ = CopyString(temp);
2715 EXT_DECL { $$ = CopyString(yytext); }
2717 | ASM '(' string_literal ')'
2720 strcpy(temp, "__asm__(");
2723 $$ = CopyString(temp);
2729 EXT_ATTRIB { $$ = CopyString(yytext); }
2733 direct_abstract_declarator:
2734 '(' abstract_declarator ')'
2735 { $$ = MkDeclaratorBrackets($2); }
2737 { $$ = MkDeclaratorArray(null, null); }
2738 | '[' constant_expression ']'
2739 { $$ = MkDeclaratorArray(null, $2); }
2740 | '[' constant_expression_error ']'
2741 { $$ = MkDeclaratorArray(null, $2); }
2743 { $$ = MkDeclaratorEnumArray(null, $2); }
2744 | direct_abstract_declarator '[' ']'
2745 { $$ = MkDeclaratorArray($1, null); }
2746 | direct_abstract_declarator '[' constant_expression ']'
2747 { $$ = MkDeclaratorArray($1, $3); }
2748 | direct_abstract_declarator '[' type']'
2749 { $$ = MkDeclaratorEnumArray($1, $3); }
2750 | direct_abstract_declarator '[' constant_expression_error ']'
2751 { $$ = MkDeclaratorArray($1, $3); }
2753 { $$ = MkDeclaratorFunction(null, null); }
2754 | '(' parameter_type_list ')'
2755 { $$ = MkDeclaratorFunction(null, $2); }
2756 | '(' parameter_type_list_error ')'
2757 { $$ = MkDeclaratorFunction(null, $2); }
2758 | direct_abstract_declarator '(' ')'
2759 { $$ = MkDeclaratorFunction($1, null); }
2760 | direct_abstract_declarator '(' parameter_type_list ')'
2761 { $$ = MkDeclaratorFunction($1, $3); }
2762 | direct_abstract_declarator '(' parameter_type_list_error ')'
2763 { $$ = MkDeclaratorFunction($1, $3); }
2766 direct_abstract_declarator_noarray:
2767 '(' abstract_declarator_noarray ')'
2768 { $$ = MkDeclaratorBrackets($2); }
2770 { $$ = MkDeclaratorFunction(null, null); }
2771 | '(' parameter_type_list ')'
2772 { $$ = MkDeclaratorFunction(null, $2); }
2773 | '(' parameter_type_list_error ')'
2774 { $$ = MkDeclaratorFunction(null, $2); }
2775 | direct_abstract_declarator_noarray '(' ')'
2776 { $$ = MkDeclaratorFunction($1, null); }
2777 | direct_abstract_declarator_noarray '(' parameter_type_list ')'
2778 { $$ = MkDeclaratorFunction($1, $3); }
2779 | direct_abstract_declarator_noarray '(' parameter_type_list_error ')'
2780 { $$ = MkDeclaratorFunction($1, $3); }
2784 '*' { $$ = MkPointer(null, null); }
2785 | '*' type_qualifier_list { $$ = MkPointer($2, null); }
2786 | '*' pointer { $$ = MkPointer(null, $2); }
2787 | '*' type_qualifier_list pointer { $$ = MkPointer($2, $3); }
2790 abstract_declarator:
2791 pointer { $$ = MkDeclaratorPointer($1, null); }
2792 | direct_abstract_declarator
2793 | pointer direct_abstract_declarator { $$ = MkDeclaratorPointer($1, $2); }
2794 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
2795 | ext_decl direct_abstract_declarator { $$ = MkDeclaratorExtended($1, $2); }
2796 | ext_decl pointer direct_abstract_declarator { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2799 abstract_declarator_noarray:
2800 pointer { $$ = MkDeclaratorPointer($1, null); }
2801 | direct_abstract_declarator_noarray
2802 | pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorPointer($1, $2); }
2803 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
2804 | ext_decl direct_abstract_declarator_noarray { $$ = MkDeclaratorExtended($1, $2); }
2805 | ext_decl pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2810 | pointer direct_declarator
2811 { $$ = MkDeclaratorPointer($1, $2); }
2812 | ext_decl pointer direct_declarator
2813 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2814 | declarator ext_decl
2815 { $$ = MkDeclaratorExtendedEnd($2, $1); }
2818 declarator_function:
2819 direct_declarator_function
2820 | pointer direct_declarator_function { $$ = MkDeclaratorPointer($1, $2); }
2821 | ext_decl direct_declarator_function { $$ = MkDeclaratorExtended($1, $2); }
2822 | ext_decl pointer direct_declarator_function { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2823 | pointer ext_decl direct_declarator_function { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
2826 declarator_function_error:
2827 direct_declarator_function_error
2828 | pointer direct_declarator_function_error { $$ = MkDeclaratorPointer($1, $2); }
2829 | ext_decl direct_declarator_function_error { $$ = MkDeclaratorExtended($1, $2); }
2830 | ext_decl pointer direct_declarator_function_error { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2831 | pointer ext_decl direct_declarator_function_error { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
2834 declarator_nofunction:
2835 direct_declarator_nofunction
2836 | pointer direct_declarator_nofunction { $$ = MkDeclaratorPointer($1, $2); }
2837 | ext_decl direct_declarator_nofunction { $$ = MkDeclaratorExtended($1, $2); }
2838 | ext_decl pointer direct_declarator_nofunction { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2839 | pointer ext_decl direct_declarator_nofunction { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
2843 assignment_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
2844 | '{' initializer_list '}' { $$ = MkInitializerList($2); $$.loc = @$; }
2845 | '{' initializer_list ',' '}'
2847 $$ = MkInitializerList($2);
2851 Expression exp = MkExpDummy();
2852 Initializer init = MkInitializerAssignment(exp);
2861 assignment_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
2862 | '{' initializer_list '}' error { $$ = MkInitializerList($2); $$.loc = @$; }
2863 | '{' initializer_list { $$ = MkInitializerList($2); $$.loc = @$; }
2864 | '{' initializer_list ',' '}' error
2866 $$ = MkInitializerList($2);
2870 Expression exp = MkExpDummy();
2871 Initializer init = MkInitializerAssignment(exp);
2877 | '{' initializer_list ','
2879 $$ = MkInitializerList($2);
2883 Expression exp = MkExpDummy();
2884 Initializer init = MkInitializerAssignment(exp);
2892 initializer_condition:
2893 conditional_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
2894 | anon_instantiation_expression
2895 { $$ = MkInitializerAssignment($1); $$.loc = @$; }
2898 initializer_condition_error:
2899 conditional_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
2900 | anon_instantiation_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
2904 initializer { $$ = MkList(); ListAdd($$, $1); }
2905 | initializer_error { $$ = MkList(); ListAdd($$, $1); }
2906 | initializer_list ',' initializer { ListAdd($1, $3); }
2907 | initializer_list ',' initializer_error { ListAdd($1, $3); }
2910 | initializer_list initializer { ListAdd($1, $2); }
2911 | initializer_list initializer_error { ListAdd($1, $2); }
2915 declarator { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
2916 | declarator '=' initializer { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
2919 init_declarator_error:
2920 declarator error { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
2921 | declarator '=' error { $$ = MkInitDeclarator($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.initializer.loc = @2; $$.initializer.exp.loc = @2; }
2922 | declarator '=' initializer_error { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
2925 init_declarator_list:
2926 init_declarator { $$ = MkList(); ListAdd($$, $1); }
2927 | init_declarator_list ',' init_declarator { ListAdd($1, $3); }
2928 | init_declarator_list_error ',' init_declarator { ListAdd($1, $3); }
2931 init_declarator_list_error:
2932 init_declarator_error { $$ = MkList(); ListAdd($$, $1); }
2933 | init_declarator error { $$ = MkList(); ListAdd($$, $1); }
2934 | init_declarator_list ',' init_declarator_error { ListAdd($1, $3); }
2935 | init_declarator_list_error ',' init_declarator_error { ListAdd($1, $3); }
2939 specifier_qualifier_list { $$ = MkTypeName($1, null); }
2940 | specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
2944 guess_specifier_qualifier_list { $$ = MkTypeName($1, null); }
2945 | guess_specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
2948 /*** PARAMETERS **********************************************************************/
2949 parameter_declaration:
2950 guess_declaration_specifiers declarator { $$ = MkTypeName($1, $2); }
2951 | guess_declaration_specifiers abstract_declarator { $$ = MkTypeName($1, $2); }
2952 | guess_declaration_specifiers '&' { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), null)); }
2953 | guess_declaration_specifiers '&' declarator { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), $3)); }
2954 | guess_declaration_specifiers { $$ = MkTypeName($1, null); }
2956 { $$ = MkTypeName(MkListOne(MkSpecifier(CLASS)), null); }
2959 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), null); }
2961 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), null)); }
2962 | TYPED_OBJECT declarator
2963 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), $2); }
2964 | TYPED_OBJECT '&' declarator
2965 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), $3)); }
2967 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), null); }
2968 | ANY_OBJECT declarator
2969 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), $2); }
2973 parameter_declaration_error:
2974 guess_declaration_specifiers declarator error { $$ = MkTypeName($1, $2); }
2975 | guess_declaration_specifiers abstract_declarator error { $$ = MkTypeName($1, $2); }
2979 parameter_declaration { $$ = MkList(); ListAdd($$, $1); }
2980 | parameter_list ',' parameter_declaration { ListAdd($1, $3); }
2981 | parameter_list error ',' parameter_declaration { ListAdd($1, $4); }
2982 | parameter_list_error ',' parameter_declaration { ListAdd($1, $3); }
2983 | parameter_list_error error ',' parameter_declaration { ListAdd($1, $4); }
2984 | error ',' parameter_declaration { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
2986 | identifier_list ',' parameter_declaration { ListAdd($1, $3); }
2987 | identifier_list error ',' parameter_declaration { ListAdd($1, $4); }
2988 | identifier_list_error ',' parameter_declaration { ListAdd($1, $3); }
2989 | identifier_list_error error ',' parameter_declaration { ListAdd($1, $4); }
2992 parameter_list_error:
2993 parameter_declaration_error { $$ = MkList(); ListAdd($$, $1); }
2994 | parameter_list ',' parameter_declaration_error { ListAdd($1, $3); }
2995 | parameter_list_error ',' parameter_declaration_error { ListAdd($1, $3); }
2996 | parameter_list_error error ',' parameter_declaration_error { ListAdd($1, $4); }
2997 | error ',' parameter_declaration_error { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
2999 | identifier_list ',' parameter_declaration_error { ListAdd($1, $3); }
3000 | identifier_list_error ',' parameter_declaration_error { ListAdd($1, $3); }
3001 | identifier_list_error error ',' parameter_declaration_error { ListAdd($1, $4); }
3004 parameter_type_list:
3006 | parameter_list ',' ELLIPSIS { ListAdd($1, MkTypeName(null, null)); }
3007 | parameter_list_error ',' ELLIPSIS { ListAdd($1, MkTypeName(null, null)); }
3008 | identifier_list ',' ELLIPSIS { ListAdd($1, MkTypeName(null, null)); }
3009 | identifier_list_error ',' ELLIPSIS { ListAdd($1, MkTypeName(null, null)); }
3010 | error ',' ELLIPSIS { $$ = MkList(); ListAdd($$, MkTypeName(null, null)); }
3013 parameter_type_list_error:
3014 parameter_list_error
3015 | parameter_list ',' error { ListAdd($1, null); }
3016 | parameter_list_error error
3019 /****** STATEMENTS *******************************************************************/
3022 | EXT_ATTRIB { $$ = MkExpressionStmt(null); } // Ignoring this for now... ( For __attribute__ ((__unused__)) )
3023 | compound_statement
3024 | ';' { $$ = MkExpressionStmt(null); }
3025 | ':' { $$ = MkExpressionStmt(null); }
3026 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3027 | selection_statement
3028 | iteration_statement
3034 | watch_definition ';'
3038 labeled_statement_error { $$ = $1; Compiler_Error("syntax error\n"); }
3039 | iteration_statement_error { $$ = $1; Compiler_Error("syntax error\n"); }
3040 | compound_statement_error { $$ = $1; Compiler_Error("syntax error\n"); }
3041 | selection_statement_error { $$ = $1; Compiler_Error("syntax error\n"); }
3042 | jump_statement_error { $$ = $1; Compiler_Error("syntax error\n"); }
3043 | jump_statement error { $$ = $1; Compiler_Error("syntax error\n"); }
3044 | expression_error { $$ = MkExpressionStmt($1); Compiler_Error("syntax error\n"); $$.loc = @1; }
3048 string_literal { $$ = MkAsmField($1, null); $$.loc = @1; }
3049 | string_literal '(' assignment_expression ')' { $$ = MkAsmField($1, $3); $$.loc = @$; }
3053 asm_field { $$ = MkListOne($1); }
3054 | asm_field_list ',' asm_field { ListAdd($$, $3); }
3059 ASM type_qualifier '(' string_literal ')' ';' { $$ = MkAsmStmt($2, $4, null, null, null); $$.loc = @$; }
3060 | ASM type_qualifier '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, null); $$.loc = @$; }
3061 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, null); $$.loc = @$; }
3062 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, $10); $$.loc = @$; }
3064 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, null); $$.loc = @$; }
3065 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, $8); $$.loc = @$; }
3066 | ASM type_qualifier '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, $8); $$.loc = @$; }
3068 | ASM '(' string_literal ')' ';' { $$ = MkAsmStmt(null, $3, null, null, null); $$.loc = @$; }
3069 | ASM '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, null); $$.loc = @$; }
3070 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, null); $$.loc = @$; }
3071 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, $9); $$.loc = @$; }
3073 | ASM '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, null); $$.loc = @$; }
3074 | ASM '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, $7); $$.loc = @$; }
3075 | ASM '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, $7); $$.loc = @$; }
3079 identifier ':' statement { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3080 | CASE constant_expression ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3081 | CASE constant_expression_error ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3082 | CASE ':' statement { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3083 | DEFAULT ':' statement { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3086 labeled_statement_error
3087 : identifier ':' statement_error { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3088 | CASE constant_expression ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3089 | CASE constant_expression_error ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3090 | CASE ':' statement_error { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3091 | CASE ':' { $$ = MkCaseStmt(MkExpDummy(), null); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3092 | DEFAULT ':' statement_error { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3093 | DEFAULT ':' { $$ = MkCaseStmt(null, null); $$.loc = @$; }
3097 PUBLIC { $$ = declMode = publicAccess; }
3098 | PRIVATE { $$ = declMode = privateAccess; }
3099 | DEFAULT { $$ = declMode = defaultAccess; }
3103 PUBLIC { $$ = publicAccess; }
3104 | PRIVATE { $$ = privateAccess; }
3108 declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3109 | declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3110 | instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3111 | declaration_error ';' {}
3114 external_guess_declaration:
3115 external_guess_declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3116 | external_guess_declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3117 | external_guess_declaration_specifiers_error init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3119 | external_guess_instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3120 | DEFINE identifier '=' conditional_expression ';' { $$ = MkDeclarationDefine($2, $4); $$.loc = @$; }
3121 | STATIC DEFINE identifier '=' conditional_expression ';' { declMode = staticAccess; $$ = MkDeclarationDefine($3, $5); $$.loc = @$; }
3124 external_guess_declaration_error:
3125 external_guess_declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; yyerrok; }
3129 declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; }
3130 | declaration_error error {}
3132 | instantiation_named_error error { $$ = MkDeclarationInst($1); $$.loc = @$; }
3133 | instantiation_named error { $$ = MkDeclarationInst($1); $$.loc = @$; }
3134 | declaration_specifiers init_declarator_list_error { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3138 declaration { $$ = MkList(); ListAdd($$, $1); /*declMode = defaultDeclMode;*/ }
3139 | declaration_list declaration { ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3140 | declaration_list_error declaration { ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3141 | declaration_list error ';' { }
3144 declaration_list_error:
3145 declaration_error { $$ = MkList(); ListAdd($$, $1); }
3146 | declaration_list declaration_error { ListAdd($1, $2); }
3150 statement { $$ = MkList(); ListAdd($$, $1); }
3151 | statement_list statement { ListAdd($1, $2); }
3152 | statement_list_error statement { ListAdd($1, $2); }
3155 statement_list_error:
3156 statement_error { $$ = MkList(); ListAdd($$, $1); }
3157 | statement_list statement_error { ListAdd($1, $2); }
3158 | statement_list_error statement_error { ListAdd($1, $2); }
3159 | statement_list declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3160 | statement_list_error declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3161 | statement_list declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3162 | statement_list_error declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3166 statement_list { $$ = MkCompoundStmt(null, $1); }
3167 | declaration_list { $$ = MkCompoundStmt($1, null); }
3168 | declaration_list statement_list { $$ = MkCompoundStmt($1, $2); }
3169 | declaration_list_error statement_list { $$ = MkCompoundStmt($1, $2); }
3172 compound_inside_error:
3173 statement_list_error { $$ = MkCompoundStmt(null, $1); }
3174 | declaration_list_error { $$ = MkCompoundStmt($1, null); }
3175 | declaration_list statement_list_error { $$ = MkCompoundStmt($1, $2); }
3176 | declaration_list_error statement_list_error { $$ = MkCompoundStmt($1, $2); }
3180 '{' { $<context>$ = PushContext(); }
3184 compound_statement_error '}' { $$.loc = @$; }
3187 compound_statement_error:
3188 compound_start compound_inside_error
3189 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3191 { $$ = MkCompoundStmt(null, null); $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3193 | compound_start compound_inside
3194 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3198 expression_statement:
3199 ';' { $$ = MkExpressionStmt(null); $$.loc = @$; }
3200 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3201 | expression_error ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3204 selection_statement:
3205 IF '(' expression ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3206 | IF '(' expression_error ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3207 | IF '(' expression ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3208 | IF '(' expression_error ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3209 | SWITCH '(' expression ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3210 | SWITCH '(' expression_error ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3213 selection_statement_error:
3214 IF '(' expression_error { $$ = MkIfStmt($3, null, null); $$.loc = @$; }
3215 | selection_statement error
3218 iteration_statement:
3219 WHILE '(' expression ')' statement { $$ = MkWhileStmt($3, $5); $$.loc = @$; }
3220 | WHILE '(' expression_error statement { $$ = MkWhileStmt($3, $4); $$.loc = @$; }
3221 | WHILE '(' ')' statement { $$ = MkWhileStmt(null, $4); $$.loc = @$; }
3223 | DO statement WHILE '(' expression ')' ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3224 | DO statement WHILE '(' expression_error ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3226 | FOR '(' expression_statement expression_statement ')' statement { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; }
3227 | FOR '(' expression_statement ')' statement { $$ = MkForStmt($3, null, null, $5); $$.loc = @$; }
3228 | FOR '(' expression_statement expression_statement expression ')' statement { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; }
3229 | FOR '(' expression_statement expression_statement expression_error statement { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; }
3230 | FOR '(' ')' statement { $$ = MkForStmt(null, null, null, $4); $$.loc = @$; }
3232 | FOR '(' identifier ':' expression ')' statement { $$ = MkForEachStmt($3, $5, null, $7); $$.loc = @$; }
3233 | FOR '(' identifier ':' expression ';' expression ')' statement { $$ = MkForEachStmt($3, $5, $7, $9); $$.loc = @$; }
3236 iteration_statement_error:
3237 FOR '(' error { $$ = MkForStmt(null, null, null, null); $$.loc = @$; } |
3238 FOR '(' expression_error error { $$ = MkForStmt(MkExpressionStmt($3), null, null, null); $$.forStmt.init.loc = @3; $$.loc = @$; } |
3239 FOR '(' expression_statement error { $$ = MkForStmt($3, null, null, null); $$.loc = @$; } |
3240 FOR '(' expression_statement expression_error error { $$ = MkForStmt($3, MkExpressionStmt($4), null, null); $$.loc = @$; $$.forStmt.check.loc = @4; } |
3241 FOR '(' expression_statement expression_statement error { $$ = MkForStmt($3, $4, null, null); $$.loc = @$; } |
3242 FOR '(' expression_statement expression_statement expression_error { $$ = MkForStmt($3, $4, $5, null); $$.loc = @$; } |
3243 FOR '(' expression_statement expression_statement ')' statement_error { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; } |
3244 FOR '(' expression_statement expression_statement expression ')' statement_error { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; } |
3245 FOR '(' expression_statement expression_statement expression_error statement_error { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; } |
3247 DO statement WHILE '(' expression ')' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3248 DO statement WHILE '(' expression { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3249 DO statement WHILE '(' expression_error { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3250 DO statement WHILE '(' { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3251 DO statement WHILE { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3252 DO statement { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3253 DO { $$ = MkDoWhileStmt(null, null); $$.loc = @$; } |
3256 WHILE error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3257 WHILE '(' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3258 WHILE '(' ')' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3259 WHILE '(' expression_error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3260 WHILE '(' expression_error error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3261 WHILE '(' expression ')' statement_error { $$ = MkWhileStmt($3, $5); $$.loc = @$; } |
3262 WHILE '(' expression_error statement_error { $$ = MkWhileStmt($3, $4 ); $$.loc = @$; }
3266 GOTO identifier ';' { $$ = MkGotoStmt($2); $$.loc = @$; }
3267 | CONTINUE ';' { $$ = MkContinueStmt(); $$.loc = @$; }
3268 | BREAK ';' { $$ = MkBreakStmt(); $$.loc = @$; }
3269 | RETURN ';' { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc = @2; }
3270 | RETURN expression ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3271 | RETURN expression_error ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3272 | RETURN anon_instantiation_expression ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3273 | RETURN anon_instantiation_expression_error ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3276 jump_statement_error:
3277 RETURN expression_error { $$ = MkReturnStmt($2); $$.loc = @$; } |
3278 RETURN anon_instantiation_expression_error { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; } |
3279 RETURN { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc.start = exp.loc.end = @1.end; } |
3280 GOTO { $$ = MkGotoStmt(null); $$.loc = @$; }
3283 /*************************************************************************************/
3285 function_definition:
3286 external_guess_declaration_specifiers declarator_function declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3287 | external_guess_declaration_specifiers declarator_function compound_statement
3288 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3290 | declarator_function declaration_list compound_statement { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; }
3291 | declarator_function compound_statement { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$;}
3293 function_definition_error:
3294 external_guess_declaration_specifiers declarator_function declaration_list compound_statement_error { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; $$.loc.end = $4.loc.end; }
3295 | external_guess_declaration_specifiers declarator_function compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3296 | declarator_function declaration_list compound_statement_error { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3297 | declarator_function compound_statement_error { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
3301 STRING_LITERAL { $$ = CopyString(yytext); }
3302 | string_literal STRING_LITERAL
3304 int len1 = strlen($1);
3305 int len2 = strlen(yytext);
3306 $$ = new byte[len1-1 + len2-1 + 1];
3307 memcpy($$, $1, len1-1);
3308 memcpy($$ + len1-1, yytext+1, len2);
3313 external_declaration:
3314 function_definition { $$ = MkExternalFunction($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3316 { $$ = MkExternalClass($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3318 | external_guess_declaration_specifiers class
3319 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3321 | external_guess_declaration
3322 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3323 | IMPORT string_literal { $$ = MkExternalImport($2, normalImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3324 | IMPORT STATIC string_literal { $$ = MkExternalImport($3, staticImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3325 | IMPORT identifier string_literal { if(!strcmp($2.string, "remote")) { $$ = MkExternalImport($3, remoteImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; } else yyerror(); FreeIdentifier($2); }
3327 | ';' { $$ = null; }
3329 | declaration_mode function_definition { $$ = MkExternalFunction($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3330 | declaration_mode class
3331 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; declMode = defaultDeclMode; }
3332 | declaration_mode external_guess_declaration { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3333 | declaration_mode IMPORT string_literal { $$ = MkExternalImport($3, normalImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; declMode = defaultDeclMode; }
3334 | declaration_mode IMPORT STATIC string_literal { $$ = MkExternalImport($4, staticImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; declMode = defaultDeclMode; }
3335 | declaration_mode IMPORT identifier string_literal { if(!strcmp($3.string, "remote")) { $$ = MkExternalImport($4, remoteImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; FreeIdentifier($3); } else yyerror(); declMode = defaultDeclMode; }
3336 | declaration_mode ':' { defaultDeclMode = $1; $$ = null; }
3337 | STATIC ':' { defaultDeclMode = staticAccess; $$ = null; }
3338 | NAMESPACE identifier { $$ = MkExternalNameSpace($2); $$.loc = @$; }
3339 | NAMESPACE strict_type { $$ = MkExternalNameSpace(MkIdentifier($2.name)); FreeSpecifier($2); $$.loc = @$; }
3340 | dbtable_definition { $$ = MkExternalDBTable($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3341 | declaration_mode dbtable_definition { $$ = MkExternalDBTable($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3344 external_declaration_error:
3345 class_error { $$ = MkExternalClass($1); $$.loc = $1.loc; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3346 | external_guess_declaration_specifiers class_error { $$ = MkExternalClass($2); $$.loc = $2.loc; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3347 | function_definition_error { $$ = MkExternalFunction($1); $$.loc = $1.loc; $1.declMode = declMode; declMode = defaultDeclMode; }
3349 | declaration_mode class_error { $$ = MkExternalClass($2); $$.loc = $2.loc; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; declMode = defaultDeclMode; }
3350 | declaration_mode function_definition_error { $$ = MkExternalFunction($2); $$.loc = $2.loc; $2.declMode = $1; declMode = defaultDeclMode; }
3352 | external_guess_declaration_error
3353 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3354 | declaration_mode external_guess_declaration_error { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3357 translation_unit_error:
3358 external_declaration_error { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3359 | translation_unit external_declaration_error { ListAdd($1, $2); }
3360 | translation_unit_error external_declaration_error { ListAdd($1, $2); }
3361 | translation_unit error
3362 | translation_unit_error error
3366 external_declaration { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3367 | translation_unit external_declaration { ListAdd($1, $2); }
3368 | translation_unit_error class
3369 { External _class = MkExternalClass($2); ListAdd($1, _class); _class.loc = @2; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3370 | translation_unit_error declaration_mode class
3371 { External _class = MkExternalClass($3); ListAdd($1, _class); _class.loc = @3; $3.declMode = ($2 != defaultAccess) ? $2 : privateAccess; declMode = defaultDeclMode; }
3376 | translation_unit_error
3377 | { ast = MkList(); }
3381 DBTABLE string_literal identifier '{' dbfield_definition_list '}' { Symbol symbol = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3382 | DBTABLE string_literal strict_type '{' dbfield_definition_list '}' { Symbol symbol = DeclClass(globalContext.nextID++, $3.name); FreeSpecifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3383 | DBTABLE string_literal '{' dbfield_definition_list '}' { $$ = MkDBTableDef($2, null, $4); }
3387 guess_declaration_specifiers identifier string_literal ';' { $$ = MkDBFieldEntry(MkTypeName($1, null), $2, $3); }
3391 identifier { $$ = MkDBIndexItem($1, ascending); }
3392 | '>' identifier { $$ = MkDBIndexItem($2, descending); }
3393 | '<' identifier { $$ = MkDBIndexItem($2, ascending); }
3397 dbindex_item { $$ = MkList(); ListAdd($$, $1); }
3398 | dbindex_item_list ',' dbindex_item { ListAdd($1, $3); }
3402 DBINDEX dbindex_item_list ';' { $$ = MkDBIndexEntry($2, null); }
3403 | DBINDEX dbindex_item_list identifier ';' { $$ = MkDBIndexEntry($2, $3); }
3406 dbfield_definition_list:
3407 dbfield_entry { $$ = MkList(); ListAdd($$, $1); }
3408 | dbindex_entry { $$ = MkList(); ListAdd($$, $1); }
3409 | dbfield_definition_list dbfield_entry { ListAdd($1, $2); }
3410 | dbfield_definition_list dbindex_entry { ListAdd($1, $2); }
3414 DATABASE_OPEN '(' assignment_expression ',' assignment_expression ')' { $$ = MkExpDBOpen($3, $5); }
3418 DBFIELD '(' string_literal ',' identifier ')' { $$ = MkExpDBField($3, $5); }
3422 DBINDEX '(' string_literal ',' identifier ')' { $$ = MkExpDBIndex($3, $5); }
3426 DBTABLE '(' string_literal ')' { $$ = MkExpDBTable($3); }