4 #define YYLTYPE Location
8 # define YYLLOC_DEFAULT(Current, Rhs, N) \
9 (Current).start = (Rhs)[1].start; \
10 (Current).end = (Rhs)[N].end;
14 extern File fileInput;
20 bool deleteWatchable = false;
22 #define MAX_STRUCT_LEVELS 256
23 AccessMode memberAccessStack[MAX_STRUCT_LEVELS];
24 int defaultMemberAccess = -1;
26 #define POP_DEFAULT_ACCESS if(defaultMemberAccess > -1) defaultMemberAccess--;
36 SpecifierType specifierType;
43 Enumerator enumerator;
44 Declarator declarator;
46 Initializer initializer;
47 InitDeclarator initDeclarator;
49 Declaration declaration;
51 FunctionDefinition function;
59 Instantiation instance;
60 MembersInit membersInit;
61 MemberInit memberInit;
62 ClassFunction classFunction;
63 ClassDefinition _class;
68 PropertyWatch propertyWatch;
69 TemplateParameter templateParameter;
70 TemplateArgument templateArgument;
71 TemplateDatatype templateDatatype;
73 DBTableEntry dbtableEntry;
74 DBIndexItem dbindexItem;
75 DBTableDef dbtableDef;
80 %type <symbol> class_decl
81 %type <specifierType> struct_or_union
82 %type <i> unary_operator assignment_operator
83 %type <declMode> member_access declaration_mode
84 %type <id> identifier enum_decl
85 %type <exp> primary_expression primary_expression_error postfix_expression unary_expression cast_expression
86 multiplicative_expression additive_expression shift_expression
87 relational_expression relational_expression_smaller_than equality_expression and_expression
88 exclusive_or_expression inclusive_or_expression logical_and_expression
89 logical_or_expression conditional_expression assignment_expression
90 constant_expression constant_expression_error
91 anon_instantiation_expression anon_instantiation_expression_error i18n_string
92 postfix_expression_error unary_expression_error cast_expression_error
93 multiplicative_expression_error additive_expression_error shift_expression_error
94 relational_expression_error equality_expression_error and_expression_error
95 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
96 logical_or_expression_error conditional_expression_error assignment_expression_error
97 simple_primary_expression
98 simple_postfix_expression simple_postfix_expression_error
99 common_unary_expression common_unary_expression_error
100 simple_unary_expression simple_unary_expression_error
101 database_open dbfield dbindex dbtable
103 %type <list> argument_expression_list expression expression_anon_inst expression_anon_inst_error enumerator_list type_qualifier_list
104 struct_declarator_list struct_declaration_list
105 declaration_specifiers identifier_list identifier_list_error initializer_list init_declarator_list
106 parameter_list parameter_list_error parameter_type_list parameter_type_list_error declaration_list declaration_list_error statement_list statement_list_error
107 translation_unit members_initialization_list members_initialization_list_coloned members_initialization_list_error data_member_initialization_list data_member_initialization_list_coloned
108 default_property_list data_member_initialization_list_error
109 expression_error init_declarator_list_error argument_expression_list_error default_property_list_error struct_declaration_list_error
110 translation_unit_error
111 guess_declaration_specifiers
112 external_guess_declaration_specifiers external_guess_declaration_specifiers_error
113 specifier_qualifier_list guess_specifier_qualifier_list
114 _inheritance_specifiers inheritance_specifiers property_specifiers
115 new_specifiers renew_specifiers asm_field_list
116 property_watch_list watch_property_list
117 dbindex_item_list dbfield_definition_list
118 template_arguments_list template_parameters_list attribs_list
120 %type <asmField> asm_field
121 %type <specifier> storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier class_specifier class_specifier_error
122 struct_or_union_specifier_compound struct_or_union_specifier_nocompound ext_storage type strict_type guess_type enum_class strict_type_specifier struct_class
123 struct_or_union_specifier_compound_error struct_class_error struct_decl
124 enum_specifier_compound_error enum_class_error external_storage_class_specifier
125 base_strict_type struct_head struct_entry
126 %type <enumerator> enumerator
127 %type <declarator> declarator direct_declarator direct_abstract_declarator abstract_declarator
128 direct_abstract_declarator_noarray abstract_declarator_noarray
129 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction // declarator_nofunction
130 direct_declarator_function_type_ok declarator_nofunction_type_ok direct_declarator_nofunction_type_ok declarator_function_type_ok direct_declarator_function_error_type_ok
131 direct_declarator_function_start_type_ok direct_declarator_type_ok declarator_type_ok declarator_function_error_type_ok
133 %type <pointer> pointer
134 %type <initializer> initializer initializer_error initializer_condition initializer_condition_error
135 %type <initDeclarator> init_declarator init_declarator_error
136 %type <typeName> type_name guess_type_name parameter_declaration parameter_declaration_error
137 %type <stmt> statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
138 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
139 iteration_statement_error statement_error asm_statement
140 stopwatching watch_definition firewatchers
142 %type <declaration> declaration declaration_error external_guess_declaration external_guess_declaration_error
143 %type <function> function_definition function_definition_error
144 %type <external> external_declaration external_declaration_error
146 %type <instance> instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error guess_instantiation_named guess_instantiation_named_error external_guess_instantiation_named
147 instantiation_anon instantiation_anon_error
148 %type <memberInit> data_member_initialization data_member_initialization_error default_property default_property_error
149 %type <classFunction> class_function_definition class_function_definition_error class_function_definition_start
150 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
151 constructor_function_definition_start destructor_function_definition_start
152 %type <classFunction> instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
153 %type <_class> class class_error class_head
154 %type <classDef> struct_declaration struct_declaration_error
155 %type <string> string_literal base_strict_type_name attribute_word
156 %type <extDecl> ext_decl
157 %type <attrib> attrib
158 %type <attribute> attribute
159 %type <prop> property property_start property_body class_property class_property_start class_property_body
160 %type <propertyWatch> property_watch self_watch_definition
162 %type <templateParameter> template_parameter template_type_parameter template_identifier_parameter template_expression_parameter
163 %type <templateArgument> template_argument template_type_argument template_identifier_argument template_expression_argument
164 %type <templateDatatype> template_datatype
166 %type <dbtableEntry> dbindex_entry dbfield_entry
167 %type <dbindexItem> dbindex_item
168 %type <dbtableDef> dbtable_definition
169 %type <context> compound_start class_entry
171 %token IDENTIFIER CONSTANT STRING_LITERAL SIZEOF
172 %token PTR_OP INC_OP DEC_OP LEFT_OP RIGHT_OP LE_OP GE_OP EQ_OP NE_OP
173 %token AND_OP OR_OP MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN
174 %token SUB_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN
175 %token XOR_ASSIGN OR_ASSIGN TYPE_NAME
177 %token TYPEDEF EXTERN STATIC AUTO REGISTER
178 %token CHAR SHORT INT UINT INT64 LONG SIGNED UNSIGNED FLOAT DOUBLE CONST VOLATILE VOID VALIST
179 %token STRUCT UNION ENUM ELLIPSIS
181 %token CASE DEFAULT IF SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN
185 %token CLASS THISCLASS CLASS_NAME
186 %token PROPERTY SETPROP GETPROP NEWOP RENEW DELETE EXT_DECL EXT_STORAGE IMPORT DEFINE VIRTUAL ATTRIB
187 %token PUBLIC PRIVATE
188 %token TYPED_OBJECT ANY_OBJECT _INCREF EXTENSION ASM TYPEOF
189 %token WATCH STOPWATCHING FIREWATCHERS WATCHABLE CLASS_DESIGNER CLASS_NO_EXPANSION CLASS_FIXED ISPROPSET
190 %token CLASS_DEFAULT_PROPERTY PROPERTY_CATEGORY CLASS_DATA CLASS_PROPERTY SUBCLASS NAMESPACE
191 %token NEW0OP RENEW0 VAARG
192 %token DBTABLE DBFIELD DBINDEX DATABASE_OPEN
193 %token ALIGNOF ATTRIB_DEP __ATTRIB
195 %destructor { FreeIdentifier($$); } identifier
196 %destructor { FreePointer($$); } pointer
197 %destructor { FreeExpression($$); } primary_expression primary_expression_error postfix_expression unary_expression cast_expression
198 multiplicative_expression additive_expression shift_expression
199 relational_expression equality_expression and_expression
200 exclusive_or_expression inclusive_or_expression logical_and_expression
201 logical_or_expression conditional_expression assignment_expression
202 constant_expression constant_expression_error
203 postfix_expression_error unary_expression_error cast_expression_error
204 multiplicative_expression_error additive_expression_error shift_expression_error
205 relational_expression_error equality_expression_error and_expression_error
206 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
207 logical_or_expression_error conditional_expression_error assignment_expression_error i18n_string
208 %destructor { FreeSpecifier($$); } storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier class_specifier class_specifier_error
209 struct_or_union_specifier_compound struct_or_union_specifier_nocompound ext_storage type strict_type guess_type enum_class strict_type_specifier struct_class
210 struct_or_union_specifier_compound_error struct_class_error struct_decl
211 enum_specifier_compound_error enum_class_error external_storage_class_specifier
212 base_strict_type struct_head struct_entry
213 %destructor { FreeEnumerator($$); } enumerator
214 %destructor { FreeDeclarator($$); } declarator direct_declarator direct_abstract_declarator abstract_declarator
215 direct_abstract_declarator_noarray abstract_declarator_noarray
216 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction
217 //declarator_nofunction
219 %destructor { FreeInitializer($$); } initializer initializer_error initializer_condition initializer_condition_error
220 %destructor { FreeInitDeclarator($$); } init_declarator init_declarator_error
221 %destructor { FreeTypeName($$); } type_name guess_type_name parameter_declaration parameter_declaration_error
222 %destructor { FreeStatement($$); } statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
223 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
224 iteration_statement_error statement_error
226 %destructor { FreeDeclaration($$); } declaration
227 %destructor { FreeFunction($$); } function_definition function_definition_error
228 %destructor { FreeExternal($$); } external_declaration external_declaration_error
230 %destructor { FreeInstance($$); } instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error
232 %destructor { FreeMemberInit($$); } data_member_initialization data_member_initialization_error default_property default_property_error
234 %destructor { FreeClassFunction($$); } class_function_definition class_function_definition_error class_function_definition_start
235 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
236 constructor_function_definition_start destructor_function_definition_start
237 instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
238 %destructor { Context ctx = curContext; PopContext(ctx); FreeContext(ctx); delete ctx; } class_entry
239 %destructor { Context ctx = curContext; PopContext(ctx); FreeContext(ctx); delete ctx; } class_decl
240 %destructor { FreeClass($$); } class class_error class_head
241 %destructor { FreeClassDef($$); } struct_declaration struct_declaration_error
242 %destructor { delete $$; } string_literal attribute_word base_strict_type_name
243 %destructor { FreeProperty($$); } property
245 %destructor { FreeList($$, FreeExpression); } argument_expression_list expression expression_error argument_expression_list_error
246 %destructor { FreeList($$, FreeEnumerator); } enumerator_list
247 %destructor { FreeList($$, FreeSpecifier); } type_qualifier_list specifier_qualifier_list declaration_specifiers inheritance_specifiers _inheritance_specifiers external_guess_declaration_specifiers external_guess_declaration_specifiers_error
248 guess_declaration_specifiers guess_specifier_qualifier_list
249 %destructor { FreeList($$, FreeDeclarator); } struct_declarator_list
250 %destructor { FreeList($$, FreeDeclaration); } declaration_list declaration_list_error
251 %destructor { FreeList($$, FreeInitializer); } initializer_list
252 %destructor { FreeList($$, FreeInitDeclarator); } init_declarator_list init_declarator_list_error
253 %destructor { FreeList($$, FreeTypeName); } parameter_list parameter_list_error parameter_type_list parameter_type_list_error identifier_list identifier_list_error
254 %destructor { FreeList($$, FreeStatement); } statement_list statement_list_error
255 %destructor { if($$ != ast) FreeList($$, FreeExternal); } translation_unit translation_unit_error
256 %destructor { FreeList($$, FreeClassDef); } struct_declaration_list struct_declaration_list_error
257 %destructor { FreeList($$, FreeMemberInit); } default_property_list default_property_list_error data_member_initialization_list data_member_initialization_list_coloned data_member_initialization_list_error
258 %destructor { FreeList($$, FreeMembersInit); } members_initialization_list members_initialization_list_coloned members_initialization_list_error
259 %destructor { PopContext($$); FreeContext($$); delete $$; } compound_start
260 %destructor { FreeTemplateParameter($$); } template_parameter template_type_parameter template_identifier_parameter template_expression_parameter
261 %destructor { FreeTemplateArgument($$); } template_argument template_type_argument template_identifier_argument template_expression_argument
262 %destructor { FreeTemplateDataType($$); } template_datatype
263 %destructor { FreeList($$, FreeTemplateParameter); } template_parameters_list
264 %destructor { FreeList($$, FreeTemplateArgument); } template_arguments_list
265 %destructor { } declaration_mode
266 %destructor { FreeAttrib($$); } attrib
267 %destructor { FreeExtDecl($$); } ext_decl
268 %destructor { FreeAttribute($$); } attribute
269 %destructor { FreeList($$, FreeAttribute); } attribs_list
279 // if($1._class && !$1._class.name)
283 strcpy(name, $1._class.name ? $1._class.name : "");
285 strcat(name, $1.string);
289 _DeclClass(0, $1.string);
293 fileInput.Seek(@1.start.pos, start);
294 resetScannerPos(&@1.start);
299 YY_STACK_PRINT (yyss, yyssp);
302 YY_STACK_PRINT (yyss, yyssp);
309 // if($1._class && !$1._class.name)
313 strcpy(name, $1._class.name ? $1._class.name : "");
315 strcat(name, $1.string);
319 _DeclClass(0, $1.string);
323 fileInput.Seek(@1.start.pos, start);
324 resetScannerPos(&@1.start);
329 YY_STACK_PRINT (yyss, yyssp);
332 YY_STACK_PRINT (yyss, yyssp);
336 /* | identifier '*' '<' template_arguments_list '>'
338 //if($1._class && !$1._class.name)
342 strcpy(name, $1._class.name ? $1._class.name : "");
344 strcat(name, $1.string);
348 _DeclClass(0, $1.string);
349 fileInput.Seek(@1.start.pos, start);
350 resetScannerPos(&@1.start);
355 YY_STACK_PRINT (yyss, yyssp);
358 YY_STACK_PRINT (yyss, yyssp);
364 strict_type { $$ = $1; }
365 | identifier identifier
368 // if($1._class && !$1._class.name)
372 strcpy(name, $1._class.name ? $1._class.name : "");
374 strcat(name, $1.string);
378 _DeclClass(0, $1.string);
382 fileInput.Seek(@1.start.pos, start);
383 resetScannerPos(&@1.start);
388 YY_STACK_PRINT (yyss, yyssp);
391 YY_STACK_PRINT (yyss, yyssp);
394 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
395 Compiler_Error($"Not a type: %s\n", $1.string);
396 yylloc = tmpLoc; $2.badID = $1;
403 //if($1._class && !$1._class.name)
407 strcpy(name, $1._class.name ? $1._class.name : "");
409 strcat(name, $1.string);
413 _DeclClass(0, $1.string);
414 fileInput.Seek(@1.start.pos, start);
415 resetScannerPos(&@1.start);
420 YY_STACK_PRINT (yyss, yyssp);
423 YY_STACK_PRINT (yyss, yyssp);
427 /* | strict_type '<' template_arguments_list '>' { $$ = $1; }
428 | identifier identifier '<' template_arguments_list '>'
431 // if($1._class && !$1._class.name)
435 strcpy(name, $1._class.name ? $1._class.name : "");
437 strcat(name, $1.string);
441 _DeclClass(0, $1.string);
445 fileInput.Seek(@1.start.pos, start);
446 resetScannerPos(&@1.start);
451 YY_STACK_PRINT (yyss, yyssp);
454 YY_STACK_PRINT (yyss, yyssp);
457 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
458 Compiler_Error($"Not a type: %s\n", $1.string);
459 yylloc = tmpLoc; $2.badID = $1;
465 TYPE_NAME { $$ = MkSpecifierName(yytext); }
468 base_strict_type_name:
469 TYPE_NAME { $$ = CopyString(yytext); }
473 | base_strict_type '<' template_arguments_list '>' { $$ = $1; SetClassTemplateArgs($$, $3); $$.loc = @$; }
474 | base_strict_type '<' template_arguments_list RIGHT_OP
477 SetClassTemplateArgs($$, $3);
481 fileInput.Seek(@4.end.pos, start);
482 resetScannerPos(&@4.end);
486 /* | identifier '<' template_arguments_list '>' */
487 /*| identifier '<' error
489 // if($1._class && !$1._class.name)
493 strcpy(name, $1._class.name ? $1._class.name : "");
495 strcat(name, $1.string);
499 _DeclClass(0, $1.string);
503 fileInput.Seek(@1.start.pos, start);
504 resetScannerPos(&@1.start);
509 YY_STACK_PRINT (yyss, yyssp);
512 YY_STACK_PRINT (yyss, yyssp);
515 YY_STACK_PRINT (yyss, yyssp);
518 /* $$ = MkSpecifierNameArgs($1.string, $3); $$.loc = @$; FreeIdentifier($1); */
522 class_function_definition_start:
523 guess_declaration_specifiers declarator_function_type_ok
524 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
525 | declarator_function
526 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
529 constructor_function_definition_start:
530 guess_declaration_specifiers '(' ')'
531 { $$ = MkClassFunction(null, null, null, null); $$.isConstructor = true; $$.loc = @$; $$.id = ++globalContext.nextID; FreeList($1, FreeSpecifier); }
534 destructor_function_definition_start:
535 '~' guess_declaration_specifiers '(' ')'
536 { $$ = MkClassFunction(null, null, null, null); $$.isDestructor = true; $$.loc = @$; $$.id = ++globalContext.nextID; FreeList($2, FreeSpecifier) }
539 virtual_class_function_definition_start:
540 VIRTUAL guess_declaration_specifiers declarator_function_type_ok
541 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
542 | VIRTUAL declarator_function
543 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
546 class_function_definition_start_error:
547 guess_declaration_specifiers declarator_function_error_type_ok
548 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
549 | declarator_function_error
550 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
553 virtual_class_function_definition_start_error:
554 VIRTUAL guess_declaration_specifiers declarator_function_error_type_ok
555 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
556 | VIRTUAL declarator_function_error
557 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
560 class_function_definition:
561 class_function_definition_start compound_statement
562 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
563 | virtual_class_function_definition_start compound_statement
564 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
565 | virtual_class_function_definition_start ';'
566 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
567 | constructor_function_definition_start compound_statement
568 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
569 | destructor_function_definition_start compound_statement
570 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
573 | class_function_definition_start ';'
574 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
577 class_function_definition_error:
578 class_function_definition_start compound_statement_error
579 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
580 | class_function_definition_start_error
581 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
582 | virtual_class_function_definition_start compound_statement_error
583 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
584 | virtual_class_function_definition_start_error
585 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
586 | virtual_class_function_definition_start_error ';'
587 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
590 // In Instances, return type is required to distinguish from calling the function
591 instance_class_function_definition_start:
592 declaration_specifiers declarator_function_type_ok
593 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
594 | declaration_specifiers declarator_nofunction_type_ok
595 { $$ = MkClassFunction($1, null, MkDeclaratorFunction($2, null), null); $$.loc = @$; $$.id = ++globalContext.nextID; }
598 instance_class_function_definition_start_error:
599 declaration_specifiers declarator_function_error_type_ok
600 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
603 instance_class_function_definition:
604 instance_class_function_definition_start compound_statement
605 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
608 instance_class_function_definition_error:
609 instance_class_function_definition_start compound_statement_error
610 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; $$.loc.end.charPos++; $$.loc.end.pos++;}
611 | instance_class_function_definition_start_error
612 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
613 | instance_class_function_definition_start
614 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
617 data_member_initialization:
618 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
619 | initializer_condition { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
622 data_member_initialization_error:
623 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
624 | postfix_expression '=' error
626 $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy()));
627 $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = $$.initializer.loc.end = @2.end;
629 fileInput.Seek(@2.end.pos, start);
631 resetScannerPos(&@2.end);
635 | initializer_condition_error { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
638 data_member_initialization_list:
639 data_member_initialization { $$ = MkList(); ListAdd($$, $1); }
640 | data_member_initialization_list ',' data_member_initialization
641 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
642 | data_member_initialization_list_error ',' data_member_initialization
643 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
646 data_member_initialization_list_error:
647 data_member_initialization_error { $$ = MkList(); ListAdd($$, $1); }
648 | data_member_initialization_list ',' data_member_initialization_error
649 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
650 | data_member_initialization_list_error ',' data_member_initialization_error
651 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
653 | data_member_initialization_list ',' error
654 { ((MemberInit)$1->last).loc.end = @2.end;
656 Initializer dummy = MkInitializerAssignment(MkExpDummy());
657 MemberInit memberInit = MkMemberInit(null, dummy);
658 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
659 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
660 ListAdd($1, memberInit);
665 data_member_initialization_list_error ',' error
666 { ((MemberInit)$1->last).loc.end = @2.end;
668 Initializer dummy = MkInitializerAssignment(MkExpDummy());
669 MemberInit memberInit = MkMemberInit(null, dummy);
670 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
671 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
672 ListAdd($1, memberInit);
678 Initializer dummy = MkInitializerAssignment(MkExpDummy());
679 MemberInit memberInit = MkMemberInit(null, dummy);
680 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.start;
681 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.start;
684 ListAdd($$, memberInit);
686 dummy = MkInitializerAssignment(MkExpDummy());
687 memberInit = MkMemberInit(null, dummy);
688 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.end;
689 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.end;
690 ListAdd($$, memberInit);
694 data_member_initialization_list_coloned:
695 data_member_initialization_list ';'
696 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; $$ = $1; }
697 | data_member_initialization_list_error ';'
698 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; $$ = $1; }
701 members_initialization_list_coloned:
702 data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($1); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
703 | instance_class_function_definition { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
704 | members_initialization_list_error data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; $$ = $1; }
705 | members_initialization_list_error instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
706 | members_initialization_list_coloned data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; $$ = $1; }
707 | members_initialization_list_coloned instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
708 | ';' { MembersInit members = MkMembersInitList(MkList()); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
709 | members_initialization_list_error ';'
710 | members_initialization_list_coloned ';' { MembersInit members = MkMembersInitList(MkList()); ListAdd($$, members); members.loc = @2; $$ = $1; }
713 members_initialization_list:
714 members_initialization_list_coloned
715 | data_member_initialization_list { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
716 | members_initialization_list_coloned data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
717 | members_initialization_list_error data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
720 members_initialization_list_error:
721 instance_class_function_definition_error { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
722 | members_initialization_list instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
723 | members_initialization_list_error instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
724 | members_initialization_list_coloned instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
725 | members_initialization_list_coloned data_member_initialization_list_error { ListAdd($$, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
726 | data_member_initialization_list_error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
727 | data_member_initialization_list error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @2; }
731 instantiation_named_error '}'
732 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
733 | instantiation_named_error error '}'
734 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
737 instantiation_named_error:
738 declaration_specifiers identifier '{' members_initialization_list_error
739 { $$ = 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++; }
740 | declaration_specifiers identifier '{' members_initialization_list error
741 { $$ = 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++; }
742 | declaration_specifiers identifier '{' members_initialization_list
743 { $$ = 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++; }
744 | declaration_specifiers identifier '{'
745 { $$ = 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++; }
746 | declaration_specifiers identifier '{' error
747 { $$ = 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++; }
752 declaration_specifiers identifier '{' members_initialization_list '}'
753 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
754 | declaration_specifiers identifier '{' members_initialization_list_error '}'
755 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
756 | declaration_specifiers identifier '{' '}'
757 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
760 instantiation_named_error:
761 declaration_specifiers identifier '{' members_initialization_list_error
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 | declaration_specifiers identifier '{' members_initialization_list error
764 { $$ = 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++; }
765 | declaration_specifiers identifier '{' members_initialization_list
766 { $$ = 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++; }
767 | declaration_specifiers identifier '{'
768 { $$ = 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++; }
769 | declaration_specifiers identifier '{' error
770 { $$ = 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++; }
775 guess_instantiation_named:
776 guess_instantiation_named_error '}'
777 { $$.loc = @$; $$.insideLoc.end = @2.start; }
778 | guess_instantiation_named_error error '}'
779 { $$.loc = @$; $$.insideLoc.end = @2.start; }
782 guess_instantiation_named_error:
783 guess_declaration_specifiers identifier '{' members_initialization_list_error
784 { $$ = 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++; }
785 | guess_declaration_specifiers identifier '{' members_initialization_list error
786 { $$ = 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++; }
787 | guess_declaration_specifiers identifier '{' members_initialization_list
788 { $$ = 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++; }
789 | guess_declaration_specifiers identifier '{'
790 { $$ = 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++; }
791 | guess_declaration_specifiers identifier '{' error
792 { $$ = 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++; }
796 guess_instantiation_named:
797 guess_declaration_specifiers identifier '{' members_initialization_list '}'
798 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
799 | guess_declaration_specifiers identifier '{' members_initialization_list_error '}'
800 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
801 | guess_declaration_specifiers identifier '{' '}'
802 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
805 guess_instantiation_named_error:
806 guess_declaration_specifiers identifier '{' members_initialization_list_error
807 { $$ = 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++; }
808 | guess_declaration_specifiers identifier '{' members_initialization_list error
809 { $$ = 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++; }
810 | guess_declaration_specifiers identifier '{' members_initialization_list
811 { $$ = 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++; }
812 | guess_declaration_specifiers identifier '{'
813 { $$ = 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++; }
814 | guess_declaration_specifiers identifier '{' error
815 { $$ = 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++; }
819 external_guess_instantiation_named:
820 external_guess_declaration_specifiers identifier '{' members_initialization_list '}'
821 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
822 | external_guess_declaration_specifiers identifier '{' members_initialization_list_error '}'
823 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
824 | external_guess_declaration_specifiers identifier '{' '}'
825 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
828 instantiation_unnamed:
829 instantiation_unnamed_error '}'
830 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
831 | instantiation_unnamed_error error '}'
832 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
835 instantiation_unnamed_error:
836 strict_type '{' members_initialization_list
837 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
838 | identifier '{' members_initialization_list
839 { Location tmpLoc = yylloc; yylloc = @1;
840 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; FreeIdentifier($1); }
842 | strict_type '{' members_initialization_list_error
843 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
845 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
846 | strict_type '{' members_initialization_list error
847 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
848 | strict_type '{' error
849 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
853 | identifier '{' members_initialization_list_error
854 { Location tmpLoc = yylloc; yylloc = @1;
855 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); }
857 { Location tmpLoc = yylloc; yylloc = @1;
858 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); }
859 | identifier '{' members_initialization_list error
860 { Location tmpLoc = yylloc; yylloc = @1;
861 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); }
862 | identifier '{' error
863 { Location tmpLoc = yylloc; yylloc = @1;
864 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); }
868 instantiation_unnamed:
869 strict_type '{' members_initialization_list '}'
870 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
871 | strict_type '{' members_initialization_list error '}'
872 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; }
873 | strict_type '{' members_initialization_list_error '}'
874 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
875 | strict_type '{' '}'
876 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start;}
877 | strict_type '{' error '}'
878 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start;}
881 | identifier '{' members_initialization_list '}'
882 { Location tmpLoc = yylloc; yylloc = @1;
883 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
884 | identifier '{' members_initialization_list_error '}'
885 { Location tmpLoc = yylloc; yylloc = @1;
886 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
887 | identifier '{' members_initialization_list error '}'
889 $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; FreeIdentifier($1); }
891 { Location tmpLoc = yylloc; yylloc = @1;
892 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start; FreeIdentifier($1);}
893 | identifier '{' error '}'
894 { Location tmpLoc = yylloc; yylloc = @1;
895 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
899 instantiation_unnamed_error:
900 strict_type '{' members_initialization_list_error
901 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
903 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
904 | strict_type '{' members_initialization_list error
905 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
906 | strict_type '{' error
907 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
911 | identifier '{' members_initialization_list_error
912 { Location tmpLoc = yylloc; yylloc = @1;
913 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); }
915 { Location tmpLoc = yylloc; yylloc = @1;
916 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); }
917 | identifier '{' members_initialization_list error
918 { Location tmpLoc = yylloc; yylloc = @1;
919 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); }
920 | identifier '{' error
921 { Location tmpLoc = yylloc; yylloc = @1;
922 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); }
927 instantiation_anon_error '}'
928 { $$.loc = @$; $$.insideLoc.end = @2.start; }
929 | instantiation_anon_error error '}'
930 { $$.loc = @$; $$.insideLoc.end = @2.start; }
933 instantiation_anon_error:
934 '{' members_initialization_list_error
935 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
936 | '{' members_initialization_list error
937 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
939 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
941 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
942 | '{' members_initialization_list
943 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
948 '{' members_initialization_list '}'
949 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
950 | '{' members_initialization_list error '}'
951 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @4.start; }
952 | '{' members_initialization_list_error '}'
953 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
955 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.start;}
957 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start;}
960 instantiation_anon_error:
961 '{' members_initialization_list_error
962 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
964 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
965 | '{' members_initialization_list error
966 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
968 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
973 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; }
976 default_property_error:
977 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; }
978 | postfix_expression '=' error { $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; $$.initializer.loc.end = @2.end; }
979 | postfix_expression error { $$ = MkMemberInitExp($1, null); $$.loc = @$; $$.realLoc = @$; }
982 default_property_list:
983 default_property { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
984 | default_property_list ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
985 | default_property_list_error ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
988 default_property_list_error:
989 default_property_error { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
990 | default_property_list ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
991 | default_property_list_error ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
992 | default_property_list error
996 PROPERTY property_specifiers identifier '{'
997 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
999 | PROPERTY property_specifiers abstract_declarator identifier '{'
1000 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
1002 | PROPERTY property_specifiers '{'
1003 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
1005 | PROPERTY property_specifiers abstract_declarator '{'
1006 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
1008 | PROPERTY error '{'
1009 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
1014 | property_body SETPROP compound_statement
1015 { $1.setStmt = $3; }
1016 | property_body GETPROP compound_statement
1017 { $1.getStmt = $3; }
1018 | property_body ISPROPSET compound_statement
1019 { $1.issetStmt = $3; }
1020 | property_body WATCHABLE
1021 { $1.isWatchable = true; }
1022 | property_body PROPERTY_CATEGORY i18n_string
1023 { $1.category = $3; }
1027 property_body '}' { $1.loc.end = @2.end; $$ = $1; }
1030 class_property_start:
1031 CLASS_PROPERTY property_specifiers identifier '{'
1032 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
1034 | CLASS_PROPERTY property_specifiers abstract_declarator identifier '{'
1035 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
1037 | CLASS_PROPERTY property_specifiers '{'
1038 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
1040 | CLASS_PROPERTY property_specifiers abstract_declarator '{'
1041 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
1043 | CLASS_PROPERTY error '{'
1044 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
1047 class_property_body:
1048 class_property_start
1049 | class_property_body SETPROP compound_statement
1050 { $1.setStmt = $3; }
1051 | class_property_body GETPROP compound_statement
1052 { $1.getStmt = $3; }
1056 class_property_body '}' { $1.loc.end = @2.end; }
1059 watch_property_list:
1061 { $$ = MkListOne($1); }
1062 | watch_property_list identifier
1063 { ListAdd($1, $2); }
1067 watch_property_list compound_statement
1068 { $$ = MkPropertyWatch($1, $2); }
1069 | DELETE compound_statement
1070 { $$ = MkDeleteWatch($2); }
1073 property_watch_list:
1075 { $$ = MkListOne($1); }
1076 | property_watch_list property_watch
1077 { ListAdd($1, $2); }
1080 self_watch_definition:
1081 WATCH '(' watch_property_list ')' compound_statement
1082 { $$ = MkPropertyWatch($3, $5); }
1086 WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1087 { $$ = MkWatchStmt(null, $3, $6); }
1088 | assignment_expression '.' WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1089 { $$ = MkWatchStmt($1, $5, $8); }
1093 STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1094 { $$ = MkStopWatchingStmt(null, $3, $5); }
1095 | assignment_expression '.' STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1096 { $$ = MkStopWatchingStmt($1, $5, $7); }
1097 | STOPWATCHING '(' assignment_expression ')'
1098 { $$ = MkStopWatchingStmt(null, $3, null); }
1099 | assignment_expression '.' STOPWATCHING '(' assignment_expression ')'
1100 { $$ = MkStopWatchingStmt($1, $5, null); }
1105 { $$ = MkFireWatchersStmt(null, null); }
1106 | FIREWATCHERS watch_property_list
1107 { $$ = MkFireWatchersStmt(null, $2); }
1108 | postfix_expression '.' FIREWATCHERS
1109 { $$ = MkFireWatchersStmt($1, null); }
1110 | assignment_expression '.' FIREWATCHERS watch_property_list
1111 { $$ = MkFireWatchersStmt($1, $4); }
1115 guess_declaration_specifiers struct_declarator_list ';' { $$ = MkClassDefDeclaration(MkStructDeclaration($1, $2, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1116 | guess_declaration_specifiers ';' { $$ = MkClassDefDeclaration(MkStructDeclaration($1, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1117 | instantiation_unnamed ';' { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1118 | guess_instantiation_named ';' { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1119 | class_function_definition { $$ = MkClassDefFunction($1); $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1120 | property { $$ = MkClassDefProperty($1); $$.loc = @$; globalContext.nextID++; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1122 | member_access guess_declaration_specifiers struct_declarator_list ';' { $$ = MkClassDefDeclaration(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1123 | member_access guess_declaration_specifiers ';' { $$ = MkClassDefDeclaration(MkStructDeclaration($2, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1124 | member_access instantiation_unnamed ';' { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1125 | member_access guess_instantiation_named ';' { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1126 | member_access class_function_definition { $$ = MkClassDefFunction($2); $$.loc = @$; $$.memberAccess = $1; }
1127 | member_access property { $$ = MkClassDefProperty($2); $$.loc = @$; globalContext.nextID++; $$.memberAccess = $1; }
1129 | default_property_list ';' { $$ = MkClassDefDefaultProperty($1); if($1->last) ((MemberInit)$1->last).loc.end = @2.start; $$.loc = @$; }
1130 | CLASS_DATA guess_declaration_specifiers struct_declarator_list ';' { $$ = MkClassDefClassData(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; }
1131 | class_property { $$ = MkClassDefClassProperty($1); $$.loc = @$; globalContext.nextID++; }
1132 | self_watch_definition ';' { $$ = MkClassDefPropertyWatch($1); $$.loc = @$; globalContext.nextID++; }
1133 | WATCHABLE { $$ = null; deleteWatchable = true; }
1134 | CLASS_DESIGNER identifier ';' { $$ = MkClassDefDesigner($2.string); FreeIdentifier($2); }
1135 | CLASS_DESIGNER strict_type ';' { $$ = MkClassDefDesigner($2.name); FreeSpecifier($2); }
1136 | CLASS_NO_EXPANSION { $$ = MkClassDefNoExpansion(); }
1137 | CLASS_FIXED { $$ = MkClassDefFixed(); }
1138 | CLASS_DEFAULT_PROPERTY identifier ';' { $$ = MkClassDefDesignerDefaultProperty($2); }
1139 | CLASS_PROPERTY '(' identifier ')' '=' initializer_condition ';' { $$ = MkClassDefClassPropertyValue($3, $6); $$.loc = @$; }
1141 | ';' { $$ = null; }
1142 | member_access ':' { memberAccessStack[defaultMemberAccess] = $1; if(defaultMemberAccess == 0) { $$ = MkClassDefMemberAccess(); $$.memberAccess = $1; $$.loc = @$; } else $$ = null; }
1144 | member_access '(' identifier ')' { $$ = MkClassDefAccessOverride($1, $3); $$.loc = @$; }
1147 struct_declaration_error:
1148 class_function_definition_error { $$ = MkClassDefFunction($1); $$.loc = $1.loc; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1149 | guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1150 | instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1151 | guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1152 | instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1154 | member_access class_function_definition_error { $$ = MkClassDefFunction($2); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = $1; }
1155 | member_access guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1156 | member_access instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1157 | member_access guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1158 | member_access instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1160 | default_property_list_error { $$ = MkClassDefDefaultProperty($1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
1163 struct_declaration_list:
1164 struct_declaration { $$ = MkList(); ListAdd($$, $1); }
1165 | struct_declaration_list struct_declaration { $$ = $1; ListAdd($1, $2); }
1166 | struct_declaration_list_error struct_declaration { $$ = $1; ListAdd($1, $2); }
1169 struct_declaration_list_error:
1170 struct_declaration_error { $$ = MkList(); ListAdd($$, $1); }
1171 | struct_declaration_list error
1172 | struct_declaration_list_error error
1173 | struct_declaration_list struct_declaration_error { $$ = $1; ListAdd($$, $2); }
1174 | struct_declaration_list_error struct_declaration_error { $$ = $1; ListAdd($$, $2); }
1178 declaration_specifiers { $$ = MkTemplateDatatype($1, null); }
1179 | declaration_specifiers abstract_declarator { $$ = MkTemplateDatatype($1, $2); }
1180 | identifier { $$ = MkTemplateDatatype(MkListOne(MkSpecifierName($1.string)), null); FreeIdentifier($1); }
1183 template_type_argument:
1184 template_datatype { $$ = MkTemplateTypeArgument($1); }
1187 template_type_parameter:
1188 CLASS identifier { $$ = MkTypeTemplateParameter($2, null, null); }
1189 | CLASS identifier '=' template_type_argument { $$ = MkTypeTemplateParameter($2, null, $4); }
1190 | CLASS identifier ':' template_datatype { $$ = MkTypeTemplateParameter($2, $4, null); }
1191 | CLASS identifier ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter($2, $4, $6); }
1192 | CLASS base_strict_type_name { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, null); delete $2; }
1193 | CLASS base_strict_type_name '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, $4); }
1194 | CLASS base_strict_type_name ':' template_datatype { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, null); }
1195 | CLASS base_strict_type_name ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, $6); }
1198 template_identifier_argument:
1199 identifier { $$ = MkTemplateIdentifierArgument($1); }
1202 template_identifier_parameter:
1203 identifier { $$ = MkIdentifierTemplateParameter($1, dataMember, null); }
1204 | identifier '=' template_identifier_argument { $$ = MkIdentifierTemplateParameter($1, dataMember, $3); }
1207 template_expression_argument:
1208 constant_expression { $$ = MkTemplateExpressionArgument($1); }
1211 template_expression_parameter:
1212 template_datatype identifier { $$ = MkExpressionTemplateParameter($2, $1, null); }
1213 | template_datatype identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($2, $1, $4); }
1217 template_type_parameter
1218 | template_identifier_parameter
1219 | template_expression_parameter
1222 template_parameters_list:
1223 template_parameter { $$ = MkList(); ListAdd($$, $1); }
1224 | template_parameters_list ',' template_parameter { $$ = $1; ListAdd($1, $3); }
1228 template_expression_argument
1229 | template_identifier_argument
1230 | template_type_argument
1231 | identifier '=' template_expression_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1232 | identifier '=' template_identifier_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1233 | identifier '=' template_type_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1234 | template_datatype '=' template_expression_argument
1237 if($1.specifiers && $1.specifiers->first)
1239 Specifier spec = $1.specifiers->first;
1240 if(spec.type == nameSpecifier)
1241 $$.name = MkIdentifier(spec.name);
1243 FreeTemplateDataType($1);
1246 | template_datatype '=' template_identifier_argument
1249 if($1.specifiers && $1.specifiers->first)
1251 Specifier spec = $1.specifiers->first;
1252 if(spec.type == nameSpecifier)
1253 $$.name = MkIdentifier(spec.name);
1255 FreeTemplateDataType($1);
1258 | template_datatype '=' template_type_argument
1261 if($1.specifiers && $1.specifiers->first)
1263 Specifier spec = $1.specifiers->first;
1264 if(spec.type == nameSpecifier)
1265 $$.name = MkIdentifier(spec.name);
1267 FreeTemplateDataType($1);
1272 template_arguments_list:
1273 template_argument { $$ = MkList(); ListAdd($$, $1); }
1274 | template_arguments_list ',' template_argument { $$ = $1; ListAdd($1, $3); }
1280 if(curContext != globalContext)
1281 PopContext(curContext);
1286 class_entry identifier { $1; $$ = DeclClassAddNameSpace(globalContext.nextID++, $2.string); FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1287 | class_entry base_strict_type
1289 $1; $$ = DeclClass(globalContext.nextID++, $2.name);
1292 ++defaultMemberAccess;
1293 memberAccessStack[defaultMemberAccess] = privateAccess;
1295 | identifier class_entry identifier { $2; $$ = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($1); FreeIdentifier($3); $$.nameLoc = @3; $$.isRemote = true; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1296 | identifier class_entry base_strict_type { $2; $$ = DeclClass(globalContext.nextID++, $3.name); FreeIdentifier($1); $$.nameLoc = @3; $$.isRemote = true; FreeSpecifier($3); memberAccessStack[++defaultMemberAccess] = privateAccess; }
1298 | class_entry identifier '<' template_parameters_list '>' { $1; $$ = DeclClassAddNameSpace(globalContext.nextID++, $2.string); $$.templateParams = $4; FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1299 | class_entry base_strict_type '<' template_parameters_list '>'
1301 $1; $$ = DeclClass(globalContext.nextID++, $2.name);
1302 $$.templateParams = $4;
1305 ++defaultMemberAccess;
1306 memberAccessStack[defaultMemberAccess] = privateAccess;
1308 | identifier class_entry identifier '<' template_parameters_list '>' { $2; $$ = DeclClassAddNameSpace(globalContext.nextID++, $3.string); $$.templateParams = $5; FreeIdentifier($1); FreeIdentifier($3); $$.nameLoc = @3; $$.isRemote = true; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1309 | identifier class_entry base_strict_type '<' template_parameters_list '>' { $2; $$ = DeclClass(globalContext.nextID++, $3.name); $$.templateParams = $5; FreeIdentifier($1); $$.nameLoc = @3; $$.isRemote = true; FreeSpecifier($3); memberAccessStack[++defaultMemberAccess] = privateAccess; }
1319 // Added this for unit classes...
1322 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1324 PopContext(curContext);
1327 | class_decl '{' '}'
1329 $$ = MkClass($1, null, MkList()); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1331 PopContext(curContext);
1333 | class_head '{' '}'
1335 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1337 PopContext(curContext);
1340 | class_entry identifier ';'
1342 $1; $$ = MkClass(DeclClassAddNameSpace(0, $2.string), null, null); FreeIdentifier($2);
1344 PopContext(curContext);
1346 | class_entry type ';'
1348 $1; $$ = MkClass(DeclClass(0, $2.name), null, null); FreeSpecifier($2);
1350 PopContext(curContext);
1355 class_decl ':' inheritance_specifiers
1357 $$ = MkClass($1, $3, null);
1362 class_decl '{' struct_declaration_list_error
1364 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1366 PopContext(curContext);
1368 | class_head '{' struct_declaration_list_error
1370 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1372 PopContext(curContext);
1374 | class_decl '{' struct_declaration_list
1376 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1378 PopContext(curContext);
1380 | class_head '{' struct_declaration_list
1382 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1384 PopContext(curContext);
1386 | class_decl '{' error
1388 $$ = MkClass($1, null, MkList()); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1390 PopContext(curContext);
1392 | class_head '{' error
1394 $$ = $1; $$.definitions = MkList(); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1396 PopContext(curContext);
1400 /**** EXPRESSIONS ********************************************************************/
1404 { $$ = MkIdentifier(yytext); $$.loc = @1; }
1408 simple_primary_expression
1409 | '(' expression ')'
1410 { $$ = MkExpBrackets($2); $$.loc = @$; }
1414 string_literal { $$ = MkExpString($1); delete $1; $$.loc = @$; }
1415 | '$' string_literal { $$ = MkExpIntlString($2, null); delete $2; $$.loc = @$; }
1416 | '$' string_literal '.' string_literal { $$ = MkExpIntlString($4, $2); delete $2; delete $4; $$.loc = @$; }
1419 simple_primary_expression:
1420 identifier { $$ = MkExpIdentifier($1); $$.loc = @$; }
1421 | instantiation_unnamed { $$ = MkExpInstance($1); $$.loc = @$; }
1422 | EXTENSION '(' compound_statement ')' { $$ = MkExpExtensionCompound($3); $$.loc = @$; }
1423 | EXTENSION '(' expression ')' { $$ = MkExpExtensionExpression($3); $$.loc = @$; }
1424 | EXTENSION '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, $5); $$.loc = @$; }
1425 | EXTENSION '(' type_name ')' '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, MkInitializerAssignment(MkExpExtensionInitializer($6, $8))); $$.loc = @$; }
1426 | CONSTANT { $$ = MkExpConstant(yytext); $$.loc = @$; }
1428 | '(' ')' { Expression exp = MkExpDummy(); exp.loc.start = @1.end; exp.loc.end = @2.start; $$ = MkExpBrackets(MkListOne(exp)); $$.loc = @$; yyerror(); }
1429 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1430 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1431 | NEWOP new_specifiers '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1432 | NEWOP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1433 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1434 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1435 | NEW0OP new_specifiers '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1436 | NEW0OP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1437 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1438 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1439 | RENEW constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1440 | RENEW constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1441 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1442 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1443 | RENEW0 constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1444 | RENEW0 constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1445 | CLASS '(' declaration_specifiers ')' { $$ = MkExpClass($3, null); $$.loc = @$; }
1446 | CLASS '(' declaration_specifiers abstract_declarator ')' { $$ = MkExpClass($3, $4); $$.loc = @$; }
1447 | CLASS '(' identifier ')' { $$ = MkExpClass(MkListOne(MkSpecifierName($3.string)), null); FreeIdentifier($3); $$.loc = @$; }
1448 | VAARG '(' assignment_expression ',' type_name ')' { $$ = MkExpVaArg($3, $5); $$.loc = @$; }
1450 | CLASS_DATA '(' identifier ')' { $$ = MkExpClassData($3); $$.loc = @$; }
1456 | '[' argument_expression_list /*expression*/ ']' { $$ = MkExpArray($2); $$.loc = @$; }
1459 anon_instantiation_expression:
1460 instantiation_anon { $$ = MkExpInstance($1); $$.loc = @$; }
1463 anon_instantiation_expression_error:
1464 instantiation_anon_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1467 primary_expression_error:
1468 '(' expression { $$ = MkExpBrackets($2); $$.loc = @$; }
1469 | '(' expression_error { $$ = MkExpBrackets($2); $$.loc = @$; }
1475 | postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1476 | postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1477 | postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1478 | postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1479 | 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; }
1480 | postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1481 | postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1482 | postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1483 | postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1485 | postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1486 | postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1487 | postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1488 | postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1489 | postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1490 | postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1491 | postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1492 | postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1495 simple_postfix_expression:
1496 simple_primary_expression
1498 | simple_postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1499 | simple_postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1500 | simple_postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1501 | simple_postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1502 | 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; }
1503 | simple_postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1504 | simple_postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1505 | simple_postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1506 | simple_postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1508 | simple_postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1509 | simple_postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1510 | simple_postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1511 | simple_postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1512 | simple_postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1513 | simple_postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1514 | simple_postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1515 | simple_postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1518 argument_expression_list:
1519 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1520 | anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1521 | argument_expression_list ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1522 | argument_expression_list ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1525 argument_expression_list_error:
1526 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
1527 | anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
1528 | argument_expression_list ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
1529 | argument_expression_list ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
1530 | argument_expression_list ',' { Expression exp = MkExpDummy(); exp.loc.start = @2.end; exp.loc.end = @2.end; $$ = $1; ListAdd($1, exp); }
1533 common_unary_expression:
1534 INC_OP unary_expression { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1535 | DEC_OP unary_expression { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1536 | unary_operator cast_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1537 | unary_operator anon_instantiation_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1538 | SIZEOF '(' unary_expression ')' { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1539 | SIZEOF simple_unary_expression { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1540 | SIZEOF '(' guess_type_name ')' { $$ = MkExpTypeSize($3); $$.loc = @$; }
1541 | SIZEOF '(' CLASS type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1542 | SIZEOF '(' CLASS guess_type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1544 | ALIGNOF '(' unary_expression ')' { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1545 | ALIGNOF simple_unary_expression { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1546 | ALIGNOF '(' guess_type_name ')' { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1550 common_unary_expression
1551 | postfix_expression
1554 simple_unary_expression:
1555 common_unary_expression
1556 | simple_postfix_expression
1566 | DELETE { $$ = DELETE; }
1567 | _INCREF { $$ = _INCREF; }
1572 | '(' type_name ')' cast_expression { $$ = MkExpCast($2, $4); $$.loc = @$; }
1575 multiplicative_expression:
1577 | multiplicative_expression '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1578 | multiplicative_expression '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1579 | multiplicative_expression '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1580 | multiplicative_expression_error '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1581 | multiplicative_expression_error '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1582 | multiplicative_expression_error '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1585 additive_expression:
1586 multiplicative_expression
1587 | additive_expression '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1588 | additive_expression '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1589 | additive_expression_error '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1590 | additive_expression_error '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1595 | shift_expression LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1596 | shift_expression RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1597 | shift_expression_error LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1598 | shift_expression_error RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1601 relational_expression_smaller_than:
1602 relational_expression '<'
1609 relational_expression:
1611 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression { skipErrors = false; $$ = MkExpOp($1, '<', $2/*$3*/); $$.loc = @$; }
1612 | relational_expression '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1613 | relational_expression LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1614 | relational_expression GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1615 | relational_expression_error '<' shift_expression { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1616 | relational_expression_error '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1617 | relational_expression_error LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1618 | relational_expression_error GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1622 : relational_expression
1623 | equality_expression EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1624 | equality_expression NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1625 | equality_expression_error EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1626 | equality_expression_error NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1628 | equality_expression EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1629 | equality_expression NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1630 | equality_expression_error EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1631 | equality_expression_error NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1635 : equality_expression
1636 | and_expression '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1637 | and_expression_error '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1639 | and_expression '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1640 | and_expression_error '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1643 exclusive_or_expression
1645 | exclusive_or_expression '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1646 | exclusive_or_expression_error '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1648 | exclusive_or_expression '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1649 | exclusive_or_expression_error '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1652 inclusive_or_expression
1653 : exclusive_or_expression
1654 | inclusive_or_expression '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1655 | inclusive_or_expression_error '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1657 | inclusive_or_expression '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1658 | inclusive_or_expression_error '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1661 logical_and_expression
1662 : inclusive_or_expression
1663 | logical_and_expression AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1664 | logical_and_expression_error AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1667 logical_or_expression
1668 : logical_and_expression
1669 | logical_or_expression OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1670 | logical_or_expression_error OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1673 conditional_expression
1674 : logical_or_expression
1675 | logical_or_expression '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1676 | logical_or_expression '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1677 | logical_or_expression_error '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1678 | logical_or_expression_error '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1680 | logical_or_expression '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1681 | logical_or_expression '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1682 | logical_or_expression_error '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1683 | logical_or_expression_error '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1685 | logical_or_expression '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1686 | logical_or_expression '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1687 | logical_or_expression_error '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1688 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1690 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1691 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1692 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1693 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1696 assignment_expression:
1697 conditional_expression
1698 | unary_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1699 | unary_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1700 | conditional_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; } // TODO: Generate error here:
1701 | conditional_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; } // TODO: Generate error here:
1703 | unary_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1704 | unary_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1705 | conditional_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1706 | conditional_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1709 assignment_operator:
1711 | MUL_ASSIGN { $$ = MUL_ASSIGN; }
1712 | DIV_ASSIGN { $$ = DIV_ASSIGN; }
1713 | MOD_ASSIGN { $$ = MOD_ASSIGN; }
1714 | ADD_ASSIGN { $$ = ADD_ASSIGN; }
1715 | SUB_ASSIGN { $$ = SUB_ASSIGN; }
1716 | LEFT_ASSIGN { $$ = LEFT_ASSIGN; }
1717 | RIGHT_ASSIGN { $$ = RIGHT_ASSIGN; }
1718 | AND_ASSIGN { $$ = AND_ASSIGN; }
1719 | XOR_ASSIGN { $$ = XOR_ASSIGN; }
1720 | OR_ASSIGN { $$ = OR_ASSIGN; }
1724 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1725 | expression ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1726 | expression_error ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1727 | expression_error ')'
1730 expression_anon_inst:
1731 anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1732 | expression ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1733 | expression_error ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1736 postfix_expression_error:
1737 primary_expression_error
1738 | error { $$ = MkExpDummy(); $$.loc = @$; /*printf("Sorry, didn't mean that syntax error\n");*/ }
1739 | postfix_expression error
1740 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1742 | postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1743 | postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1745 | postfix_expression '(' argument_expression_list { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1746 | postfix_expression '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1747 /* Useless rules due to conflicts
1748 | postfix_expression '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; $$.call.argLoc.end.charPos++;}
1749 | postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1751 | postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1753 | 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++;}
1754 /* Useless rules due to conflicts
1755 | 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++;}
1756 | postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1758 | postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1761 simple_postfix_expression_error:
1762 error { $$ = MkExpDummy(); $$.loc = @$; }
1763 | simple_postfix_expression error
1764 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1766 | simple_postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1767 | simple_postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1769 | simple_postfix_expression '(' argument_expression_list { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1770 | 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++;}
1771 /* Useless rules due to conflicts
1772 | 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++;}
1773 | simple_postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1775 | simple_postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1777 | 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++;}
1778 /* Useless rules due to conflicts
1779 | 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++;}
1780 | simple_postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1782 | simple_postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1785 common_unary_expression_error:
1786 INC_OP unary_expression_error { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1787 | DEC_OP unary_expression_error { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1788 | unary_operator cast_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1789 | unary_operator anon_instantiation_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1790 | SIZEOF '(' unary_expression_error { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1791 | SIZEOF simple_unary_expression_error { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1792 | SIZEOF '(' guess_type_name ')' error { $$ = MkExpTypeSize($3); $$.loc = @$; }
1793 | SIZEOF '(' CLASS type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1794 | SIZEOF '(' CLASS guess_type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1795 | ALIGNOF '(' unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1796 | ALIGNOF simple_unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1797 | ALIGNOF '(' guess_type_name ')' error { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1800 unary_expression_error:
1801 common_unary_expression_error
1802 | postfix_expression_error
1805 simple_unary_expression_error:
1806 common_unary_expression_error
1807 | simple_postfix_expression_error
1811 cast_expression_error:
1812 unary_expression_error
1813 | '(' type_name ')' cast_expression_error { $$ = MkExpCast($2, $4); $$.loc = @$; }
1816 multiplicative_expression_error:
1817 cast_expression_error
1818 | multiplicative_expression '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1819 | multiplicative_expression '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1820 | multiplicative_expression '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1821 | multiplicative_expression_error '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1822 | multiplicative_expression_error '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1823 | multiplicative_expression_error '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1826 additive_expression_error:
1827 multiplicative_expression_error
1828 | additive_expression '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1829 /* Useless rules due to conflicts
1830 | additive_expression '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1832 | additive_expression '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1833 /* Useless rules due to conflicts
1834 | additive_expression '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1836 | additive_expression_error '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1837 /* Useless rules due to conflicts
1838 | additive_expression_error '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1840 | additive_expression_error '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1841 /* Useless rules due to conflicts
1842 | additive_expression_error '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1846 shift_expression_error:
1847 additive_expression_error
1848 | shift_expression LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1849 | shift_expression RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1850 | shift_expression_error LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1851 | shift_expression_error RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1854 relational_expression_error:
1855 shift_expression_error
1856 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression_error
1858 if($1.type == identifierExp)
1860 if($1.identifier._class && !$1.identifier._class.name)
1864 strcat(name, $1.identifier.string);
1865 _DeclClass(0, name);
1868 _DeclClass(0, $1.identifier.string);
1870 // printf("Declaring Class %s\n", $1.identifier.string);
1876 fileInput.Seek(@1.start.pos, start);
1877 resetScannerPos(&@1.start);
1882 YY_STACK_PRINT (yyss, yyssp);
1886 YY_STACK_PRINT (yyss, yyssp);
1890 YY_STACK_PRINT (yyss, yyssp);
1894 YY_STACK_PRINT (yyss, yyssp);
1902 $$ = MkExpOp($1, '<', $2);
1907 | relational_expression '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1908 | relational_expression LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1909 | relational_expression GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1910 | relational_expression_error '<' shift_expression_error { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1911 | relational_expression_error '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1912 | relational_expression_error LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1913 | relational_expression_error GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1916 equality_expression_error:
1917 relational_expression_error
1918 | equality_expression EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1919 | equality_expression NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1920 | equality_expression_error EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1921 | equality_expression_error NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1922 /* Useless rules due to conflicts
1923 | equality_expression EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1924 | equality_expression NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1925 | equality_expression_error EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1926 | equality_expression_error NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1928 | equality_expression EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1929 | equality_expression NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1930 | equality_expression_error EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1931 | equality_expression_error NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1934 and_expression_error:
1935 equality_expression_error
1936 | and_expression '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1937 | and_expression_error '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1939 | and_expression '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1940 | and_expression_error '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1943 exclusive_or_expression_error:
1944 and_expression_error
1945 | exclusive_or_expression '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1946 | exclusive_or_expression_error '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1948 | exclusive_or_expression '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1949 | exclusive_or_expression_error '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1952 inclusive_or_expression_error:
1953 exclusive_or_expression_error
1954 | inclusive_or_expression '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1955 | inclusive_or_expression_error '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1957 | inclusive_or_expression '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1958 | inclusive_or_expression_error '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1961 logical_and_expression_error:
1962 inclusive_or_expression_error
1963 | logical_and_expression AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1964 | logical_and_expression_error AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1967 logical_or_expression_error:
1968 logical_and_expression_error
1969 | logical_or_expression OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1970 | logical_or_expression_error OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1973 conditional_expression_error:
1974 logical_or_expression_error
1975 | logical_or_expression '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1976 | logical_or_expression '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1977 | logical_or_expression_error '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1978 | logical_or_expression_error '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1979 | logical_or_expression '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1980 | logical_or_expression '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1981 | logical_or_expression_error '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1982 | logical_or_expression_error '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1984 | logical_or_expression '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1985 | logical_or_expression '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1986 | logical_or_expression_error '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1987 | logical_or_expression_error '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1988 | logical_or_expression '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1989 | logical_or_expression '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1990 | logical_or_expression_error '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1991 | logical_or_expression_error '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1993 | logical_or_expression '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1994 | logical_or_expression '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1995 | logical_or_expression_error '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1996 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1998 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1999 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2000 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2001 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2003 | logical_or_expression '?' ':'
2005 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy());
2007 ((Expression)$$.cond.exp->last).loc = @2;
2008 $$.cond.elseExp.loc = @3;
2010 | logical_or_expression_error '?' ':'
2012 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @3;
2014 | logical_or_expression '?'
2016 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2018 | logical_or_expression_error '?'
2020 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2024 assignment_expression_error:
2025 conditional_expression_error
2026 | unary_expression assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2027 /* Useless rules due to conflicts
2028 | unary_expression assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2030 | unary_expression_error assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2031 /* Useless rules due to conflicts
2032 | unary_expression_error assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2035 | unary_expression assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2036 | unary_expression_error assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2040 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
2041 | assignment_expression error { $$ = MkList(); ListAdd($$, $1); }
2042 | expression ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2043 | expression_error ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2044 /* Useless rules due to conflicts
2045 | expression ',' error
2046 | expression_error ',' error
2049 | expression expression { $$ = $1; FreeList($2, FreeExpression); }
2050 | expression_error expression { $$ = $1; FreeList($2, FreeExpression); }
2051 | expression expression_error { $$ = $1; FreeList($2, FreeExpression); }
2054 expression_anon_inst_error:
2055 anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
2056 | anon_instantiation_expression error { $$ = MkList(); ListAdd($$, $1); }
2057 | expression ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2058 | expression_error ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2062 constant_expression: conditional_expression;
2064 constant_expression_error: conditional_expression_error;
2066 /**** TYPES **************************************************************************/
2067 storage_class_specifier:
2068 TYPEDEF { $$ = MkSpecifier(TYPEDEF); }
2069 | EXTERN { $$ = MkSpecifier(EXTERN); }
2070 | STATIC { $$ = MkSpecifier(STATIC); }
2071 | AUTO { $$ = MkSpecifier(AUTO); }
2072 | REGISTER { $$ = MkSpecifier(REGISTER); }
2075 external_storage_class_specifier:
2076 TYPEDEF { $$ = MkSpecifier(TYPEDEF); declMode = defaultAccess; }
2077 | EXTERN { $$ = MkSpecifier(EXTERN); }
2078 | STATIC { $$ = MkSpecifier(STATIC); declMode = staticAccess; }
2079 | AUTO { $$ = MkSpecifier(AUTO); }
2080 | REGISTER { $$ = MkSpecifier(REGISTER); }
2084 identifier { $$ = MkEnumerator($1, null); }
2085 | identifier '=' constant_expression { $$ = MkEnumerator($1, $3); }
2086 | identifier '=' constant_expression_error { $$ = MkEnumerator($1, $3); }
2090 enumerator { $$ = MkList(); ListAdd($$, $1); }
2091 | enumerator_list ',' enumerator { $$ = $1; ListAdd($1, $3); }
2092 | enumerator_list ','
2096 ENUM { memberAccessStack[++defaultMemberAccess] = publicAccess; }
2099 enum_specifier_nocompound:
2100 enum_specifier identifier { $$ = MkEnum($2, null); POP_DEFAULT_ACCESS }
2101 | enum_specifier strict_type { $$ = MkEnum(MkIdentifier($2.name), null); POP_DEFAULT_ACCESS }
2104 enum_specifier_compound:
2105 enum_specifier_compound_error '}' { $$.loc = @$; POP_DEFAULT_ACCESS $$ = $1; }
2106 | enum_specifier identifier '{' '}' { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2107 | enum_specifier strict_type '{' '}' { $$ = MkEnum(MkIdentifier($2.name), null); FreeSpecifier($2); $$.loc = @$; POP_DEFAULT_ACCESS }
2110 enum_specifier_compound_error:
2111 enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2112 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2114 | enum_specifier identifier '{' enumerator_list { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2115 | enum_specifier identifier '{' enumerator_list error { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2116 | enum_specifier identifier '{' error { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2117 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2118 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2120 | enum_specifier strict_type '{' enumerator_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2121 | enum_specifier strict_type '{' enumerator_list error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2122 | enum_specifier strict_type '{' error { $$ = MkEnum(MkIdentifier($2.name), null); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2123 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2124 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2128 enum_specifier identifier { $$ = $2; if(declMode) DeclClassAddNameSpace(globalContext.nextID++, $2.string); }
2129 | enum_specifier strict_type { $$ = MkIdentifier($2.name); if(declMode) DeclClass(globalContext.nextID++, $2.name); FreeSpecifier($2); }
2133 enum_class_error '}' { $$ = $1; $$.loc = @$; }
2134 | enum_decl ':' inheritance_specifiers '{' '}' { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2135 | enum_decl '{' '}' { $$ = MkEnum($1, null); POP_DEFAULT_ACCESS }
2139 enum_decl ':' inheritance_specifiers '{' enumerator_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2140 | enum_decl ':' inheritance_specifiers '{' enumerator_list error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2141 | enum_decl ':' inheritance_specifiers '{' error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2142 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2143 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2144 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2145 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2146 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2147 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list_error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2149 | enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2150 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2152 | enum_decl '{' enumerator_list { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2153 | enum_decl '{' enumerator_list error { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2154 | enum_decl '{' error { $$ = MkEnum($1, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2155 | enum_decl '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2156 | enum_decl '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2164 class_specifier_error:
2166 | struct_class_error
2170 EXT_STORAGE { $$ = MkSpecifierExtended(MkExtDeclString(CopyString(yytext))); }
2171 | ext_decl { $$ = MkSpecifierExtended($1); }
2175 CONST { $$ = MkSpecifier(CONST); }
2176 | VOLATILE { $$ = MkSpecifier(VOLATILE); }
2177 | ext_storage { $$ = $1; }
2181 type_qualifier_list:
2182 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2183 | type_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2187 VOID { $$ = MkSpecifier(VOID); }
2188 | CHAR { $$ = MkSpecifier(CHAR); }
2189 | SHORT { $$ = MkSpecifier(SHORT); }
2190 | INT { $$ = MkSpecifier(INT); }
2191 | UINT { $$ = MkSpecifier(UINT); }
2192 | INT64 { $$ = MkSpecifier(INT64); }
2193 | VALIST { $$ = MkSpecifier(VALIST); }
2194 | LONG { $$ = MkSpecifier(LONG); }
2195 | FLOAT { $$ = MkSpecifier(FLOAT); }
2196 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2197 | SIGNED { $$ = MkSpecifier(SIGNED); }
2198 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2199 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2200 | struct_or_union_specifier_nocompound
2201 | enum_specifier_nocompound
2203 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2204 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2205 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2206 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2207 | TYPED_OBJECT { $$ = MkSpecifier(TYPED_OBJECT); }
2208 | ANY_OBJECT { $$ = MkSpecifier(ANY_OBJECT); }
2211 strict_type_specifier:
2212 VOID { $$ = MkSpecifier(VOID); }
2213 | CHAR { $$ = MkSpecifier(CHAR); }
2214 | SHORT { $$ = MkSpecifier(SHORT); }
2215 | INT { $$ = MkSpecifier(INT); }
2216 | UINT { $$ = MkSpecifier(UINT); }
2217 | INT64 { $$ = MkSpecifier(INT64); }
2218 | VALIST { $$ = MkSpecifier(VALIST); }
2219 | LONG { $$ = MkSpecifier(LONG); }
2220 | FLOAT { $$ = MkSpecifier(FLOAT); }
2221 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2222 | SIGNED { $$ = MkSpecifier(SIGNED); }
2223 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2224 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2225 | struct_or_union_specifier_nocompound
2226 | enum_specifier_nocompound
2228 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2229 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2230 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2231 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2234 // TESTING declarator_nofunction here... For function declarations
2237 declarator_nofunction_type_ok
2238 { $$ = MkStructDeclarator($1, null); $$.loc = @$; }
2239 | declarator_nofunction_type_ok attrib
2240 { $$ = MkStructDeclarator($1, null); $$.structDecl.attrib = $2; $$.loc = @$; }
2241 | ':' constant_expression
2242 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2243 | declarator_nofunction_type_ok ':' constant_expression
2244 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2245 | declarator_nofunction_type_ok ':' constant_expression ':' constant_expression
2246 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2247 | ':' constant_expression_error
2248 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2249 | declarator_nofunction_type_ok ':' constant_expression_error
2250 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2251 | declarator_nofunction_type_ok ':' constant_expression ':' constant_expression_error
2252 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2253 | declarator_nofunction_type_ok ':' constant_expression_error ':' constant_expression_error
2254 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2255 | declarator_nofunction_type_ok ':' constant_expression_error ':' constant_expression
2256 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2259 struct_declarator_list:
2260 struct_declarator { $$ = MkList(); ListAdd($$, $1); }
2261 | struct_declarator_list ',' struct_declarator { $$ = $1; ListAdd($1, $3); }
2265 struct_or_union identifier
2267 $$ = MkStructOrUnion($1, $2, null);
2268 $$.addNameSpace = true;
2269 $$.ctx = PushContext();
2271 | struct_or_union base_strict_type
2273 $$ = MkStructOrUnion($1, MkIdentifier($2.name), null);
2274 $$.ctx = PushContext();
2277 | struct_or_union ext_decl identifier
2279 $$ = MkStructOrUnion($1, $3, null);
2280 $$.extDeclStruct = $2;
2281 $$.addNameSpace = true;
2282 $$.ctx = PushContext();
2284 | struct_or_union ext_decl base_strict_type
2286 $$ = MkStructOrUnion($1, MkIdentifier($3.name), null);
2287 $$.extDeclStruct = $2;
2288 $$.ctx = PushContext();
2293 struct_or_union_specifier_compound:
2294 struct_or_union_specifier_compound_error '}' { $$ = $1; $$.loc = @$; }
2295 | struct_entry '{' '}' { $$ = $1; $$.loc = @$; POP_DEFAULT_ACCESS PopContext(curContext); }
2296 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2297 | struct_or_union ext_decl '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; $$.loc = @$; POP_DEFAULT_ACCESS }
2300 struct_or_union_specifier_compound_error:
2301 struct_entry '{' struct_declaration_list { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2302 | struct_entry '{' struct_declaration_list_error { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2303 | struct_entry '{' error { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2305 | struct_or_union '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2306 | struct_or_union '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2307 | struct_or_union '{' error { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2309 | struct_or_union ext_decl '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2310 | struct_or_union ext_decl '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2311 | struct_or_union ext_decl '{' error { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2314 struct_or_union_specifier_nocompound:
2315 struct_entry { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2324 ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2327 | struct_entry '<' template_parameters_list '>'
2329 Symbol symbol = ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2331 symbol.templateParams = $3;
2336 struct_decl ':' inheritance_specifiers
2340 SetupBaseSpecs(null, $3);
2345 struct_class_error '}' { $$ = $1; $$.loc = @$; }
2346 | struct_head '{' '}'
2347 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2348 | struct_decl '{' '}' { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2349 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2353 struct_head '{' struct_declaration_list
2356 $$.definitions = $3;
2358 PopContext(curContext);
2360 | struct_head '{' struct_declaration_list_error
2363 $$.definitions = $3;
2365 PopContext(curContext);
2367 | struct_head '{' error
2368 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext);}
2370 | struct_decl '{' struct_declaration_list
2372 PopContext(curContext);
2375 $$ = MkStructOrUnion($1.type, $1.id, $3);
2380 $$.definitions = $3;
2383 | struct_decl '{' struct_declaration_list_error
2385 PopContext(curContext);
2389 $$ = MkStructOrUnion($1.type, $1.id, $3);
2394 $$.definitions = $3;
2397 | struct_decl '{' error
2398 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2400 | struct_or_union '{' struct_declaration_list
2401 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2402 | struct_or_union '{' struct_declaration_list_error
2403 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2404 | struct_or_union '{' error
2405 { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2409 STRUCT { $$ = structSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2410 | UNION { $$ = unionSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2413 specifier_qualifier_list:
2414 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2415 | specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2416 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2417 | specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2418 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2419 | specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2420 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2421 | specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2424 guess_specifier_qualifier_list:
2425 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2426 | guess_specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2427 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2428 | guess_specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2429 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2430 | guess_specifier_qualifier_list guess_type { $$ = $1; ListAdd($1, $2); }
2431 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2432 | guess_specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2433 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2434 | guess_specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2437 declaration_specifiers:
2438 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2439 | declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2440 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2441 | declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2442 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2443 | declaration_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2444 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2445 | declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2446 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2447 | declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2450 guess_declaration_specifiers:
2451 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2452 | guess_declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2453 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2454 | guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2455 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2456 | guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2457 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2458 | guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2459 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2460 | guess_declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2461 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2462 | guess_declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2465 external_guess_declaration_specifiers:
2466 external_storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2467 | external_guess_declaration_specifiers external_storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2468 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2469 | external_guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2470 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2471 | external_guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2472 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2473 | external_guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2474 | class_specifier { $$ = MkList(); ListAdd($$, $1); }
2475 | external_guess_declaration_specifiers class_specifier { $$ = $1; ListAdd($1, $2); }
2478 external_guess_declaration_specifiers_error:
2479 class_specifier_error { $$ = MkList(); ListAdd($$, $1); }
2480 | external_guess_declaration_specifiers class_specifier_error { $$ = $1; ListAdd($1, $2); }
2483 _inheritance_specifiers:
2484 PRIVATE { $$ = MkList(); ListAdd($$, MkSpecifier(PRIVATE)); }
2485 | PUBLIC { $$ = MkList(); ListAdd($$, MkSpecifier(PUBLIC)); }
2486 | storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2487 | _inheritance_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2488 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2489 | _inheritance_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2490 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2491 | _inheritance_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2493 { _DeclClass(0, $1.string); $$ = MkListOne(MkSpecifierName($1.string)); FreeIdentifier($1); }
2494 | _inheritance_specifiers identifier { $$ = $1; _DeclClass(0, $2.string); ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2); }
2496 | identifier '<' template_arguments_list '>'
2498 // if($1._class && !$1._class.name)
2502 strcpy(name, $1._class.name ? $1._class.name : "");
2504 strcat(name, $1.string);
2505 _DeclClass(0, name);
2508 _DeclClass(0, $1.string);
2511 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2514 | _inheritance_specifiers identifier '<' template_arguments_list '>'
2517 if($2._class && !$2._class.name)
2521 strcat(name, $2.string);
2522 _DeclClass(0, name);
2525 _DeclClass(0, $2.string);
2526 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2531 inheritance_specifiers:
2532 _inheritance_specifiers
2533 | struct_or_union { $$ = MkListOne(MkStructOrUnion($1, null, null)); POP_DEFAULT_ACCESS }
2536 property_specifiers:
2537 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2538 | property_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2539 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2540 | property_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2541 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2542 | property_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2543 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2544 | property_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2545 | identifier '<' template_arguments_list '>'
2547 // if($1._class && !$1._class.name)
2551 strcpy(name, $1._class.name ? $1._class.name : "");
2553 strcat(name, $1.string);
2554 _DeclClass(0, name);
2557 _DeclClass(0, $1.string);
2560 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2563 | property_specifiers identifier '<' template_arguments_list '>'
2565 if($2._class && !$2._class.name)
2569 strcat(name, $2.string);
2570 _DeclClass(0, name);
2573 _DeclClass(0, $2.string);
2574 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2580 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2581 | renew_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2582 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2583 | renew_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2584 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2585 | renew_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2586 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2587 | renew_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2588 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2589 | renew_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2590 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2591 | renew_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2592 | identifier '<' template_arguments_list '>'
2594 // if($1._class && !$1._class.name)
2598 strcpy(name, $1._class.name ? $1._class.name : "");
2600 strcat(name, $1.string);
2601 _DeclClass(0, name);
2604 _DeclClass(0, $1.string);
2607 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2610 | renew_specifiers identifier '<' template_arguments_list '>'
2612 if($2._class && !$2._class.name)
2616 strcat(name, $2.string);
2617 _DeclClass(0, name);
2620 _DeclClass(0, $2.string);
2621 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2627 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2628 | new_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2629 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2630 | new_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2631 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2632 | new_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2633 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2634 | new_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2635 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2636 | new_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2637 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2638 | new_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2639 | identifier '<' template_arguments_list '>'
2641 // if($1._class && !$1._class.name)
2645 strcpy(name, $1._class.name ? $1._class.name : "");
2647 strcat(name, $1.string);
2648 _DeclClass(0, name);
2651 _DeclClass(0, $1.string);
2654 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2657 | new_specifiers identifier '<' template_arguments_list '>'
2659 if($2._class && !$2._class.name)
2663 strcat(name, $2.string);
2664 _DeclClass(0, name);
2667 _DeclClass(0, $2.string);
2668 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2673 identifier_list_error:
2674 identifier_list ',' error { $$ = $1; ListAdd($1, null); }
2675 | identifier_list_error ',' error { $$ = $1; ListAdd($1, null); }
2679 identifier { $$ = MkList(); ListAdd($$, MkTypeName(null, MkDeclaratorIdentifier($1))); }
2680 | identifier_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2681 | identifier_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2682 | parameter_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2683 | parameter_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2690 $$ = MkDeclaratorIdentifier(MkIdentifier($1.name));
2695 direct_declarator_nofunction_type_ok:
2696 direct_declarator_nofunction
2699 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2700 String s = colon ? colon + 2 : $1.name;
2702 $$ = MkDeclaratorIdentifier(MkIdentifier(s));
2704 | UINT { $$ = MkDeclaratorIdentifier(MkIdentifier("uint")); }
2705 | base_strict_type '[' constant_expression ']'
2708 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2709 String s = colon ? colon + 2 : $1.name;
2710 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2712 $$ = MkDeclaratorArray(decl, $3);
2714 | base_strict_type '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2715 | base_strict_type '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2716 | base_strict_type '[' ']' { $$ = MkDeclaratorArray($1, null); }
2718 | direct_declarator_nofunction_type_ok '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2719 | direct_declarator_nofunction_type_ok '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2720 | direct_declarator_nofunction_type_ok '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2721 | direct_declarator_nofunction_type_ok '[' ']' { $$ = MkDeclaratorArray($1, null); }
2724 direct_declarator_nofunction:
2725 identifier { $$ = MkDeclaratorIdentifier($1); }
2726 | '(' declarator ')' { $$ = MkDeclaratorBrackets($2); }
2727 | '(' ext_decl declarator ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2728 | '(' declarator_type_ok ')' { $$ = MkDeclaratorBrackets($2); }
2729 | '(' ext_decl declarator_type_ok ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2730 | direct_declarator_nofunction '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2731 | direct_declarator_nofunction '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2732 | direct_declarator_nofunction '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2733 | direct_declarator_nofunction '[' ']' { $$ = MkDeclaratorArray($1, null); }
2736 direct_declarator_function_start:
2737 direct_declarator_nofunction '('
2740 direct_declarator_function:
2741 direct_declarator_function_start parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2742 | direct_declarator_function_start parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2743 | direct_declarator_function_start identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2744 | direct_declarator_function_start identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2745 | direct_declarator_function_start ')' { $$ = MkDeclaratorFunction($1, null); }
2748 // Tricky stuff here for overriding...
2749 direct_declarator_function_error:
2750 direct_declarator_function_start identifier_list_error
2752 $$ = MkDeclaratorFunction($1, $2);
2753 fileInput.Seek(@1.end.pos, start);
2755 resetScannerPos(&@1.end);
2756 @$.start = @1.start;
2759 | direct_declarator_function_start error
2761 $$ = MkDeclaratorFunction($1, null);
2762 fileInput.Seek(@1.end.pos, start);
2764 resetScannerPos(&@1.end);
2765 @$.start = @1.start;
2768 | direct_declarator_function_start parameter_list '('
2770 $$ = MkDeclaratorFunction($1, $2);
2771 fileInput.Seek(@1.end.pos, start);
2773 resetScannerPos(&@1.end);
2774 @$.start = @1.start;
2777 | direct_declarator_function_start guess_declaration_specifiers identifier '('
2779 $$ = MkDeclaratorFunction($1, null);
2780 fileInput.Seek(@1.end.pos, start);
2782 resetScannerPos(&@1.end);
2783 @$.start = @1.start;
2785 FreeList($2, FreeSpecifier);
2791 direct_declarator_function
2792 | direct_declarator_nofunction
2794 | ext_decl direct_declarator_function
2795 { $$ = MkDeclaratorExtended($1, $2); }
2796 | ext_decl direct_declarator_nofunction
2797 { $$ = MkDeclaratorExtended($1, $2); }
2802 direct_declarator_function_start_type_ok:
2803 direct_declarator_nofunction_type_ok '('
2806 direct_declarator_function_type_ok:
2807 direct_declarator_function_start_type_ok parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2808 | direct_declarator_function_start_type_ok parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2809 | direct_declarator_function_start_type_ok identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2810 | direct_declarator_function_start_type_ok identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2811 | direct_declarator_function_start_type_ok ')' { $$ = MkDeclaratorFunction($1, null); }
2814 // Tricky stuff here for overriding...
2815 direct_declarator_function_error_type_ok:
2816 direct_declarator_function_start_type_ok identifier_list_error
2818 $$ = MkDeclaratorFunction($1, $2);
2819 fileInput.Seek(@1.end.pos, start);
2821 resetScannerPos(&@1.end);
2822 @$.start = @1.start;
2825 | direct_declarator_function_start_type_ok error
2827 $$ = MkDeclaratorFunction($1, null);
2828 fileInput.Seek(@1.end.pos, start);
2830 resetScannerPos(&@1.end);
2831 @$.start = @1.start;
2834 | direct_declarator_function_start_type_ok parameter_list '('
2836 $$ = MkDeclaratorFunction($1, $2);
2837 fileInput.Seek(@1.end.pos, start);
2839 resetScannerPos(&@1.end);
2840 @$.start = @1.start;
2843 | direct_declarator_function_start_type_ok guess_declaration_specifiers identifier '('
2845 $$ = MkDeclaratorFunction($1, null);
2846 fileInput.Seek(@1.end.pos, start);
2848 resetScannerPos(&@1.end);
2849 @$.start = @1.start;
2851 FreeList($2, FreeSpecifier);
2856 direct_declarator_type_ok:
2857 direct_declarator_function_type_ok
2858 | direct_declarator_nofunction_type_ok
2860 | ext_decl direct_declarator_function_type_ok
2861 { $$ = MkDeclaratorExtended($1, $2); }
2862 | ext_decl direct_declarator_nofunction_type_ok
2863 { $$ = MkDeclaratorExtended($1, $2); }
2868 ASM '(' STRING_LITERAL { $<string>$ = CopyString(yytext); } STRING_LITERAL { $<string>$ = CopyString(yytext); }
2871 strcpy(temp, "__asm__(");
2872 strcat(temp, $<string>4);
2874 strcat(temp, $<string>6);
2877 $<string>$ = CopyString(temp);
2882 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2883 | attrib { $$ = MkExtDeclAttrib($1);
2887 strcpy(temp, $<string>1);
2890 $$ = MkExtDeclString(CopyString(temp));
2892 | asm_start STRING_LITERAL { $$ = CopyString(yytext); } ')'
2895 strcpy(temp, $<string>1);
2897 strcat(temp, $<string>3);
2901 $$ = MkExtDeclString(CopyString(temp));
2907 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2908 | attrib { $$ = MkExtDeclAttrib($1); }
2909 | ASM '(' string_literal ')'
2912 strcpy(temp, "__asm__(");
2915 $$ = MkExtDeclString(CopyString(temp));
2921 ATTRIB { $<i>$ = ATTRIB; }
2922 | ATTRIB_DEP { $<i>$ = ATTRIB_DEP; }
2923 | __ATTRIB { $<i>$ = __ATTRIB; }
2928 IDENTIFIER { $$ = CopyString(yytext); }
2929 | TYPE_NAME { $$ = CopyString(yytext); }
2930 | EXT_STORAGE { $$ = CopyString(yytext); }
2931 | EXT_DECL { $$ = CopyString(yytext); }
2932 | CONST { $$ = CopyString(yytext); }
2936 attribute_word { $$ = MkAttribute($1, null); $$.loc = @$; }
2937 | attribute_word '(' expression ')' { $$ = MkAttribute($1, MkExpBrackets($3)); $$.loc = @$; }
2941 attribute { $$ = MkListOne($1); }
2942 | attribs_list attribute { ListAdd($1, $2); $$ = $1; }
2943 | attribs_list ',' attribute { ListAdd($1, $3); $$ = $1; }
2947 _attrib '(' '(' attribs_list ')' ')' { $$ = MkAttrib($<i>1, $4); $$.loc = @$; }
2948 | _attrib '(' '(' ')' ')' { $$ = MkAttrib($<i>1, null); $$.loc = @$; }
2951 direct_abstract_declarator:
2952 '(' abstract_declarator ')' { $$ = MkDeclaratorBrackets($2); }
2953 | '(' ext_decl abstract_declarator ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2954 | '[' ']' { $$ = MkDeclaratorArray(null, null); }
2955 | '[' constant_expression ']' { $$ = MkDeclaratorArray(null, $2); }
2956 | '[' constant_expression_error ']' { $$ = MkDeclaratorArray(null, $2); }
2957 | '[' type ']' { $$ = MkDeclaratorEnumArray(null, $2); }
2958 | direct_abstract_declarator '[' ']' { $$ = MkDeclaratorArray($1, null); }
2959 | direct_abstract_declarator '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2960 | direct_abstract_declarator '[' type']' { $$ = MkDeclaratorEnumArray($1, $3); }
2961 | direct_abstract_declarator '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2962 | '(' ')' { $$ = MkDeclaratorFunction(null, null); }
2963 | '(' parameter_type_list ')' { $$ = MkDeclaratorFunction(null, $2); }
2964 | '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction(null, $2); }
2965 | direct_abstract_declarator '(' ')' { $$ = MkDeclaratorFunction($1, null); }
2966 | direct_abstract_declarator '(' parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $3); }
2967 | direct_abstract_declarator '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $3); }
2970 direct_abstract_declarator_noarray:
2971 '(' abstract_declarator_noarray ')' { $$ = MkDeclaratorBrackets($2); }
2972 | '(' ext_decl abstract_declarator_noarray ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2973 | '(' ')' { $$ = MkDeclaratorFunction(null, null); }
2974 | '(' parameter_type_list ')' { $$ = MkDeclaratorFunction(null, $2); }
2975 | '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction(null, $2); }
2976 | direct_abstract_declarator_noarray '(' ')' { $$ = MkDeclaratorFunction($1, null); }
2977 | direct_abstract_declarator_noarray '(' parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $3); }
2978 | direct_abstract_declarator_noarray '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $3); }
2982 '*' { $$ = MkPointer(null, null); }
2983 | '*' type_qualifier_list { $$ = MkPointer($2, null); }
2984 | '*' pointer { $$ = MkPointer(null, $2); }
2985 | '*' type_qualifier_list pointer { $$ = MkPointer($2, $3); }
2988 abstract_declarator:
2989 pointer { $$ = MkDeclaratorPointer($1, null); }
2990 | direct_abstract_declarator
2991 | pointer direct_abstract_declarator { $$ = MkDeclaratorPointer($1, $2); }
2992 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
2993 // | ext_decl direct_abstract_declarator { $$ = MkDeclaratorExtended($1, $2); }
2994 | ext_decl pointer direct_abstract_declarator { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2997 abstract_declarator_noarray:
2998 pointer { $$ = MkDeclaratorPointer($1, null); }
2999 | direct_abstract_declarator_noarray
3000 | pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorPointer($1, $2); }
3001 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
3002 // | ext_decl direct_abstract_declarator_noarray { $$ = MkDeclaratorExtended($1, $2); }
3003 | ext_decl pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3008 | pointer direct_declarator
3009 { $$ = MkDeclaratorPointer($1, $2); }
3010 | ext_decl pointer direct_declarator
3011 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3012 | declarator ext_decl
3013 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3014 | declarator_nofunction_type_ok ext_decl
3015 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3019 direct_declarator_type_ok
3020 | pointer direct_declarator_type_ok
3021 { $$ = MkDeclaratorPointer($1, $2); }
3022 | ext_decl pointer direct_declarator_type_ok
3023 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3024 | declarator_type_ok ext_decl
3025 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3028 declarator_function:
3029 direct_declarator_function
3030 | pointer direct_declarator_function { $$ = MkDeclaratorPointer($1, $2); }
3031 // | ext_decl direct_declarator_function { $$ = MkDeclaratorExtended($1, $2); }
3032 | ext_decl pointer direct_declarator_function { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3033 | pointer ext_decl direct_declarator_function { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3036 declarator_function_error:
3037 direct_declarator_function_error
3038 | pointer direct_declarator_function_error { $$ = MkDeclaratorPointer($1, $2); }
3039 // | ext_decl direct_declarator_function_error { $$ = MkDeclaratorExtended($1, $2); }
3040 | ext_decl pointer direct_declarator_function_error { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3041 | pointer ext_decl direct_declarator_function_error { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3045 declarator_nofunction:
3046 direct_declarator_nofunction
3047 | pointer direct_declarator_nofunction { $$ = MkDeclaratorPointer($1, $2); }
3048 // | ext_decl direct_declarator_nofunction { $$ = MkDeclaratorExtended($1, $2); }
3049 | ext_decl pointer direct_declarator_nofunction { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3050 | pointer ext_decl direct_declarator_nofunction { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3054 declarator_function_type_ok:
3055 direct_declarator_function_type_ok
3056 | pointer direct_declarator_function_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3057 // | ext_decl direct_declarator_function_type_ok { $$ = MkDeclaratorExtended($1, $2); }
3058 | ext_decl pointer direct_declarator_function_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3059 | pointer ext_decl direct_declarator_function_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3062 declarator_function_error_type_ok:
3063 direct_declarator_function_error_type_ok
3064 | pointer direct_declarator_function_error_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3065 // | ext_decl direct_declarator_function_error_type_ok { $$ = MkDeclaratorExtended($1, $2); }
3066 | ext_decl pointer direct_declarator_function_error_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3067 | pointer ext_decl direct_declarator_function_error_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3070 declarator_nofunction_type_ok:
3071 direct_declarator_nofunction_type_ok
3072 | pointer direct_declarator_nofunction_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3073 // | ext_decl direct_declarator_nofunction_type_ok { $$ = MkDeclaratorExtended($1, $2); }
3074 | ext_decl pointer direct_declarator_nofunction_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3075 | pointer ext_decl direct_declarator_nofunction_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3079 assignment_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3080 | '{' initializer_list '}' { $$ = MkInitializerList($2); $$.loc = @$; }
3081 | '{' initializer_list ',' '}'
3083 $$ = MkInitializerList($2);
3087 Expression exp = MkExpDummy();
3088 Initializer init = MkInitializerAssignment(exp);
3097 assignment_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3098 | '{' initializer_list '}' error { $$ = MkInitializerList($2); $$.loc = @$; }
3099 | '{' initializer_list { $$ = MkInitializerList($2); $$.loc = @$; }
3100 | '{' initializer_list ',' '}' error
3102 $$ = MkInitializerList($2);
3106 Expression exp = MkExpDummy();
3107 Initializer init = MkInitializerAssignment(exp);
3113 | '{' initializer_list ','
3115 $$ = MkInitializerList($2);
3119 Expression exp = MkExpDummy();
3120 Initializer init = MkInitializerAssignment(exp);
3128 initializer_condition:
3129 conditional_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3130 | anon_instantiation_expression
3131 { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3134 initializer_condition_error:
3135 conditional_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3136 | anon_instantiation_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3140 initializer { $$ = MkList(); ListAdd($$, $1); }
3141 | initializer_error { $$ = MkList(); ListAdd($$, $1); }
3142 | initializer_list ',' initializer { $$ = $1; ListAdd($1, $3); }
3143 | initializer_list ',' initializer_error { $$ = $1; ListAdd($1, $3); }
3146 | initializer_list initializer { $$ = $1; ListAdd($1, $2); }
3147 | initializer_list initializer_error { $$ = $1; ListAdd($1, $2); }
3151 declarator { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3152 | declarator_type_ok { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3153 | declarator '=' initializer { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3156 init_declarator_error:
3157 declarator error { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3158 /* Useless rules due to conflicts
3159 | declarator '=' error { $$ = MkInitDeclarator($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.initializer.loc = @2; $$.initializer.exp.loc = @2; }
3161 | declarator '=' initializer_error { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3164 init_declarator_list:
3165 init_declarator { $$ = MkList(); ListAdd($$, $1); }
3166 | init_declarator_list ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3167 | UINT ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("uint")), null)); ListAdd($$, $3); }
3168 | INT64 ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("int64")), null)); ListAdd($$, $3); }
3169 | base_strict_type ',' init_declarator
3171 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
3172 String s = colon ? colon + 2 : $1.name;
3175 ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(s)), null));
3178 | init_declarator_list_error ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3179 /*| base_strict_type ',' init_declarator
3186 init_declarator_list_error:
3187 init_declarator_error { $$ = MkList(); ListAdd($$, $1); }
3188 | init_declarator error { $$ = MkList(); ListAdd($$, $1); }
3189 | init_declarator_list ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3190 | init_declarator_list_error ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3194 specifier_qualifier_list { $$ = MkTypeName($1, null); }
3195 | specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3199 guess_specifier_qualifier_list { $$ = MkTypeName($1, null); }
3200 | guess_specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3203 /*** PARAMETERS **********************************************************************/
3204 parameter_declaration:
3205 guess_declaration_specifiers declarator_type_ok { $$ = MkTypeName($1, $2); }
3206 | guess_declaration_specifiers abstract_declarator { $$ = MkTypeName($1, $2); }
3207 | guess_declaration_specifiers '&' { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), null)); }
3208 | guess_declaration_specifiers '&' declarator_type_ok { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), $3)); }
3209 | guess_declaration_specifiers { $$ = MkTypeNameGuessDecl($1, null); }
3211 { $$ = MkTypeName(MkListOne(MkSpecifier(CLASS)), null); }
3214 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), null); }
3216 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), null)); }
3217 | TYPED_OBJECT declarator
3218 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), $2); }
3219 | TYPED_OBJECT '&' declarator
3220 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), $3)); }
3222 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), null); }
3223 | ANY_OBJECT declarator
3224 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), $2); }
3228 parameter_declaration_error:
3229 guess_declaration_specifiers declarator_type_ok error { $$ = MkTypeName($1, $2); }
3230 | guess_declaration_specifiers abstract_declarator error { $$ = MkTypeName($1, $2); }
3234 parameter_declaration { $$ = MkList(); ListAdd($$, $1); }
3235 | parameter_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3236 | parameter_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3237 | parameter_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3238 | parameter_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3239 | error ',' parameter_declaration { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3241 | identifier_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3242 | identifier_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3243 | identifier_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3244 | identifier_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3247 parameter_list_error:
3248 parameter_declaration_error { $$ = MkList(); ListAdd($$, $1); }
3249 | parameter_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3250 | parameter_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3251 | parameter_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3252 | error ',' parameter_declaration_error { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3254 | identifier_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3255 | identifier_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3256 | identifier_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3259 parameter_type_list:
3261 | parameter_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3262 | parameter_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3263 | identifier_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3264 | identifier_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3265 | error ',' ELLIPSIS { $$ = MkList(); ListAdd($$, MkTypeName(null, null)); }
3268 parameter_type_list_error:
3269 parameter_list_error
3270 | parameter_list ',' error { $$ = $1; ListAdd($1, null); }
3271 | parameter_list_error error
3274 /****** STATEMENTS *******************************************************************/
3277 | attrib { $$ = MkExpressionStmt(null); FreeAttrib($1); } // Ignoring this for now... ( For __attribute__ ((__unused__)) )
3278 | compound_statement
3279 | ';' { $$ = MkExpressionStmt(null); }
3280 | ':' { $$ = MkExpressionStmt(null); }
3281 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3282 | selection_statement
3283 | iteration_statement
3288 | watch_definition ';'
3292 labeled_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3293 | iteration_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3294 | compound_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3295 | selection_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3296 | jump_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3297 | jump_statement error { $$ = $1; Compiler_Error($"syntax error\n"); }
3298 | expression_error { $$ = MkExpressionStmt($1); Compiler_Error($"syntax error\n"); $$.loc = @1; }
3302 string_literal { $$ = MkAsmField($1, null); $$.loc = @1; }
3303 | string_literal '(' assignment_expression ')' { $$ = MkAsmField($1, $3); $$.loc = @$; }
3307 asm_field { $$ = MkListOne($1); }
3308 | asm_field_list ',' asm_field { ListAdd($$, $3); }
3313 ASM type_qualifier '(' string_literal ')' ';' { $$ = MkAsmStmt($2, $4, null, null, null); $$.loc = @$; }
3314 | ASM type_qualifier '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, null); $$.loc = @$; }
3315 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, null); $$.loc = @$; }
3316 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, $10); $$.loc = @$; }
3318 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, null); $$.loc = @$; }
3319 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, $8); $$.loc = @$; }
3320 | ASM type_qualifier '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, $8); $$.loc = @$; }
3322 | ASM '(' string_literal ')' ';' { $$ = MkAsmStmt(null, $3, null, null, null); $$.loc = @$; }
3323 | ASM '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, null); $$.loc = @$; }
3324 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, null); $$.loc = @$; }
3325 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, $9); $$.loc = @$; }
3327 | ASM '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, null); $$.loc = @$; }
3328 | ASM '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, $7); $$.loc = @$; }
3329 | ASM '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, $7); $$.loc = @$; }
3333 identifier ':' statement { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3334 | CASE constant_expression ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3335 | CASE constant_expression_error ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3336 | CASE ':' statement { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3337 | DEFAULT ':' statement { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3340 labeled_statement_error
3341 : identifier ':' statement_error { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3342 | CASE constant_expression ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3343 | CASE constant_expression_error ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3344 | CASE ':' statement_error { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3345 | CASE ':' { $$ = MkCaseStmt(MkExpDummy(), null); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3346 | DEFAULT ':' statement_error { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3347 | DEFAULT ':' { $$ = MkCaseStmt(null, null); $$.loc = @$; }
3351 PUBLIC { $$ = declMode = publicAccess; }
3352 | PRIVATE { $$ = declMode = privateAccess; }
3353 | DEFAULT { $$ = declMode = defaultAccess; }
3357 PUBLIC { $$ = publicAccess; }
3358 | PRIVATE { $$ = privateAccess; }
3362 declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3363 | declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3364 | instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3365 | declaration_error ';' { $$ = $1; }
3368 external_guess_declaration:
3369 external_guess_declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3370 | external_guess_declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3371 | external_guess_declaration_specifiers_error init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3373 | external_guess_instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3374 | DEFINE identifier '=' conditional_expression ';' { $$ = MkDeclarationDefine($2, $4); $$.loc = @$; }
3375 | STATIC DEFINE identifier '=' conditional_expression ';' { declMode = staticAccess; $$ = MkDeclarationDefine($3, $5); $$.loc = @$; }
3378 external_guess_declaration_error:
3379 external_guess_declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; yyerrok; }
3383 declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; }
3384 | declaration_error error {}
3386 | instantiation_named_error error { $$ = MkDeclarationInst($1); $$.loc = @$; }
3387 | instantiation_named error { $$ = MkDeclarationInst($1); $$.loc = @$; }
3388 | declaration_specifiers init_declarator_list_error { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3392 declaration { $$ = MkList(); ListAdd($$, $1); /*declMode = defaultDeclMode;*/ }
3393 | declaration_list declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3394 | declaration_list_error declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3395 | declaration_list error ';' { $$ = $1; }
3398 declaration_list_error:
3399 declaration_error { $$ = MkList(); ListAdd($$, $1); }
3400 | declaration_list declaration_error { $$ = $1; ListAdd($1, $2); }
3404 statement { $$ = MkList(); ListAdd($$, $1); }
3405 | statement_list statement { $$ = $1; ListAdd($1, $2); }
3406 | statement_list_error statement { $$ = $1; ListAdd($1, $2); }
3409 statement_list_error:
3410 statement_error { $$ = MkList(); ListAdd($$, $1); }
3411 | statement_list statement_error { $$ = $1; ListAdd($1, $2); }
3412 | statement_list_error statement_error { $$ = $1; ListAdd($1, $2); }
3413 | statement_list declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3414 | statement_list_error declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3415 | statement_list declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3416 | statement_list_error declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; yyerror(); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3420 statement_list { $$ = MkCompoundStmt(null, $1); }
3421 | declaration_list { $$ = MkCompoundStmt($1, null); }
3422 | declaration_list statement_list { $$ = MkCompoundStmt($1, $2); }
3423 | declaration_list_error statement_list { $$ = MkCompoundStmt($1, $2); }
3426 compound_inside_error:
3427 statement_list_error { $$ = MkCompoundStmt(null, $1); }
3428 | declaration_list_error { $$ = MkCompoundStmt($1, null); }
3429 | declaration_list statement_list_error { $$ = MkCompoundStmt($1, $2); }
3430 | declaration_list_error statement_list_error { $$ = MkCompoundStmt($1, $2); }
3434 '{' { $<context>$ = PushContext(); }
3438 compound_statement_error '}' { $$ = $1; $$.loc = @$; }
3441 compound_statement_error:
3442 compound_start compound_inside_error
3443 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3445 { $$ = MkCompoundStmt(null, null); $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3447 | compound_start compound_inside
3448 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3452 expression_statement:
3453 ';' { $$ = MkExpressionStmt(null); $$.loc = @$; }
3454 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3455 | expression_error ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3458 selection_statement:
3459 IF '(' expression ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3460 | IF '(' expression_error ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3461 | IF '(' expression ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3462 | IF '(' expression_error ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3463 | SWITCH '(' expression ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3464 | SWITCH '(' expression_error ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3467 selection_statement_error:
3468 IF '(' expression_error { $$ = MkIfStmt($3, null, null); $$.loc = @$; }
3469 | selection_statement error
3472 iteration_statement:
3473 WHILE '(' expression ')' statement { $$ = MkWhileStmt($3, $5); $$.loc = @$; }
3474 | WHILE '(' expression_error statement { $$ = MkWhileStmt($3, $4); $$.loc = @$; }
3475 | WHILE '(' ')' statement { $$ = MkWhileStmt(null, $4); $$.loc = @$; }
3477 | DO statement WHILE '(' expression ')' ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3478 | DO statement WHILE '(' expression_error ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3480 | FOR '(' expression_statement expression_statement ')' statement { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; }
3481 | FOR '(' expression_statement ')' statement { $$ = MkForStmt($3, null, null, $5); $$.loc = @$; }
3482 | FOR '(' expression_statement expression_statement expression ')' statement { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; }
3483 | FOR '(' expression_statement expression_statement expression_error statement { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; }
3484 | FOR '(' ')' statement { $$ = MkForStmt(null, null, null, $4); $$.loc = @$; }
3486 | FOR '(' identifier ':' expression ')' statement { $$ = MkForEachStmt($3, $5, null, $7); $$.loc = @$; }
3487 | FOR '(' identifier ':' expression ';' expression ')' statement { $$ = MkForEachStmt($3, $5, $7, $9); $$.loc = @$; }
3490 iteration_statement_error:
3491 FOR '(' error { $$ = MkForStmt(null, null, null, null); $$.loc = @$; } |
3492 FOR '(' expression_error error { $$ = MkForStmt(MkExpressionStmt($3), null, null, null); $$.forStmt.init.loc = @3; $$.loc = @$; } |
3493 FOR '(' expression_statement error { $$ = MkForStmt($3, null, null, null); $$.loc = @$; } |
3494 FOR '(' expression_statement expression_error error { $$ = MkForStmt($3, MkExpressionStmt($4), null, null); $$.loc = @$; $$.forStmt.check.loc = @4; } |
3495 /* Useless rules due to conflicts
3496 FOR '(' expression_statement expression_statement error { $$ = MkForStmt($3, $4, null, null); $$.loc = @$; } |
3498 FOR '(' expression_statement expression_statement expression_error { $$ = MkForStmt($3, $4, $5, null); $$.loc = @$; } |
3499 FOR '(' expression_statement expression_statement ')' statement_error { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; } |
3500 FOR '(' expression_statement expression_statement expression ')' statement_error { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; } |
3501 FOR '(' expression_statement expression_statement expression_error statement_error { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; } |
3503 DO statement WHILE '(' expression ')' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3504 DO statement WHILE '(' expression { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3505 DO statement WHILE '(' expression_error { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3506 DO statement WHILE '(' { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3507 DO statement WHILE { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3508 DO statement { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3509 DO { $$ = MkDoWhileStmt(null, null); $$.loc = @$; } |
3512 WHILE error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3513 /* Useless rules due to conflicts
3514 WHILE '(' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3516 WHILE '(' ')' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3517 WHILE '(' expression_error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3518 /* Useless rules due to conflicts
3519 WHILE '(' expression_error error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3521 WHILE '(' expression ')' statement_error { $$ = MkWhileStmt($3, $5); $$.loc = @$; } |
3522 WHILE '(' expression_error statement_error { $$ = MkWhileStmt($3, $4 ); $$.loc = @$; }
3526 GOTO identifier ';' { $$ = MkGotoStmt($2); $$.loc = @$; }
3527 | CONTINUE ';' { $$ = MkContinueStmt(); $$.loc = @$; }
3528 | BREAK ';' { $$ = MkBreakStmt(); $$.loc = @$; }
3529 | RETURN ';' { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc = @2; }
3530 | RETURN expression ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3531 | RETURN expression_error ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3532 | RETURN anon_instantiation_expression ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3533 | RETURN anon_instantiation_expression_error ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3536 jump_statement_error:
3537 RETURN expression_error { $$ = MkReturnStmt($2); $$.loc = @$; } |
3538 RETURN anon_instantiation_expression_error { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; } |
3539 RETURN { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc.start = exp.loc.end = @1.end; } |
3540 GOTO { $$ = MkGotoStmt(null); $$.loc = @$; }
3543 /*************************************************************************************/
3545 function_definition:
3546 external_guess_declaration_specifiers declarator_function declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3547 | external_guess_declaration_specifiers declarator_function compound_statement
3548 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3549 | external_guess_declaration_specifiers declarator_function_type_ok declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3550 | external_guess_declaration_specifiers declarator_function_type_ok compound_statement
3551 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3553 | declarator_function declaration_list compound_statement { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; }
3554 | declarator_function compound_statement { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$;}
3556 function_definition_error:
3557 external_guess_declaration_specifiers declarator_function declaration_list compound_statement_error { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; $$.loc.end = $4.loc.end; }
3558 | external_guess_declaration_specifiers declarator_function compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3559 | external_guess_declaration_specifiers declarator_function_type_ok declaration_list compound_statement_error { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; $$.loc.end = $4.loc.end; }
3560 | external_guess_declaration_specifiers declarator_function_type_ok compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3561 | declarator_function declaration_list compound_statement_error { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3562 | declarator_function compound_statement_error { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
3566 STRING_LITERAL { $$ = CopyString(yytext); }
3567 | string_literal STRING_LITERAL
3569 int len1 = strlen($1);
3570 int len2 = strlen(yytext);
3571 $$ = new byte[len1-1 + len2-1 + 1];
3572 memcpy($$, $1, len1-1);
3573 memcpy($$ + len1-1, yytext+1, len2);
3578 external_declaration:
3579 function_definition { $$ = MkExternalFunction($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3581 { $$ = MkExternalClass($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3583 | external_guess_declaration_specifiers class
3584 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; FreeList($1, FreeSpecifier); }
3586 | external_guess_declaration
3587 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3588 | IMPORT string_literal { $$ = MkExternalImport($2, normalImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3589 | IMPORT STATIC string_literal { $$ = MkExternalImport($3, staticImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3590 | IMPORT identifier string_literal
3592 bool isRemote = !strcmp($2.string, "remote");
3593 $$ = MkExternalImport($3, isRemote ? remoteImport : normalImport, (declMode != defaultAccess) ? declMode : privateAccess);
3600 | ';' { $$ = null; }
3602 | declaration_mode function_definition { $$ = MkExternalFunction($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3603 | declaration_mode class
3604 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; declMode = defaultDeclMode; }
3605 | declaration_mode external_guess_declaration { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3606 | declaration_mode IMPORT string_literal { $$ = MkExternalImport($3, normalImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; declMode = defaultDeclMode; }
3607 | declaration_mode IMPORT STATIC string_literal { $$ = MkExternalImport($4, staticImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; declMode = defaultDeclMode; }
3608 | declaration_mode IMPORT identifier string_literal
3610 bool isRemote = !strcmp($3.string, "remote");
3611 $$ = MkExternalImport($4, isRemote ? remoteImport : normalImport, ($1 != defaultAccess) ? $1 : privateAccess);
3614 declMode = defaultDeclMode;
3618 | declaration_mode ':' { defaultDeclMode = $1; $$ = null; }
3619 | STATIC ':' { defaultDeclMode = staticAccess; $$ = null; }
3620 | NAMESPACE identifier { $$ = MkExternalNameSpace($2); $$.loc = @$; }
3621 | NAMESPACE strict_type { $$ = MkExternalNameSpace(MkIdentifier($2.name)); FreeSpecifier($2); $$.loc = @$; }
3622 | dbtable_definition { $$ = MkExternalDBTable($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3623 | declaration_mode dbtable_definition { $$ = MkExternalDBTable($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3626 external_declaration_error:
3627 class_error { $$ = MkExternalClass($1); $$.loc = $1.loc; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3628 | external_guess_declaration_specifiers class_error
3630 FreeList($1, FreeSpecifier);
3631 $$ = MkExternalClass($2);
3633 $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess;
3634 declMode = defaultDeclMode;
3636 | function_definition_error { $$ = MkExternalFunction($1); $$.loc = $1.loc; $1.declMode = declMode; declMode = defaultDeclMode; }
3638 | declaration_mode class_error { $$ = MkExternalClass($2); $$.loc = $2.loc; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; declMode = defaultDeclMode; }
3639 | declaration_mode function_definition_error { $$ = MkExternalFunction($2); $$.loc = $2.loc; $2.declMode = $1; declMode = defaultDeclMode; }
3641 | external_guess_declaration_error
3642 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; declMode = defaultDeclMode; }
3643 | declaration_mode external_guess_declaration_error { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; declMode = defaultDeclMode; }
3646 translation_unit_error:
3647 external_declaration_error { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3648 | translation_unit external_declaration_error { $$ = $1; ListAdd($1, $2); }
3649 | translation_unit_error external_declaration_error { $$ = $1; ListAdd($1, $2); }
3650 | translation_unit error
3651 | translation_unit_error error
3655 external_declaration { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3656 | translation_unit external_declaration { $$ = $1; ListAdd($1, $2); }
3657 | translation_unit_error class
3658 { External _class = MkExternalClass($2); $$ = $1; ListAdd($1, _class); _class.loc = @2; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; declMode = defaultDeclMode; }
3659 | translation_unit_error declaration_mode class
3660 { External _class = MkExternalClass($3); $$ = $1; ListAdd($1, _class); _class.loc = @3; $3.declMode = ($2 != defaultAccess) ? $2 : privateAccess; declMode = defaultDeclMode; }
3665 | translation_unit_error
3666 | { ast = MkList(); }
3670 DBTABLE string_literal identifier '{' dbfield_definition_list '}' { Symbol symbol = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3671 | DBTABLE string_literal strict_type '{' dbfield_definition_list '}' { Symbol symbol = DeclClass(globalContext.nextID++, $3.name); FreeSpecifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3672 | DBTABLE string_literal '{' dbfield_definition_list '}' { $$ = MkDBTableDef($2, null, $4); }
3676 guess_declaration_specifiers identifier string_literal ';' { $$ = MkDBFieldEntry(MkTypeName($1, null), $2, $3); }
3680 identifier { $$ = MkDBIndexItem($1, ascending); }
3681 | '>' identifier { $$ = MkDBIndexItem($2, descending); }
3682 | '<' identifier { $$ = MkDBIndexItem($2, ascending); }
3686 dbindex_item { $$ = MkList(); ListAdd($$, $1); }
3687 | dbindex_item_list ',' dbindex_item { ListAdd($1, $3); }
3691 DBINDEX dbindex_item_list ';' { $$ = MkDBIndexEntry($2, null); }
3692 | DBINDEX dbindex_item_list identifier ';' { $$ = MkDBIndexEntry($2, $3); }
3695 dbfield_definition_list:
3696 dbfield_entry { $$ = MkList(); ListAdd($$, $1); }
3697 | dbindex_entry { $$ = MkList(); ListAdd($$, $1); }
3698 | dbfield_definition_list dbfield_entry { ListAdd($1, $2); }
3699 | dbfield_definition_list dbindex_entry { ListAdd($1, $2); }
3703 DATABASE_OPEN '(' assignment_expression ',' assignment_expression ')' { $$ = MkExpDBOpen($3, $5); }
3707 DBFIELD '(' string_literal ',' identifier ')' { $$ = MkExpDBField($3, $5); }
3711 DBINDEX '(' string_literal ',' identifier ')' { $$ = MkExpDBIndex($3, $5); }
3715 DBTABLE '(' string_literal ')' { $$ = MkExpDBTable($3); }