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); delete $2; $$.loc = @$; }
1394 | '(' ')' { Expression exp = MkExpDummy(); exp.loc.start = @1.end; exp.loc.end = @2.start; $$ = MkExpBrackets(MkListOne(exp)); $$.loc = @$; yyerror(); }
1395 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1396 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1397 | NEWOP new_specifiers '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1398 | NEWOP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1399 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1400 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1401 | NEW0OP new_specifiers '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1402 | NEW0OP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1403 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1404 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1405 | RENEW constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1406 | RENEW constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1407 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1408 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1409 | RENEW0 constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1410 | RENEW0 constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1411 | CLASS '(' declaration_specifiers ')' { $$ = MkExpClass($3, null); $$.loc = @$; }
1412 | CLASS '(' declaration_specifiers abstract_declarator ')' { $$ = MkExpClass($3, $4); $$.loc = @$; }
1413 | CLASS '(' identifier ')' { $$ = MkExpClass(MkListOne(MkSpecifierName($3.string)), null); FreeIdentifier($3); $$.loc = @$; }
1414 | VAARG '(' assignment_expression ',' type_name ')' { $$ = MkExpVaArg($3, $5); $$.loc = @$; }
1416 | CLASS_DATA '(' identifier ')' { $$ = MkExpClassData($3); $$.loc = @$; }
1422 | '[' argument_expression_list /*expression*/ ']' { $$ = MkExpArray($2); $$.loc = @$; }
1425 anon_instantiation_expression:
1426 instantiation_anon { $$ = MkExpInstance($1); $$.loc = @$; }
1429 anon_instantiation_expression_error:
1430 instantiation_anon_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1433 primary_expression_error:
1434 '(' expression { $$ = MkExpBrackets($2); $$.loc = @$; }
1435 | '(' expression_error { $$ = MkExpBrackets($2); $$.loc = @$; }
1441 | postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1442 | postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1443 | postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1444 | postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1445 | 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; }
1446 | postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1447 | postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1448 | postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1449 | postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1451 | postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1452 | postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1453 | postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1454 | postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1455 | postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1456 | postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1457 | postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1458 | postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1461 simple_postfix_expression:
1462 simple_primary_expression
1464 | simple_postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1465 | simple_postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1466 | simple_postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1467 | simple_postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1468 | 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; }
1469 | simple_postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1470 | simple_postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1471 | simple_postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1472 | simple_postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1474 | simple_postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1475 | simple_postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1476 | simple_postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1477 | simple_postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1478 | simple_postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1479 | simple_postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1480 | simple_postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1481 | simple_postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1484 argument_expression_list:
1485 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1486 | anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1487 | argument_expression_list ',' assignment_expression { ListAdd($1, $3); }
1488 | argument_expression_list ',' anon_instantiation_expression { ListAdd($1, $3); }
1491 argument_expression_list_error:
1492 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
1493 | anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
1494 | argument_expression_list ',' assignment_expression_error { ListAdd($1, $3); }
1495 | argument_expression_list ',' anon_instantiation_expression_error { ListAdd($1, $3); }
1496 | argument_expression_list ',' { Expression exp = MkExpDummy(); exp.loc.start = @2.end; exp.loc.end = @2.end; ListAdd($1, exp); }
1499 common_unary_expression:
1500 INC_OP unary_expression { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1501 | DEC_OP unary_expression { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1502 | unary_operator cast_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1503 | unary_operator anon_instantiation_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1504 | SIZEOF '(' unary_expression ')' { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1505 | SIZEOF simple_unary_expression { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1506 | SIZEOF '(' guess_type_name ')' { $$ = MkExpTypeSize($3); $$.loc = @$; }
1507 | SIZEOF '(' CLASS type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1508 | SIZEOF '(' CLASS guess_type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1512 common_unary_expression
1513 | postfix_expression
1516 simple_unary_expression:
1517 common_unary_expression
1518 | simple_postfix_expression
1528 | DELETE { $$ = DELETE; }
1529 | _INCREF { $$ = _INCREF; }
1534 | '(' type_name ')' cast_expression { $$ = MkExpCast($2, $4); $$.loc = @$; }
1537 multiplicative_expression:
1539 | multiplicative_expression '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1540 | multiplicative_expression '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1541 | multiplicative_expression '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1542 | multiplicative_expression_error '*' 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 = @$; }
1547 additive_expression:
1548 multiplicative_expression
1549 | additive_expression '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1550 | additive_expression '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1551 | additive_expression_error '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1552 | additive_expression_error '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1557 | shift_expression LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1558 | shift_expression RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1559 | shift_expression_error LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1560 | shift_expression_error RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1563 relational_expression_smaller_than:
1564 relational_expression '<'
1571 relational_expression:
1573 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression { skipErrors = false; $$ = MkExpOp($1, '<', $2/*$3*/); $$.loc = @$; }
1574 | relational_expression '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1575 | relational_expression LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1576 | relational_expression GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1577 | relational_expression_error '<' shift_expression { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1578 | relational_expression_error '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1579 | relational_expression_error LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1580 | relational_expression_error GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1584 : relational_expression
1585 | equality_expression EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1586 | equality_expression NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1587 | equality_expression_error EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1588 | equality_expression_error NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1590 | equality_expression EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1591 | equality_expression NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1592 | equality_expression_error EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1593 | equality_expression_error NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1597 : equality_expression
1598 | and_expression '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1599 | and_expression_error '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1601 | and_expression '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1602 | and_expression_error '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1605 exclusive_or_expression
1607 | exclusive_or_expression '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1608 | exclusive_or_expression_error '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1610 | exclusive_or_expression '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1611 | exclusive_or_expression_error '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1614 inclusive_or_expression
1615 : exclusive_or_expression
1616 | inclusive_or_expression '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1617 | inclusive_or_expression_error '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1619 | inclusive_or_expression '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1620 | inclusive_or_expression_error '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1623 logical_and_expression
1624 : inclusive_or_expression
1625 | logical_and_expression AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1626 | logical_and_expression_error AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1629 logical_or_expression
1630 : logical_and_expression
1631 | logical_or_expression OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1632 | logical_or_expression_error OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1635 conditional_expression
1636 : logical_or_expression
1637 | logical_or_expression '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1638 | logical_or_expression '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1639 | logical_or_expression_error '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1640 | logical_or_expression_error '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1642 | logical_or_expression '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1643 | logical_or_expression '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1644 | logical_or_expression_error '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1645 | logical_or_expression_error '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1647 | logical_or_expression '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1648 | logical_or_expression '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1649 | logical_or_expression_error '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1650 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1652 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1653 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1654 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1655 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1658 assignment_expression:
1659 conditional_expression
1660 | unary_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1661 | unary_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1662 | conditional_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; } // TODO: Generate error here:
1663 | conditional_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; } // TODO: Generate error here:
1665 | unary_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1666 | unary_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1667 | conditional_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1668 | conditional_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1671 assignment_operator:
1673 | MUL_ASSIGN { $$ = MUL_ASSIGN; }
1674 | DIV_ASSIGN { $$ = DIV_ASSIGN; }
1675 | MOD_ASSIGN { $$ = MOD_ASSIGN; }
1676 | ADD_ASSIGN { $$ = ADD_ASSIGN; }
1677 | SUB_ASSIGN { $$ = SUB_ASSIGN; }
1678 | LEFT_ASSIGN { $$ = LEFT_ASSIGN; }
1679 | RIGHT_ASSIGN { $$ = RIGHT_ASSIGN; }
1680 | AND_ASSIGN { $$ = AND_ASSIGN; }
1681 | XOR_ASSIGN { $$ = XOR_ASSIGN; }
1682 | OR_ASSIGN { $$ = OR_ASSIGN; }
1686 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1687 | expression ',' assignment_expression { ListAdd($1, $3); }
1688 | expression_error ',' assignment_expression { ListAdd($1, $3); }
1689 | expression_error ')'
1692 expression_anon_inst:
1693 anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1694 | expression ',' anon_instantiation_expression { ListAdd($1, $3); }
1695 | expression_error ',' anon_instantiation_expression { ListAdd($1, $3); }
1698 postfix_expression_error:
1699 primary_expression_error
1700 | error { $$ = MkExpDummy(); $$.loc = @$; /*printf("Sorry, didn't mean that syntax error\n");*/ }
1701 | postfix_expression error
1702 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1704 | postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1705 | postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1707 | postfix_expression '(' argument_expression_list { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1708 | postfix_expression '(' argument_expression_list_error { $$ = 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 = @4.end;$$.loc = @$; $$.call.argLoc.end.charPos++;}
1710 | 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++;*/ }
1711 | postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1713 | 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++;}
1714 | 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++;}
1715 | postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1716 | postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1719 simple_postfix_expression_error:
1720 error { $$ = MkExpDummy(); $$.loc = @$; }
1721 | simple_postfix_expression error
1722 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1724 | simple_postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1725 | simple_postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1727 | simple_postfix_expression '(' argument_expression_list { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1728 | 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++;}
1729 | 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++;}
1730 | 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++;*/ }
1731 | simple_postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1733 | 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++;}
1734 | 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++;}
1735 | simple_postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1736 | simple_postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1739 common_unary_expression_error:
1740 INC_OP unary_expression_error { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1741 | DEC_OP unary_expression_error { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1742 | unary_operator cast_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1743 | unary_operator anon_instantiation_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1744 | SIZEOF '(' unary_expression_error { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1745 | SIZEOF simple_unary_expression_error { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1746 | SIZEOF '(' guess_type_name ')' error { $$ = MkExpTypeSize($3); $$.loc = @$; }
1747 | SIZEOF '(' CLASS type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1748 | SIZEOF '(' CLASS guess_type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1751 unary_expression_error:
1752 common_unary_expression_error
1753 | postfix_expression_error
1756 simple_unary_expression_error:
1757 common_unary_expression_error
1758 | simple_postfix_expression_error
1762 cast_expression_error:
1763 unary_expression_error
1764 | '(' type_name ')' cast_expression_error { $$ = MkExpCast($2, $4); $$.loc = @$; }
1767 multiplicative_expression_error:
1768 cast_expression_error
1769 | multiplicative_expression '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1770 | multiplicative_expression '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1771 | multiplicative_expression '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1772 | multiplicative_expression_error '*' 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 = @$; }
1777 additive_expression_error:
1778 multiplicative_expression_error
1779 | additive_expression '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1780 | additive_expression '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1781 | additive_expression '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1782 | additive_expression '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1783 | additive_expression_error '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1784 | additive_expression_error '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1785 | additive_expression_error '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1786 | additive_expression_error '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1789 shift_expression_error:
1790 additive_expression_error
1791 | shift_expression LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1792 | shift_expression RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1793 | shift_expression_error LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1794 | shift_expression_error RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1797 relational_expression_error:
1798 shift_expression_error
1799 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression_error
1801 if($1.type == identifierExp)
1803 if($1.identifier._class && !$1.identifier._class.name)
1807 strcat(name, $1.identifier.string);
1808 _DeclClass(0, name);
1811 _DeclClass(0, $1.identifier.string);
1813 // printf("Declaring Class %s\n", $1.identifier.string);
1818 fileInput.Seek(@1.start.pos, start);
1819 resetScannerPos(&@1.start);
1824 YY_STACK_PRINT (yyss, yyssp);
1828 YY_STACK_PRINT (yyss, yyssp);
1832 YY_STACK_PRINT (yyss, yyssp);
1836 YY_STACK_PRINT (yyss, yyssp);
1844 $$ = MkExpOp($1, '<', $2);
1849 | relational_expression '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1850 | relational_expression LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1851 | relational_expression GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1852 | relational_expression_error '<' shift_expression_error { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1853 | relational_expression_error '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1854 | relational_expression_error LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1855 | relational_expression_error GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1858 equality_expression_error:
1859 relational_expression_error
1860 | equality_expression EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1861 | equality_expression NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1862 | equality_expression_error EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1863 | equality_expression_error NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1865 | equality_expression EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1866 | equality_expression NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1867 | equality_expression_error EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1868 | equality_expression_error NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1870 | equality_expression EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1871 | equality_expression NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1872 | equality_expression_error EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1873 | equality_expression_error NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1876 and_expression_error:
1877 equality_expression_error
1878 | and_expression '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1879 | and_expression_error '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1881 | and_expression '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1882 | and_expression_error '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1885 exclusive_or_expression_error:
1886 and_expression_error
1887 | exclusive_or_expression '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1888 | exclusive_or_expression_error '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1890 | exclusive_or_expression '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1891 | exclusive_or_expression_error '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1894 inclusive_or_expression_error:
1895 exclusive_or_expression_error
1896 | inclusive_or_expression '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1897 | inclusive_or_expression_error '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1899 | inclusive_or_expression '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1900 | inclusive_or_expression_error '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1903 logical_and_expression_error:
1904 inclusive_or_expression_error
1905 | logical_and_expression AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1906 | logical_and_expression_error AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1909 logical_or_expression_error:
1910 logical_and_expression_error
1911 | logical_or_expression OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1912 | logical_or_expression_error OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1915 conditional_expression_error:
1916 logical_or_expression_error
1917 | logical_or_expression '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1918 | logical_or_expression '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1919 | logical_or_expression_error '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1920 | logical_or_expression_error '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1921 | logical_or_expression '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1922 | logical_or_expression '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1923 | logical_or_expression_error '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1924 | logical_or_expression_error '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1926 | logical_or_expression '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1927 | logical_or_expression '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1928 | logical_or_expression_error '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1929 | logical_or_expression_error '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1930 | logical_or_expression '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1931 | logical_or_expression '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1932 | logical_or_expression_error '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1933 | logical_or_expression_error '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1935 | logical_or_expression '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1936 | logical_or_expression '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1937 | logical_or_expression_error '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1938 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1940 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1941 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1942 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1943 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1945 | logical_or_expression '?' ':'
1947 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy());
1949 ((Expression)$$.cond.exp->last).loc = @2;
1950 $$.cond.elseExp.loc = @3;
1952 | logical_or_expression_error '?' ':'
1954 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @3;
1956 | logical_or_expression '?'
1958 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
1960 | logical_or_expression_error '?'
1962 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
1966 assignment_expression_error:
1967 conditional_expression_error
1968 | unary_expression assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1969 | unary_expression assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
1970 | unary_expression_error assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1971 | unary_expression_error assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
1973 | unary_expression assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1974 | unary_expression_error assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1978 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
1979 | assignment_expression error { $$ = MkList(); ListAdd($$, $1); }
1980 | expression ',' assignment_expression_error { ListAdd($1, $3); }
1981 | expression_error ',' assignment_expression_error { ListAdd($1, $3); }
1982 | expression ',' error
1983 | expression_error ',' error
1985 | expression expression
1986 | expression_error expression
1987 | expression expression_error
1990 expression_anon_inst_error:
1991 anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
1992 | anon_instantiation_expression error { $$ = MkList(); ListAdd($$, $1); }
1993 | expression ',' anon_instantiation_expression_error { ListAdd($1, $3); }
1994 | expression_error ',' anon_instantiation_expression_error { ListAdd($1, $3); }
1998 constant_expression: conditional_expression;
2000 constant_expression_error: conditional_expression_error;
2002 /**** TYPES **************************************************************************/
2003 storage_class_specifier:
2004 TYPEDEF { $$ = MkSpecifier(TYPEDEF); }
2005 | EXTERN { $$ = MkSpecifier(EXTERN); }
2006 | STATIC { $$ = MkSpecifier(STATIC); }
2007 | AUTO { $$ = MkSpecifier(AUTO); }
2008 | REGISTER { $$ = MkSpecifier(REGISTER); }
2011 external_storage_class_specifier:
2012 TYPEDEF { $$ = MkSpecifier(TYPEDEF); declMode = defaultAccess; }
2013 | EXTERN { $$ = MkSpecifier(EXTERN); }
2014 | STATIC { $$ = MkSpecifier(STATIC); declMode = staticAccess; }
2015 | AUTO { $$ = MkSpecifier(AUTO); }
2016 | REGISTER { $$ = MkSpecifier(REGISTER); }
2020 identifier { $$ = MkEnumerator($1, null); }
2021 | identifier '=' constant_expression { $$ = MkEnumerator($1, $3); }
2022 | identifier '=' constant_expression_error { $$ = MkEnumerator($1, $3); }
2026 enumerator { $$ = MkList(); ListAdd($$, $1); }
2027 | enumerator_list ',' enumerator { ListAdd($1, $3); }
2028 | enumerator_list ','
2032 ENUM { memberAccessStack[++defaultMemberAccess] = publicAccess; }
2035 enum_specifier_nocompound:
2036 enum_specifier identifier { $$ = MkEnum($2, null); POP_DEFAULT_ACCESS }
2037 | enum_specifier strict_type { $$ = MkEnum(MkIdentifier($2.name), null); POP_DEFAULT_ACCESS }
2040 enum_specifier_compound:
2041 enum_specifier_compound_error '}' { $$.loc = @$; POP_DEFAULT_ACCESS }
2042 | enum_specifier identifier '{' '}' { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2043 | enum_specifier strict_type '{' '}' { $$ = MkEnum(MkIdentifier($2.name), null); FreeSpecifier($2); $$.loc = @$; POP_DEFAULT_ACCESS }
2046 enum_specifier_compound_error:
2047 enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2048 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2050 | enum_specifier identifier '{' enumerator_list { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2051 | enum_specifier identifier '{' enumerator_list error { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2052 | enum_specifier identifier '{' error { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2053 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2054 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2056 | enum_specifier strict_type '{' enumerator_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2057 | enum_specifier strict_type '{' enumerator_list error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2058 | enum_specifier strict_type '{' error { $$ = MkEnum(MkIdentifier($2.name), null); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2059 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2060 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2064 enum_specifier identifier { $$ = $2; if(declMode) DeclClassAddNameSpace(globalContext.nextID++, $2.string); }
2065 | enum_specifier strict_type { $$ = MkIdentifier($2.name); if(declMode) DeclClass(globalContext.nextID++, $2.name); FreeSpecifier($2); }
2069 enum_class_error '}' { $$.loc = @$; }
2070 | enum_decl ':' inheritance_specifiers '{' '}' { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2071 | enum_decl '{' '}' { $$ = MkEnum($1, null); POP_DEFAULT_ACCESS }
2075 enum_decl ':' inheritance_specifiers '{' enumerator_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2076 | enum_decl ':' inheritance_specifiers '{' enumerator_list error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2077 | enum_decl ':' inheritance_specifiers '{' error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2078 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2079 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2080 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2081 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2082 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2083 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list_error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2085 | enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2086 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2088 | enum_decl '{' enumerator_list { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2089 | enum_decl '{' enumerator_list error { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2090 | enum_decl '{' error { $$ = MkEnum($1, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2091 | enum_decl '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2092 | enum_decl '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2100 class_specifier_error:
2102 | struct_class_error
2106 EXT_STORAGE { $$ = MkSpecifierExtended(yytext); }
2107 | ext_decl { $$ = MkSpecifierExtended($1); delete $1; }
2111 CONST { $$ = MkSpecifier(CONST); }
2112 | VOLATILE { $$ = MkSpecifier(VOLATILE); }
2113 | ext_storage { $$ = $1; }
2117 type_qualifier_list:
2118 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2119 | type_qualifier_list type_qualifier { ListAdd($1, $2); }
2123 VOID { $$ = MkSpecifier(VOID); }
2124 | CHAR { $$ = MkSpecifier(CHAR); }
2125 | SHORT { $$ = MkSpecifier(SHORT); }
2126 | INT { $$ = MkSpecifier(INT); }
2127 | UINT { $$ = MkSpecifier(UINT); }
2128 | INT64 { $$ = MkSpecifier(INT64); }
2129 | VALIST { $$ = MkSpecifier(VALIST); }
2130 | LONG { $$ = MkSpecifier(LONG); }
2131 | FLOAT { $$ = MkSpecifier(FLOAT); }
2132 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2133 | SIGNED { $$ = MkSpecifier(SIGNED); }
2134 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2135 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2136 | struct_or_union_specifier_nocompound
2137 | enum_specifier_nocompound
2139 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2140 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2141 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2142 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2143 | TYPED_OBJECT { $$ = MkSpecifier(TYPED_OBJECT); }
2144 | ANY_OBJECT { $$ = MkSpecifier(ANY_OBJECT); }
2147 strict_type_specifier:
2148 VOID { $$ = MkSpecifier(VOID); }
2149 | CHAR { $$ = MkSpecifier(CHAR); }
2150 | SHORT { $$ = MkSpecifier(SHORT); }
2151 | INT { $$ = MkSpecifier(INT); }
2152 | UINT { $$ = MkSpecifier(UINT); }
2153 | INT64 { $$ = MkSpecifier(INT64); }
2154 | VALIST { $$ = MkSpecifier(VALIST); }
2155 | LONG { $$ = MkSpecifier(LONG); }
2156 | FLOAT { $$ = MkSpecifier(FLOAT); }
2157 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2158 | SIGNED { $$ = MkSpecifier(SIGNED); }
2159 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2160 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2161 | struct_or_union_specifier_nocompound
2162 | enum_specifier_nocompound
2164 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2165 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2166 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2167 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2170 // TESTING declarator_nofunction here... For function declarations
2173 declarator_nofunction
2174 { $$ = MkStructDeclarator($1, null); $$.loc = @$; }
2175 | declarator_nofunction ext_attrib
2176 { $$ = MkStructDeclarator($1, null); $$.structDecl.attrib = $2; $$.loc = @$; }
2177 | ':' constant_expression
2178 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2179 | declarator_nofunction ':' constant_expression
2180 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2181 | declarator_nofunction ':' constant_expression ':' constant_expression
2182 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2183 | ':' constant_expression_error
2184 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2185 | declarator_nofunction ':' constant_expression_error
2186 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2187 | declarator_nofunction ':' constant_expression ':' constant_expression_error
2188 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2189 | declarator_nofunction ':' constant_expression_error ':' constant_expression_error
2190 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2191 | declarator_nofunction ':' constant_expression_error ':' constant_expression
2192 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2195 struct_declarator_list:
2196 struct_declarator { $$ = MkList(); ListAdd($$, $1); }
2197 | struct_declarator_list ',' struct_declarator { ListAdd($1, $3); }
2201 struct_or_union identifier
2203 $$ = MkStructOrUnion($1, $2, null);
2204 $$.addNameSpace = true;
2205 $$.ctx = PushContext();
2207 | struct_or_union base_strict_type
2209 $$ = MkStructOrUnion($1, MkIdentifier($2.name), null);
2210 $$.ctx = PushContext();
2215 struct_or_union_specifier_compound:
2216 struct_or_union_specifier_compound_error '}' { $$.loc = @$; }
2217 | struct_entry '{' '}' { $$ = $1; $$.loc = @$; POP_DEFAULT_ACCESS PopContext(curContext); }
2218 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2221 struct_or_union_specifier_compound_error:
2222 struct_entry '{' struct_declaration_list { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2223 | struct_entry '{' struct_declaration_list_error { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2224 | struct_entry '{' error { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2226 | struct_or_union '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2227 | struct_or_union '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2228 | struct_or_union '{' error { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2231 struct_or_union_specifier_nocompound:
2232 struct_entry { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2241 ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2244 | struct_entry '<' template_parameters_list '>'
2246 Symbol symbol = ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2248 symbol.templateParams = $3;
2253 struct_decl ':' inheritance_specifiers
2257 SetupBaseSpecs(null, $3);
2262 struct_class_error '}' { $$.loc = @$; }
2263 | struct_head '{' '}'
2264 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2265 | struct_decl '{' '}' { POP_DEFAULT_ACCESS PopContext(curContext); }
2266 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2270 struct_head '{' struct_declaration_list
2273 $$.definitions = $3;
2275 PopContext(curContext);
2277 | struct_head '{' struct_declaration_list_error
2280 $$.definitions = $3;
2282 PopContext(curContext);
2284 | struct_head '{' error
2285 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext);}
2287 | struct_decl '{' struct_declaration_list
2289 PopContext(curContext);
2292 $$ = MkStructOrUnion($1.type, $1.id, $3);
2297 $$.definitions = $3;
2300 | struct_decl '{' struct_declaration_list_error
2302 PopContext(curContext);
2306 $$ = MkStructOrUnion($1.type, $1.id, $3);
2311 $$.definitions = $3;
2314 | struct_decl '{' error
2315 { POP_DEFAULT_ACCESS PopContext(curContext); }
2317 | struct_or_union '{' struct_declaration_list
2318 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2319 | struct_or_union '{' struct_declaration_list_error
2320 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2321 | struct_or_union '{' error
2322 { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2326 STRUCT { $$ = structSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2327 | UNION { $$ = unionSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2330 specifier_qualifier_list:
2331 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2332 | specifier_qualifier_list type_qualifier { ListAdd($1, $2); }
2333 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2334 | specifier_qualifier_list type_specifier { ListAdd($1, $2); }
2335 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2336 | specifier_qualifier_list enum_specifier_compound { ListAdd($1, $2); }
2337 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2338 | specifier_qualifier_list struct_or_union_specifier_compound { ListAdd($1, $2); }
2341 guess_specifier_qualifier_list:
2342 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2343 | guess_specifier_qualifier_list type_qualifier { ListAdd($1, $2); }
2344 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2345 | guess_specifier_qualifier_list type_specifier { ListAdd($1, $2); }
2346 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2347 | guess_specifier_qualifier_list guess_type { ListAdd($1, $2); }
2348 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2349 | guess_specifier_qualifier_list enum_specifier_compound { ListAdd($1, $2); }
2350 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2351 | guess_specifier_qualifier_list struct_or_union_specifier_compound { ListAdd($1, $2); }
2354 declaration_specifiers:
2355 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2356 | declaration_specifiers storage_class_specifier { ListAdd($1, $2); }
2357 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2358 | declaration_specifiers type_qualifier { ListAdd($1, $2); }
2359 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2360 | declaration_specifiers strict_type_specifier { ListAdd($1, $2); }
2361 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2362 | declaration_specifiers enum_specifier_compound { ListAdd($1, $2); }
2363 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2364 | declaration_specifiers struct_or_union_specifier_compound { ListAdd($1, $2); }
2367 guess_declaration_specifiers:
2368 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2369 | guess_declaration_specifiers storage_class_specifier { ListAdd($1, $2); }
2370 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2371 | guess_declaration_specifiers type_qualifier { ListAdd($1, $2); }
2372 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2373 | guess_declaration_specifiers type_specifier { ListAdd($1, $2); }
2374 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2375 | guess_declaration_specifiers guess_type { ListAdd($1, $2); }
2376 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2377 | guess_declaration_specifiers struct_or_union_specifier_compound { ListAdd($1, $2); }
2378 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2379 | guess_declaration_specifiers enum_specifier_compound { ListAdd($1, $2); }
2382 external_guess_declaration_specifiers:
2383 external_storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2384 | external_guess_declaration_specifiers external_storage_class_specifier { ListAdd($1, $2); }
2385 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2386 | external_guess_declaration_specifiers type_qualifier { ListAdd($1, $2); }
2387 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2388 | external_guess_declaration_specifiers type_specifier { ListAdd($1, $2); }
2389 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2390 | external_guess_declaration_specifiers guess_type { ListAdd($1, $2); }
2391 | class_specifier { $$ = MkList(); ListAdd($$, $1); }
2392 | external_guess_declaration_specifiers class_specifier { ListAdd($1, $2); }
2395 external_guess_declaration_specifiers_error:
2396 class_specifier_error { $$ = MkList(); ListAdd($$, $1); }
2397 | external_guess_declaration_specifiers class_specifier_error { ListAdd($1, $2); }
2400 _inheritance_specifiers:
2401 PRIVATE { $$ = MkList(); ListAdd($$, MkSpecifier(PRIVATE)); }
2402 | PUBLIC { $$ = MkList(); ListAdd($$, MkSpecifier(PUBLIC)); }
2403 | storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2404 | _inheritance_specifiers storage_class_specifier { ListAdd($1, $2); }
2405 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2406 | _inheritance_specifiers type_qualifier { ListAdd($1, $2); }
2407 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2408 | _inheritance_specifiers strict_type_specifier { ListAdd($1, $2); }
2410 { _DeclClass(0, $1.string); $$ = MkListOne(MkSpecifierName($1.string)); FreeIdentifier($1); }
2411 | _inheritance_specifiers identifier { _DeclClass(0, $2.string); ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2); }
2413 | identifier '<' template_arguments_list '>'
2415 // if($1._class && !$1._class.name)
2419 strcpy(name, $1._class.name ? $1._class.name : "");
2421 strcat(name, $1.string);
2422 _DeclClass(0, name);
2425 _DeclClass(0, $1.string);
2428 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2431 | _inheritance_specifiers identifier '<' template_arguments_list '>'
2433 if($2._class && !$2._class.name)
2437 strcat(name, $2.string);
2438 _DeclClass(0, name);
2441 _DeclClass(0, $2.string);
2442 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2447 inheritance_specifiers:
2448 _inheritance_specifiers
2449 | struct_or_union { $$ = MkListOne(MkStructOrUnion($1, null, null)); POP_DEFAULT_ACCESS }
2452 property_specifiers:
2453 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2454 | property_specifiers storage_class_specifier { ListAdd($1, $2); }
2455 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2456 | property_specifiers type_qualifier { ListAdd($1, $2); }
2457 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2458 | property_specifiers strict_type_specifier { ListAdd($1, $2); }
2459 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2460 | property_specifiers identifier { ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2461 | identifier '<' template_arguments_list '>'
2463 // if($1._class && !$1._class.name)
2467 strcpy(name, $1._class.name ? $1._class.name : "");
2469 strcat(name, $1.string);
2470 _DeclClass(0, name);
2473 _DeclClass(0, $1.string);
2476 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2479 | property_specifiers identifier '<' template_arguments_list '>'
2481 if($2._class && !$2._class.name)
2485 strcat(name, $2.string);
2486 _DeclClass(0, name);
2489 _DeclClass(0, $2.string);
2490 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2496 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2497 | renew_specifiers storage_class_specifier { ListAdd($1, $2); }
2498 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2499 | renew_specifiers type_qualifier { ListAdd($1, $2); }
2500 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2501 | renew_specifiers strict_type_specifier { ListAdd($1, $2); }
2502 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2503 | renew_specifiers struct_or_union_specifier_compound { ListAdd($1, $2); }
2504 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2505 | renew_specifiers enum_specifier_compound { ListAdd($1, $2); }
2506 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2507 | renew_specifiers identifier { ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2508 | identifier '<' template_arguments_list '>'
2510 // if($1._class && !$1._class.name)
2514 strcpy(name, $1._class.name ? $1._class.name : "");
2516 strcat(name, $1.string);
2517 _DeclClass(0, name);
2520 _DeclClass(0, $1.string);
2523 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2526 | renew_specifiers identifier '<' template_arguments_list '>'
2528 if($2._class && !$2._class.name)
2532 strcat(name, $2.string);
2533 _DeclClass(0, name);
2536 _DeclClass(0, $2.string);
2537 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2543 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2544 | new_specifiers storage_class_specifier { ListAdd($1, $2); }
2545 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2546 | new_specifiers type_qualifier { ListAdd($1, $2); }
2547 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2548 | new_specifiers strict_type_specifier { ListAdd($1, $2); }
2549 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2550 | new_specifiers struct_or_union_specifier_compound { ListAdd($1, $2); }
2551 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2552 | new_specifiers enum_specifier_compound { ListAdd($1, $2); }
2553 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2554 | new_specifiers identifier { ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2555 | identifier '<' template_arguments_list '>'
2557 // if($1._class && !$1._class.name)
2561 strcpy(name, $1._class.name ? $1._class.name : "");
2563 strcat(name, $1.string);
2564 _DeclClass(0, name);
2567 _DeclClass(0, $1.string);
2570 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2573 | new_specifiers identifier '<' template_arguments_list '>'
2575 if($2._class && !$2._class.name)
2579 strcat(name, $2.string);
2580 _DeclClass(0, name);
2583 _DeclClass(0, $2.string);
2584 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2589 identifier_list_error:
2590 identifier_list ',' error { ListAdd($1, null); }
2591 | identifier_list_error ',' error { ListAdd($1, null); }
2595 identifier { $$ = MkList(); ListAdd($$, MkTypeName(null, MkDeclaratorIdentifier($1))); }
2596 | identifier_list ',' identifier { ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2597 | identifier_list_error ',' identifier { ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2598 | parameter_list ',' identifier { ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2599 | parameter_list_error ',' identifier { ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2602 direct_declarator_nofunction:
2603 identifier { $$ = MkDeclaratorIdentifier($1); }
2604 | '(' declarator ')' { $$ = MkDeclaratorBrackets($2); }
2605 | direct_declarator_nofunction '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2606 | direct_declarator_nofunction '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2607 | direct_declarator_nofunction '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2608 | direct_declarator_nofunction '[' ']' { $$ = MkDeclaratorArray($1, null); }
2611 direct_declarator_function_start:
2612 direct_declarator_nofunction '('
2615 direct_declarator_function:
2616 direct_declarator_function_start parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2617 | direct_declarator_function_start parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2618 | direct_declarator_function_start identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2619 | direct_declarator_function_start identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2620 | direct_declarator_function_start ')' { $$ = MkDeclaratorFunction($1, null); }
2623 // Tricky stuff here for overriding...
2624 direct_declarator_function_error:
2625 direct_declarator_function_start identifier_list_error
2627 $$ = MkDeclaratorFunction($1, null);
2628 fileInput.Seek(@1.end.pos, start);
2630 resetScannerPos(&@1.end);
2631 @$.start = @1.start;
2634 | direct_declarator_function_start error
2636 $$ = MkDeclaratorFunction($1, null);
2637 fileInput.Seek(@1.end.pos, start);
2639 resetScannerPos(&@1.end);
2640 @$.start = @1.start;
2643 | direct_declarator_function_start parameter_list '('
2645 $$ = MkDeclaratorFunction($1, null);
2646 fileInput.Seek(@1.end.pos, start);
2648 resetScannerPos(&@1.end);
2649 @$.start = @1.start;
2652 | direct_declarator_function_start guess_declaration_specifiers identifier '('
2654 $$ = MkDeclaratorFunction($1, null);
2655 fileInput.Seek(@1.end.pos, start);
2657 resetScannerPos(&@1.end);
2658 @$.start = @1.start;
2665 direct_declarator_function
2666 | direct_declarator_nofunction
2667 | ext_decl direct_declarator_function
2668 { $$ = MkDeclaratorExtended($1, $2); }
2669 | ext_decl direct_declarator_nofunction
2670 { $$ = MkDeclaratorExtended($1, $2); }
2675 ASM '(' STRING_LITERAL { $<string>$ = CopyString(yytext); } STRING_LITERAL { $<string>$ = CopyString(yytext); }
2678 strcpy(temp, "__asm__(");
2679 strcat(temp, $<string>4);
2681 strcat(temp, $<string>6);
2684 $<string>$ = CopyString(temp);
2689 EXT_DECL { $$ = CopyString(yytext); }
2694 strcpy(temp, $<string>1);
2697 $$ = CopyString(temp);
2699 | asm_start STRING_LITERAL { $$ = CopyString(yytext); } ')'
2702 strcpy(temp, $<string>1);
2704 strcat(temp, $<string>3);
2708 $$ = CopyString(temp);
2714 EXT_DECL { $$ = CopyString(yytext); }
2716 | ASM '(' string_literal ')'
2719 strcpy(temp, "__asm__(");
2722 $$ = CopyString(temp);
2728 EXT_ATTRIB { $$ = CopyString(yytext); }
2732 direct_abstract_declarator:
2733 '(' abstract_declarator ')'
2734 { $$ = MkDeclaratorBrackets($2); }
2736 { $$ = MkDeclaratorArray(null, null); }
2737 | '[' constant_expression ']'
2738 { $$ = MkDeclaratorArray(null, $2); }
2739 | '[' constant_expression_error ']'
2740 { $$ = MkDeclaratorArray(null, $2); }
2742 { $$ = MkDeclaratorEnumArray(null, $2); }
2743 | direct_abstract_declarator '[' ']'
2744 { $$ = MkDeclaratorArray($1, null); }
2745 | direct_abstract_declarator '[' constant_expression ']'
2746 { $$ = MkDeclaratorArray($1, $3); }
2747 | direct_abstract_declarator '[' type']'
2748 { $$ = MkDeclaratorEnumArray($1, $3); }
2749 | direct_abstract_declarator '[' constant_expression_error ']'
2750 { $$ = MkDeclaratorArray($1, $3); }
2752 { $$ = MkDeclaratorFunction(null, null); }
2753 | '(' parameter_type_list ')'
2754 { $$ = MkDeclaratorFunction(null, $2); }
2755 | '(' parameter_type_list_error ')'
2756 { $$ = MkDeclaratorFunction(null, $2); }
2757 | direct_abstract_declarator '(' ')'
2758 { $$ = MkDeclaratorFunction($1, null); }
2759 | direct_abstract_declarator '(' parameter_type_list ')'
2760 { $$ = MkDeclaratorFunction($1, $3); }
2761 | direct_abstract_declarator '(' parameter_type_list_error ')'
2762 { $$ = MkDeclaratorFunction($1, $3); }
2765 direct_abstract_declarator_noarray:
2766 '(' abstract_declarator_noarray ')'
2767 { $$ = MkDeclaratorBrackets($2); }
2769 { $$ = MkDeclaratorFunction(null, null); }
2770 | '(' parameter_type_list ')'
2771 { $$ = MkDeclaratorFunction(null, $2); }
2772 | '(' parameter_type_list_error ')'
2773 { $$ = MkDeclaratorFunction(null, $2); }
2774 | direct_abstract_declarator_noarray '(' ')'
2775 { $$ = MkDeclaratorFunction($1, null); }
2776 | direct_abstract_declarator_noarray '(' parameter_type_list ')'
2777 { $$ = MkDeclaratorFunction($1, $3); }
2778 | direct_abstract_declarator_noarray '(' parameter_type_list_error ')'
2779 { $$ = MkDeclaratorFunction($1, $3); }
2783 '*' { $$ = MkPointer(null, null); }
2784 | '*' type_qualifier_list { $$ = MkPointer($2, null); }
2785 | '*' pointer { $$ = MkPointer(null, $2); }
2786 | '*' type_qualifier_list pointer { $$ = MkPointer($2, $3); }
2789 abstract_declarator:
2790 pointer { $$ = MkDeclaratorPointer($1, null); }
2791 | direct_abstract_declarator
2792 | pointer direct_abstract_declarator { $$ = MkDeclaratorPointer($1, $2); }
2793 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
2794 | ext_decl direct_abstract_declarator { $$ = MkDeclaratorExtended($1, $2); }
2795 | ext_decl pointer direct_abstract_declarator { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2798 abstract_declarator_noarray:
2799 pointer { $$ = MkDeclaratorPointer($1, null); }
2800 | direct_abstract_declarator_noarray
2801 | pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorPointer($1, $2); }
2802 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
2803 | ext_decl direct_abstract_declarator_noarray { $$ = MkDeclaratorExtended($1, $2); }
2804 | ext_decl pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2809 | pointer direct_declarator
2810 { $$ = MkDeclaratorPointer($1, $2); }
2811 | ext_decl pointer direct_declarator
2812 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2813 | declarator ext_decl
2814 { $$ = MkDeclaratorExtendedEnd($2, $1); }
2817 declarator_function:
2818 direct_declarator_function
2819 | pointer direct_declarator_function { $$ = MkDeclaratorPointer($1, $2); }
2820 | ext_decl direct_declarator_function { $$ = MkDeclaratorExtended($1, $2); }
2821 | ext_decl pointer direct_declarator_function { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2822 | pointer ext_decl direct_declarator_function { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
2825 declarator_function_error:
2826 direct_declarator_function_error
2827 | pointer direct_declarator_function_error { $$ = MkDeclaratorPointer($1, $2); }
2828 | ext_decl direct_declarator_function_error { $$ = MkDeclaratorExtended($1, $2); }
2829 | ext_decl pointer direct_declarator_function_error { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2830 | pointer ext_decl direct_declarator_function_error { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
2833 declarator_nofunction:
2834 direct_declarator_nofunction
2835 | pointer direct_declarator_nofunction { $$ = MkDeclaratorPointer($1, $2); }
2836 | ext_decl direct_declarator_nofunction { $$ = MkDeclaratorExtended($1, $2); }
2837 | ext_decl pointer direct_declarator_nofunction { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2838 | pointer ext_decl direct_declarator_nofunction { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
2842 assignment_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
2843 | '{' initializer_list '}' { $$ = MkInitializerList($2); $$.loc = @$; }
2844 | '{' initializer_list ',' '}'
2846 $$ = MkInitializerList($2);
2850 Expression exp = MkExpDummy();
2851 Initializer init = MkInitializerAssignment(exp);
2860 assignment_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
2861 | '{' initializer_list '}' error { $$ = MkInitializerList($2); $$.loc = @$; }
2862 | '{' initializer_list { $$ = MkInitializerList($2); $$.loc = @$; }
2863 | '{' initializer_list ',' '}' error
2865 $$ = MkInitializerList($2);
2869 Expression exp = MkExpDummy();
2870 Initializer init = MkInitializerAssignment(exp);
2876 | '{' initializer_list ','
2878 $$ = MkInitializerList($2);
2882 Expression exp = MkExpDummy();
2883 Initializer init = MkInitializerAssignment(exp);
2891 initializer_condition:
2892 conditional_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
2893 | anon_instantiation_expression
2894 { $$ = MkInitializerAssignment($1); $$.loc = @$; }
2897 initializer_condition_error:
2898 conditional_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
2899 | anon_instantiation_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
2903 initializer { $$ = MkList(); ListAdd($$, $1); }
2904 | initializer_error { $$ = MkList(); ListAdd($$, $1); }
2905 | initializer_list ',' initializer { ListAdd($1, $3); }
2906 | initializer_list ',' initializer_error { ListAdd($1, $3); }
2909 | initializer_list initializer { ListAdd($1, $2); }
2910 | initializer_list initializer_error { ListAdd($1, $2); }
2914 declarator { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
2915 | declarator '=' initializer { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
2918 init_declarator_error:
2919 declarator error { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
2920 | declarator '=' error { $$ = MkInitDeclarator($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.initializer.loc = @2; $$.initializer.exp.loc = @2; }
2921 | declarator '=' initializer_error { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
2924 init_declarator_list:
2925 init_declarator { $$ = MkList(); ListAdd($$, $1); }
2926 | init_declarator_list ',' init_declarator { ListAdd($1, $3); }
2927 | init_declarator_list_error ',' init_declarator { ListAdd($1, $3); }
2930 init_declarator_list_error:
2931 init_declarator_error { $$ = MkList(); ListAdd($$, $1); }
2932 | init_declarator error { $$ = MkList(); ListAdd($$, $1); }
2933 | init_declarator_list ',' init_declarator_error { ListAdd($1, $3); }
2934 | init_declarator_list_error ',' init_declarator_error { ListAdd($1, $3); }
2938 specifier_qualifier_list { $$ = MkTypeName($1, null); }
2939 | specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
2943 guess_specifier_qualifier_list { $$ = MkTypeName($1, null); }
2944 | guess_specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
2947 /*** PARAMETERS **********************************************************************/
2948 parameter_declaration:
2949 guess_declaration_specifiers declarator { $$ = MkTypeName($1, $2); }
2950 | guess_declaration_specifiers abstract_declarator { $$ = MkTypeName($1, $2); }
2951 | guess_declaration_specifiers '&' { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), null)); }
2952 | guess_declaration_specifiers '&' declarator { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), $3)); }
2953 | guess_declaration_specifiers { $$ = MkTypeName($1, null); }
2955 { $$ = MkTypeName(MkListOne(MkSpecifier(CLASS)), null); }
2958 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), null); }
2960 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), null)); }
2961 | TYPED_OBJECT declarator
2962 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), $2); }
2963 | TYPED_OBJECT '&' declarator
2964 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), $3)); }
2966 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), null); }
2967 | ANY_OBJECT declarator
2968 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), $2); }
2972 parameter_declaration_error:
2973 guess_declaration_specifiers declarator error { $$ = MkTypeName($1, $2); }
2974 | guess_declaration_specifiers abstract_declarator error { $$ = MkTypeName($1, $2); }
2978 parameter_declaration { $$ = MkList(); ListAdd($$, $1); }
2979 | parameter_list ',' parameter_declaration { ListAdd($1, $3); }
2980 | parameter_list error ',' parameter_declaration { ListAdd($1, $4); }
2981 | parameter_list_error ',' parameter_declaration { ListAdd($1, $3); }
2982 | parameter_list_error error ',' parameter_declaration { ListAdd($1, $4); }
2983 | error ',' parameter_declaration { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
2985 | identifier_list ',' parameter_declaration { ListAdd($1, $3); }
2986 | identifier_list error ',' parameter_declaration { ListAdd($1, $4); }
2987 | identifier_list_error ',' parameter_declaration { ListAdd($1, $3); }
2988 | identifier_list_error error ',' parameter_declaration { ListAdd($1, $4); }
2991 parameter_list_error:
2992 parameter_declaration_error { $$ = MkList(); ListAdd($$, $1); }
2993 | parameter_list ',' parameter_declaration_error { ListAdd($1, $3); }
2994 | parameter_list_error ',' parameter_declaration_error { ListAdd($1, $3); }
2995 | parameter_list_error error ',' parameter_declaration_error { ListAdd($1, $4); }
2996 | error ',' parameter_declaration_error { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
2998 | identifier_list ',' parameter_declaration_error { ListAdd($1, $3); }
2999 | identifier_list_error ',' parameter_declaration_error { ListAdd($1, $3); }
3000 | identifier_list_error error ',' parameter_declaration_error { ListAdd($1, $4); }
3003 parameter_type_list:
3005 | parameter_list ',' ELLIPSIS { ListAdd($1, MkTypeName(null, null)); }
3006 | parameter_list_error ',' ELLIPSIS { ListAdd($1, MkTypeName(null, null)); }
3007 | identifier_list ',' ELLIPSIS { ListAdd($1, MkTypeName(null, null)); }
3008 | identifier_list_error ',' ELLIPSIS { ListAdd($1, MkTypeName(null, null)); }
3009 | error ',' ELLIPSIS { $$ = MkList(); ListAdd($$, MkTypeName(null, null)); }
3012 parameter_type_list_error:
3013 parameter_list_error
3014 | parameter_list ',' error { ListAdd($1, null); }
3015 | parameter_list_error error
3018 /****** STATEMENTS *******************************************************************/
3021 | EXT_ATTRIB { $$ = MkExpressionStmt(null); } // Ignoring this for now... ( For __attribute__ ((__unused__)) )
3022 | compound_statement
3023 | ';' { $$ = MkExpressionStmt(null); }
3024 | ':' { $$ = MkExpressionStmt(null); }
3025 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3026 | selection_statement
3027 | iteration_statement
3033 | watch_definition ';'
3037 labeled_statement_error { $$ = $1; Compiler_Error("syntax error\n"); }
3038 | iteration_statement_error { $$ = $1; Compiler_Error("syntax error\n"); }
3039 | compound_statement_error { $$ = $1; Compiler_Error("syntax error\n"); }
3040 | selection_statement_error { $$ = $1; Compiler_Error("syntax error\n"); }
3041 | jump_statement_error { $$ = $1; Compiler_Error("syntax error\n"); }
3042 | jump_statement error { $$ = $1; Compiler_Error("syntax error\n"); }
3043 | expression_error { $$ = MkExpressionStmt($1); Compiler_Error("syntax error\n"); $$.loc = @1; }
3047 string_literal { $$ = MkAsmField($1, null); $$.loc = @1; }
3048 | string_literal '(' assignment_expression ')' { $$ = MkAsmField($1, $3); $$.loc = @$; }
3052 asm_field { $$ = MkListOne($1); }
3053 | asm_field_list ',' asm_field { ListAdd($$, $3); }
3058 ASM type_qualifier '(' string_literal ')' ';' { $$ = MkAsmStmt($2, $4, null, null, null); $$.loc = @$; }
3059 | ASM type_qualifier '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, null); $$.loc = @$; }
3060 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, null); $$.loc = @$; }
3061 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, $10); $$.loc = @$; }
3063 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, null); $$.loc = @$; }
3064 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, $8); $$.loc = @$; }
3065 | ASM type_qualifier '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, $8); $$.loc = @$; }
3067 | ASM '(' string_literal ')' ';' { $$ = MkAsmStmt(null, $3, null, null, null); $$.loc = @$; }
3068 | ASM '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, null); $$.loc = @$; }
3069 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, null); $$.loc = @$; }
3070 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, $9); $$.loc = @$; }
3072 | ASM '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, null); $$.loc = @$; }
3073 | ASM '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, $7); $$.loc = @$; }
3074 | ASM '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, $7); $$.loc = @$; }
3078 identifier ':' statement { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3079 | CASE constant_expression ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3080 | CASE constant_expression_error ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3081 | CASE ':' statement { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3082 | DEFAULT ':' statement { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3085 labeled_statement_error
3086 : identifier ':' statement_error { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3087 | CASE constant_expression ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3088 | CASE constant_expression_error ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3089 | CASE ':' statement_error { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3090 | CASE ':' { $$ = MkCaseStmt(MkExpDummy(), null); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3091 | DEFAULT ':' statement_error { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3092 | DEFAULT ':' { $$ = MkCaseStmt(null, null); $$.loc = @$; }
3096 PUBLIC { $$ = declMode = publicAccess; }
3097 | PRIVATE { $$ = declMode = privateAccess; }
3098 | DEFAULT { $$ = declMode = defaultAccess; }
3102 PUBLIC { $$ = publicAccess; }
3103 | PRIVATE { $$ = privateAccess; }
3107 declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3108 | declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3109 | instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3110 | declaration_error ';' {}
3113 external_guess_declaration:
3114 external_guess_declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3115 | external_guess_declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3116 | external_guess_declaration_specifiers_error init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3118 | external_guess_instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3119 | DEFINE identifier '=' conditional_expression ';' { $$ = MkDeclarationDefine($2, $4); $$.loc = @$; }
3120 | STATIC DEFINE identifier '=' conditional_expression ';' { declMode = staticAccess; $$ = MkDeclarationDefine($3, $5); $$.loc = @$; }
3123 external_guess_declaration_error:
3124 external_guess_declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; yyerrok; }
3128 declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; }
3129 | declaration_error error {}
3131 | instantiation_named_error error { $$ = MkDeclarationInst($1); $$.loc = @$; }
3132 | instantiation_named error { $$ = MkDeclarationInst($1); $$.loc = @$; }
3133 | declaration_specifiers init_declarator_list_error { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3137 declaration { $$ = MkList(); ListAdd($$, $1); /*declMode = defaultDeclMode;*/ }
3138 | declaration_list declaration { ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3139 | declaration_list_error declaration { ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3140 | declaration_list error ';' { }
3143 declaration_list_error:
3144 declaration_error { $$ = MkList(); ListAdd($$, $1); }
3145 | declaration_list declaration_error { ListAdd($1, $2); }
3149 statement { $$ = MkList(); ListAdd($$, $1); }
3150 | statement_list statement { ListAdd($1, $2); }
3151 | statement_list_error statement { ListAdd($1, $2); }
3154 statement_list_error:
3155 statement_error { $$ = MkList(); ListAdd($$, $1); }
3156 | statement_list statement_error { ListAdd($1, $2); }
3157 | statement_list_error statement_error { ListAdd($1, $2); }
3158 | statement_list declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3159 | statement_list_error declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3160 | statement_list declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3161 | statement_list_error declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3165 statement_list { $$ = MkCompoundStmt(null, $1); }
3166 | declaration_list { $$ = MkCompoundStmt($1, null); }
3167 | declaration_list statement_list { $$ = MkCompoundStmt($1, $2); }
3168 | declaration_list_error statement_list { $$ = MkCompoundStmt($1, $2); }
3171 compound_inside_error:
3172 statement_list_error { $$ = MkCompoundStmt(null, $1); }
3173 | declaration_list_error { $$ = MkCompoundStmt($1, null); }
3174 | declaration_list statement_list_error { $$ = MkCompoundStmt($1, $2); }
3175 | declaration_list_error statement_list_error { $$ = MkCompoundStmt($1, $2); }
3179 '{' { $<context>$ = PushContext(); }
3183 compound_statement_error '}' { $$.loc = @$; }
3186 compound_statement_error:
3187 compound_start compound_inside_error
3188 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3190 { $$ = MkCompoundStmt(null, null); $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3192 | compound_start compound_inside
3193 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3197 expression_statement:
3198 ';' { $$ = MkExpressionStmt(null); $$.loc = @$; }
3199 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3200 | expression_error ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3203 selection_statement:
3204 IF '(' expression ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3205 | IF '(' expression_error ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3206 | IF '(' expression ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3207 | IF '(' expression_error ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3208 | SWITCH '(' expression ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3209 | SWITCH '(' expression_error ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3212 selection_statement_error:
3213 IF '(' expression_error { $$ = MkIfStmt($3, null, null); $$.loc = @$; }
3214 | selection_statement error
3217 iteration_statement:
3218 WHILE '(' expression ')' statement { $$ = MkWhileStmt($3, $5); $$.loc = @$; }
3219 | WHILE '(' expression_error statement { $$ = MkWhileStmt($3, $4); $$.loc = @$; }
3220 | WHILE '(' ')' statement { $$ = MkWhileStmt(null, $4); $$.loc = @$; }
3222 | DO statement WHILE '(' expression ')' ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3223 | DO statement WHILE '(' expression_error ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3225 | FOR '(' expression_statement expression_statement ')' statement { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; }
3226 | FOR '(' expression_statement ')' statement { $$ = MkForStmt($3, null, null, $5); $$.loc = @$; }
3227 | FOR '(' expression_statement expression_statement expression ')' statement { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; }
3228 | FOR '(' expression_statement expression_statement expression_error statement { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; }
3229 | FOR '(' ')' statement { $$ = MkForStmt(null, null, null, $4); $$.loc = @$; }
3231 | FOR '(' identifier ':' expression ')' statement { $$ = MkForEachStmt($3, $5, null, $7); $$.loc = @$; }
3232 | FOR '(' identifier ':' expression ';' expression ')' statement { $$ = MkForEachStmt($3, $5, $7, $9); $$.loc = @$; }
3235 iteration_statement_error:
3236 FOR '(' error { $$ = MkForStmt(null, null, null, null); $$.loc = @$; } |
3237 FOR '(' expression_error error { $$ = MkForStmt(MkExpressionStmt($3), null, null, null); $$.forStmt.init.loc = @3; $$.loc = @$; } |
3238 FOR '(' expression_statement error { $$ = MkForStmt($3, null, null, null); $$.loc = @$; } |
3239 FOR '(' expression_statement expression_error error { $$ = MkForStmt($3, MkExpressionStmt($4), null, null); $$.loc = @$; $$.forStmt.check.loc = @4; } |
3240 FOR '(' expression_statement expression_statement error { $$ = MkForStmt($3, $4, null, null); $$.loc = @$; } |
3241 FOR '(' expression_statement expression_statement expression_error { $$ = MkForStmt($3, $4, $5, null); $$.loc = @$; } |
3242 FOR '(' expression_statement expression_statement ')' statement_error { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; } |
3243 FOR '(' expression_statement expression_statement expression ')' statement_error { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; } |
3244 FOR '(' expression_statement expression_statement expression_error statement_error { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; } |
3246 DO statement WHILE '(' expression ')' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3247 DO statement WHILE '(' expression { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3248 DO statement WHILE '(' expression_error { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3249 DO statement WHILE '(' { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3250 DO statement WHILE { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3251 DO statement { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3252 DO { $$ = MkDoWhileStmt(null, null); $$.loc = @$; } |
3255 WHILE error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3256 WHILE '(' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3257 WHILE '(' ')' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3258 WHILE '(' expression_error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3259 WHILE '(' expression_error error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3260 WHILE '(' expression ')' statement_error { $$ = MkWhileStmt($3, $5); $$.loc = @$; } |
3261 WHILE '(' expression_error statement_error { $$ = MkWhileStmt($3, $4 ); $$.loc = @$; }
3265 GOTO identifier ';' { $$ = MkGotoStmt($2); $$.loc = @$; }
3266 | CONTINUE ';' { $$ = MkContinueStmt(); $$.loc = @$; }
3267 | BREAK ';' { $$ = MkBreakStmt(); $$.loc = @$; }
3268 | RETURN ';' { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc = @2; }
3269 | RETURN expression ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3270 | RETURN expression_error ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3271 | RETURN anon_instantiation_expression ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3272 | RETURN anon_instantiation_expression_error ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3275 jump_statement_error:
3276 RETURN expression_error { $$ = MkReturnStmt($2); $$.loc = @$; } |
3277 RETURN anon_instantiation_expression_error { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; } |
3278 RETURN { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc.start = exp.loc.end = @1.end; } |
3279 GOTO { $$ = MkGotoStmt(null); $$.loc = @$; }
3282 /*************************************************************************************/
3284 function_definition:
3285 external_guess_declaration_specifiers declarator_function declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3286 | external_guess_declaration_specifiers declarator_function compound_statement
3287 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3289 | declarator_function declaration_list compound_statement { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; }
3290 | declarator_function compound_statement { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$;}
3292 function_definition_error:
3293 external_guess_declaration_specifiers declarator_function declaration_list compound_statement_error { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; $$.loc.end = $4.loc.end; }
3294 | external_guess_declaration_specifiers declarator_function compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3295 | declarator_function declaration_list compound_statement_error { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3296 | declarator_function compound_statement_error { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
3300 STRING_LITERAL { $$ = CopyString(yytext); }
3301 | string_literal STRING_LITERAL
3303 int len1 = strlen($1);
3304 int len2 = strlen(yytext);
3305 $$ = new byte[len1-1 + len2-1 + 1];
3306 memcpy($$, $1, len1-1);
3307 memcpy($$ + len1-1, yytext+1, len2);
3312 external_declaration:
3313 function_definition { $$ = MkExternalFunction($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3315 { $$ = MkExternalClass($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3317 | external_guess_declaration_specifiers class
3318 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3320 | external_guess_declaration
3321 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3322 | IMPORT string_literal { $$ = MkExternalImport($2, normalImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3323 | IMPORT STATIC string_literal { $$ = MkExternalImport($3, staticImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3324 | IMPORT identifier string_literal { if(!strcmp($2.string, "remote")) { $$ = MkExternalImport($3, remoteImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; } else yyerror(); FreeIdentifier($2); }
3326 | ';' { $$ = null; }
3328 | declaration_mode function_definition { $$ = MkExternalFunction($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3329 | declaration_mode class
3330 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; declMode = defaultDeclMode; }
3331 | declaration_mode external_guess_declaration { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3332 | declaration_mode IMPORT string_literal { $$ = MkExternalImport($3, normalImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; declMode = defaultDeclMode; }
3333 | declaration_mode IMPORT STATIC string_literal { $$ = MkExternalImport($4, staticImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; declMode = defaultDeclMode; }
3334 | 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; }
3335 | declaration_mode ':' { defaultDeclMode = $1; $$ = null; }
3336 | STATIC ':' { defaultDeclMode = staticAccess; $$ = null; }
3337 | NAMESPACE identifier { $$ = MkExternalNameSpace($2); $$.loc = @$; }
3338 | NAMESPACE strict_type { $$ = MkExternalNameSpace(MkIdentifier($2.name)); FreeSpecifier($2); $$.loc = @$; }
3339 | dbtable_definition { $$ = MkExternalDBTable($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3340 | declaration_mode dbtable_definition { $$ = MkExternalDBTable($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3343 external_declaration_error:
3344 class_error { $$ = MkExternalClass($1); $$.loc = $1.loc; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3345 | external_guess_declaration_specifiers class_error { $$ = MkExternalClass($2); $$.loc = $2.loc; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3346 | function_definition_error { $$ = MkExternalFunction($1); $$.loc = $1.loc; $1.declMode = declMode; declMode = defaultDeclMode; }
3348 | declaration_mode class_error { $$ = MkExternalClass($2); $$.loc = $2.loc; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; declMode = defaultDeclMode; }
3349 | declaration_mode function_definition_error { $$ = MkExternalFunction($2); $$.loc = $2.loc; $2.declMode = $1; declMode = defaultDeclMode; }
3351 | external_guess_declaration_error
3352 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3353 | declaration_mode external_guess_declaration_error { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3356 translation_unit_error:
3357 external_declaration_error { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3358 | translation_unit external_declaration_error { ListAdd($1, $2); }
3359 | translation_unit_error external_declaration_error { ListAdd($1, $2); }
3360 | translation_unit error
3361 | translation_unit_error error
3365 external_declaration { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3366 | translation_unit external_declaration { ListAdd($1, $2); }
3367 | translation_unit_error class
3368 { External _class = MkExternalClass($2); ListAdd($1, _class); _class.loc = @2; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3369 | translation_unit_error declaration_mode class
3370 { External _class = MkExternalClass($3); ListAdd($1, _class); _class.loc = @3; $3.declMode = ($2 != defaultAccess) ? $2 : privateAccess; declMode = defaultDeclMode; }
3375 | translation_unit_error
3376 | { ast = MkList(); }
3380 DBTABLE string_literal identifier '{' dbfield_definition_list '}' { Symbol symbol = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3381 | DBTABLE string_literal strict_type '{' dbfield_definition_list '}' { Symbol symbol = DeclClass(globalContext.nextID++, $3.name); FreeSpecifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3382 | DBTABLE string_literal '{' dbfield_definition_list '}' { $$ = MkDBTableDef($2, null, $4); }
3386 guess_declaration_specifiers identifier string_literal ';' { $$ = MkDBFieldEntry(MkTypeName($1, null), $2, $3); }
3390 identifier { $$ = MkDBIndexItem($1, ascending); }
3391 | '>' identifier { $$ = MkDBIndexItem($2, descending); }
3392 | '<' identifier { $$ = MkDBIndexItem($2, ascending); }
3396 dbindex_item { $$ = MkList(); ListAdd($$, $1); }
3397 | dbindex_item_list ',' dbindex_item { ListAdd($1, $3); }
3401 DBINDEX dbindex_item_list ';' { $$ = MkDBIndexEntry($2, null); }
3402 | DBINDEX dbindex_item_list identifier ';' { $$ = MkDBIndexEntry($2, $3); }
3405 dbfield_definition_list:
3406 dbfield_entry { $$ = MkList(); ListAdd($$, $1); }
3407 | dbindex_entry { $$ = MkList(); ListAdd($$, $1); }
3408 | dbfield_definition_list dbfield_entry { ListAdd($1, $2); }
3409 | dbfield_definition_list dbindex_entry { ListAdd($1, $2); }
3413 DATABASE_OPEN '(' assignment_expression ',' assignment_expression ')' { $$ = MkExpDBOpen($3, $5); }
3417 DBFIELD '(' string_literal ',' identifier ')' { $$ = MkExpDBField($3, $5); }
3421 DBINDEX '(' string_literal ',' identifier ')' { $$ = MkExpDBIndex($3, $5); }
3425 DBTABLE '(' string_literal ')' { $$ = MkExpDBTable($3); }