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--;
28 #define C89_DECL_WARNING $"eC expects all declarations to precede statements in the block (C89 style)\n"
29 #define CASE_LABELED_STMT_WARNING $"labeled statement directly within a case statement\n"
39 SpecifierType specifierType;
46 Enumerator enumerator;
47 Declarator declarator;
49 Initializer initializer;
50 InitDeclarator initDeclarator;
52 Declaration declaration;
54 FunctionDefinition function;
62 Instantiation instance;
63 MembersInit membersInit;
64 MemberInit memberInit;
65 ClassFunction classFunction;
66 ClassDefinition _class;
71 PropertyWatch propertyWatch;
72 TemplateParameter templateParameter;
73 TemplateArgument templateArgument;
74 TemplateDatatype templateDatatype;
76 DBTableEntry dbtableEntry;
77 DBIndexItem dbindexItem;
78 DBTableDef dbtableDef;
83 %type <symbol> class_decl
84 %type <specifierType> struct_or_union
85 %type <i> unary_operator assignment_operator
86 %type <declMode> member_access declaration_mode
87 %type <id> identifier enum_decl
88 %type <exp> primary_expression primary_expression_error postfix_expression unary_expression cast_expression
89 multiplicative_expression additive_expression shift_expression
90 relational_expression relational_expression_smaller_than equality_expression and_expression
91 exclusive_or_expression inclusive_or_expression logical_and_expression
92 logical_or_expression conditional_expression assignment_expression
93 constant_expression constant_expression_error
94 anon_instantiation_expression anon_instantiation_expression_error i18n_string
95 postfix_expression_error unary_expression_error cast_expression_error
96 multiplicative_expression_error additive_expression_error shift_expression_error
97 relational_expression_error equality_expression_error and_expression_error
98 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
99 logical_or_expression_error conditional_expression_error assignment_expression_error
100 simple_primary_expression constant
101 common_unary_expression common_unary_expression_error
102 database_open dbfield dbindex dbtable
104 //simple_unary_expression simple_unary_expression_error
105 // simple_postfix_expression simple_postfix_expression_error
107 %type <list> argument_expression_list expression expression_anon_inst expression_anon_inst_error enumerator_list type_qualifier_list
108 struct_declarator_list struct_declaration_list
109 declaration_specifiers identifier_list identifier_list_error initializer_list init_declarator_list
110 parameter_list parameter_list_error parameter_type_list parameter_type_list_error declaration_list declaration_list_error statement_list statement_list_error
111 translation_unit members_initialization_list members_initialization_list_coloned members_initialization_list_error data_member_initialization_list data_member_initialization_list_coloned
112 default_property_list data_member_initialization_list_error
113 expression_error init_declarator_list_error argument_expression_list_error default_property_list_error struct_declaration_list_error
114 translation_unit_error
115 guess_declaration_specifiers
116 external_guess_declaration_specifiers external_guess_declaration_specifiers_error
117 specifier_qualifier_list guess_specifier_qualifier_list
118 _inheritance_specifiers inheritance_specifiers property_specifiers
119 new_specifiers renew_specifiers asm_field_list
120 property_watch_list watch_property_list
121 dbindex_item_list dbfield_definition_list
122 template_arguments_list template_parameters_list attribs_list
124 %type <asmField> asm_field
125 %type <specifier> storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier class_specifier class_specifier_error
126 struct_or_union_specifier_compound struct_or_union_specifier_nocompound ext_storage type strict_type guess_type enum_class strict_type_specifier struct_class
127 struct_or_union_specifier_compound_error struct_class_error struct_decl
128 enum_specifier_compound_error enum_class_error external_storage_class_specifier
129 base_strict_type struct_head struct_entry
130 %type <enumerator> enumerator
131 %type <declarator> declarator direct_declarator direct_abstract_declarator abstract_declarator
132 direct_abstract_declarator_noarray abstract_declarator_noarray
133 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction
134 direct_declarator_function_type_ok declarator_nofunction_type_ok direct_declarator_nofunction_type_ok declarator_function_type_ok direct_declarator_function_error_type_ok
135 direct_declarator_function_start_type_ok direct_declarator_type_ok declarator_type_ok declarator_function_error_type_ok
136 %type <pointer> pointer
137 %type <initializer> initializer initializer_error initializer_condition initializer_condition_error
138 %type <initDeclarator> init_declarator init_declarator_error
139 %type <typeName> type_name guess_type_name parameter_declaration parameter_declaration_error
140 %type <stmt> statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
141 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
142 iteration_statement_error statement_error asm_statement
143 stopwatching watch_definition firewatchers
145 %type <declaration> declaration declaration_error external_guess_declaration external_guess_declaration_error
146 %type <function> function_definition function_definition_error
147 %type <external> external_declaration external_declaration_error
149 %type <instance> instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error guess_instantiation_named guess_instantiation_named_error external_guess_instantiation_named
150 instantiation_anon instantiation_anon_error
151 %type <memberInit> data_member_initialization data_member_initialization_error default_property default_property_error
152 %type <classFunction> class_function_definition class_function_definition_error class_function_definition_start
153 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
154 constructor_function_definition_start destructor_function_definition_start
155 %type <classFunction> instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
156 %type <_class> class class_error class_head
157 %type <classDef> struct_declaration struct_declaration_error
158 %type <string> string_literal base_strict_type_name attribute_word
159 %type <extDecl> ext_decl
160 %type <attrib> attrib
161 %type <attribute> attribute
162 %type <prop> property property_start property_body class_property class_property_start class_property_body
163 %type <propertyWatch> property_watch self_watch_definition
165 %type <templateParameter> template_parameter template_type_parameter template_identifier_parameter template_expression_parameter
166 %type <templateArgument> template_argument template_type_argument template_identifier_argument template_expression_argument
167 %type <templateDatatype> template_datatype
169 %type <dbtableEntry> dbindex_entry dbfield_entry
170 %type <dbindexItem> dbindex_item
171 %type <dbtableDef> dbtable_definition
172 %type <context> compound_start class_entry
174 %token IDENTIFIER CONSTANT STRING_LITERAL SIZEOF
175 %token PTR_OP INC_OP DEC_OP LEFT_OP RIGHT_OP LE_OP GE_OP EQ_OP NE_OP
176 %token AND_OP OR_OP MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN
177 %token SUB_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN
178 %token XOR_ASSIGN OR_ASSIGN TYPE_NAME
180 %token TYPEDEF EXTERN STATIC AUTO REGISTER
181 %token CHAR SHORT INT UINT INT64 LONG SIGNED UNSIGNED FLOAT DOUBLE CONST VOLATILE VOID VALIST
182 %token STRUCT UNION ENUM ELLIPSIS
184 %token CASE DEFAULT IF SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN
188 %token CLASS THISCLASS CLASS_NAME
189 %token PROPERTY SETPROP GETPROP NEWOP RENEW DELETE EXT_DECL EXT_STORAGE IMPORT DEFINE VIRTUAL ATTRIB
190 %token PUBLIC PRIVATE
191 %token TYPED_OBJECT ANY_OBJECT _INCREF EXTENSION ASM TYPEOF
192 %token WATCH STOPWATCHING FIREWATCHERS WATCHABLE CLASS_DESIGNER CLASS_NO_EXPANSION CLASS_FIXED ISPROPSET
193 %token CLASS_DEFAULT_PROPERTY PROPERTY_CATEGORY CLASS_DATA CLASS_PROPERTY SUBCLASS NAMESPACE
194 %token NEW0OP RENEW0 VAARG
195 %token DBTABLE DBFIELD DBINDEX DATABASE_OPEN
196 %token ALIGNOF ATTRIB_DEP __ATTRIB
197 %token BOOL _BOOL _COMPLEX _IMAGINARY RESTRICT THREAD
198 %token WIDE_STRING_LITERAL
200 %destructor { FreeIdentifier($$); } identifier
201 %destructor { FreePointer($$); } pointer
202 %destructor { FreeExpression($$); } primary_expression primary_expression_error postfix_expression unary_expression cast_expression
203 multiplicative_expression additive_expression shift_expression
204 relational_expression equality_expression and_expression
205 exclusive_or_expression inclusive_or_expression logical_and_expression
206 logical_or_expression conditional_expression assignment_expression
207 constant_expression constant_expression_error
208 postfix_expression_error unary_expression_error cast_expression_error
209 multiplicative_expression_error additive_expression_error shift_expression_error
210 relational_expression_error equality_expression_error and_expression_error
211 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
212 logical_or_expression_error conditional_expression_error assignment_expression_error i18n_string
213 %destructor { FreeSpecifier($$); } storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier class_specifier class_specifier_error
214 struct_or_union_specifier_compound struct_or_union_specifier_nocompound ext_storage type strict_type guess_type enum_class strict_type_specifier struct_class
215 struct_or_union_specifier_compound_error struct_class_error struct_decl
216 enum_specifier_compound_error enum_class_error external_storage_class_specifier
217 base_strict_type struct_head struct_entry
218 %destructor { FreeEnumerator($$); } enumerator
219 %destructor { FreeDeclarator($$); } declarator direct_declarator direct_abstract_declarator abstract_declarator
220 direct_abstract_declarator_noarray abstract_declarator_noarray
221 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction
222 direct_declarator_function_type_ok declarator_nofunction_type_ok direct_declarator_nofunction_type_ok declarator_function_type_ok direct_declarator_function_error_type_ok
223 direct_declarator_function_start_type_ok direct_declarator_type_ok declarator_type_ok declarator_function_error_type_ok
225 %destructor { FreeInitializer($$); } initializer initializer_error initializer_condition initializer_condition_error
226 %destructor { FreeInitDeclarator($$); } init_declarator init_declarator_error
227 %destructor { FreeTypeName($$); } type_name guess_type_name parameter_declaration parameter_declaration_error
228 %destructor { FreeStatement($$); } statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
229 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
230 iteration_statement_error statement_error
232 %destructor { FreeDeclaration($$); } declaration
233 %destructor { FreeFunction($$); } function_definition function_definition_error
234 %destructor { FreeExternal($$); } external_declaration external_declaration_error
236 %destructor { FreeInstance($$); } instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error
238 %destructor { FreeMemberInit($$); } data_member_initialization data_member_initialization_error default_property default_property_error
240 %destructor { FreeClassFunction($$); } class_function_definition class_function_definition_error class_function_definition_start
241 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
242 constructor_function_definition_start destructor_function_definition_start
243 instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
244 %destructor { Context ctx = curContext; PopContext(ctx); FreeContext(ctx); delete ctx; } class_entry
245 %destructor { Context ctx = curContext; PopContext(ctx); FreeContext(ctx); delete ctx; } class_decl
246 %destructor { FreeClass($$); } class class_error class_head
247 %destructor { FreeClassDef($$); } struct_declaration struct_declaration_error
248 %destructor { delete $$; } string_literal attribute_word base_strict_type_name
249 %destructor { FreeProperty($$); } property
251 %destructor { FreeList($$, FreeExpression); } argument_expression_list expression expression_error argument_expression_list_error
252 %destructor { FreeList($$, FreeEnumerator); } enumerator_list
253 %destructor { FreeList($$, FreeSpecifier); } type_qualifier_list specifier_qualifier_list declaration_specifiers inheritance_specifiers _inheritance_specifiers external_guess_declaration_specifiers external_guess_declaration_specifiers_error
254 guess_declaration_specifiers guess_specifier_qualifier_list
255 %destructor { FreeList($$, FreeDeclarator); } struct_declarator_list
256 %destructor { FreeList($$, FreeDeclaration); } declaration_list declaration_list_error
257 %destructor { FreeList($$, FreeInitializer); } initializer_list
258 %destructor { FreeList($$, FreeInitDeclarator); } init_declarator_list init_declarator_list_error
259 %destructor { FreeList($$, FreeTypeName); } parameter_list parameter_list_error parameter_type_list parameter_type_list_error identifier_list identifier_list_error
260 %destructor { FreeList($$, FreeStatement); } statement_list statement_list_error
261 %destructor { if($$ != ast) FreeList($$, FreeExternal); } translation_unit translation_unit_error
262 %destructor { FreeList($$, FreeClassDef); } struct_declaration_list struct_declaration_list_error
263 %destructor { FreeList($$, FreeMemberInit); } default_property_list default_property_list_error data_member_initialization_list data_member_initialization_list_coloned data_member_initialization_list_error
264 %destructor { FreeList($$, FreeMembersInit); } members_initialization_list members_initialization_list_coloned members_initialization_list_error
265 %destructor { PopContext($$); FreeContext($$); delete $$; } compound_start
266 %destructor { FreeTemplateParameter($$); } template_parameter template_type_parameter template_identifier_parameter template_expression_parameter
267 %destructor { FreeTemplateArgument($$); } template_argument template_type_argument template_identifier_argument template_expression_argument
268 %destructor { FreeTemplateDataType($$); } template_datatype
269 %destructor { FreeList($$, FreeTemplateParameter); } template_parameters_list
270 %destructor { FreeList($$, FreeTemplateArgument); } template_arguments_list
271 %destructor { } declaration_mode
272 %destructor { FreeAttrib($$); } attrib
273 %destructor { FreeExtDecl($$); } ext_decl
274 %destructor { FreeAttribute($$); } attribute
275 %destructor { FreeList($$, FreeAttribute); } attribs_list
285 _DeclClass($1._class, $1.string);
289 fileInput.Seek(@1.start.pos, start);
290 resetScannerPos(&@1.start);
295 YY_STACK_PRINT (yyss, yyssp);
298 YY_STACK_PRINT (yyss, yyssp);
305 _DeclClass($1._class, $1.string);
309 fileInput.Seek(@1.start.pos, start);
310 resetScannerPos(&@1.start);
315 YY_STACK_PRINT (yyss, yyssp);
318 YY_STACK_PRINT (yyss, yyssp);
322 /* | identifier '*' '<' template_arguments_list '>'
324 _DeclClass($1._class, $1.string);
325 fileInput.Seek(@1.start.pos, start);
326 resetScannerPos(&@1.start);
331 YY_STACK_PRINT (yyss, yyssp);
334 YY_STACK_PRINT (yyss, yyssp);
340 strict_type { $$ = $1; }
341 | identifier identifier
346 $$ = MkSpecifierName($1.string);
352 _DeclClass($1._class, $1.string);
357 fileInput.Seek(@1.start.pos, start);
358 resetScannerPos(&@1.start);
363 YY_STACK_PRINT (yyss, yyssp);
366 YY_STACK_PRINT (yyss, yyssp);
369 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
370 Compiler_Error($"Not a type: %s\n", $1.string);
371 yylloc = tmpLoc; $2.badID = $1;
379 _DeclClass($1._class, $1.string);
380 fileInput.Seek(@1.start.pos, start);
381 resetScannerPos(&@1.start);
386 YY_STACK_PRINT (yyss, yyssp);
389 YY_STACK_PRINT (yyss, yyssp);
393 /* | strict_type '<' template_arguments_list '>' { $$ = $1; }
394 | identifier identifier '<' template_arguments_list '>'
397 _DeclClass($1._class, $1.string);
401 fileInput.Seek(@1.start.pos, start);
402 resetScannerPos(&@1.start);
407 YY_STACK_PRINT (yyss, yyssp);
410 YY_STACK_PRINT (yyss, yyssp);
413 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
414 Compiler_Error($"Not a type: %s\n", $1.string);
415 yylloc = tmpLoc; $2.badID = $1;
421 TYPE_NAME { $$ = MkSpecifierName(yytext); }
424 base_strict_type_name:
425 TYPE_NAME { $$ = CopyString(yytext); }
429 | base_strict_type '<' template_arguments_list '>' { $$ = $1; SetClassTemplateArgs($$, $3); $$.loc = @$; }
430 | base_strict_type '<' template_arguments_list RIGHT_OP
433 SetClassTemplateArgs($$, $3);
437 fileInput.Seek(@4.end.pos, start);
438 resetScannerPos(&@4.end);
442 /* | identifier '<' template_arguments_list '>' */
443 /*| identifier '<' error
445 _DeclClass($1._class, $1.string);
449 fileInput.Seek(@1.start.pos, start);
450 resetScannerPos(&@1.start);
455 YY_STACK_PRINT (yyss, yyssp);
458 YY_STACK_PRINT (yyss, yyssp);
461 YY_STACK_PRINT (yyss, yyssp);
464 /* $$ = MkSpecifierNameArgs($1.string, $3); $$.loc = @$; FreeIdentifier($1); */
468 class_function_definition_start:
469 guess_declaration_specifiers declarator_function_type_ok
470 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; }
471 | declarator_function
472 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; }
475 constructor_function_definition_start:
476 guess_declaration_specifiers '(' ')'
477 { $$ = MkClassFunction($1, null, null, null); $$.isConstructor = true; $$.loc = @$; }
480 destructor_function_definition_start:
481 '~' guess_declaration_specifiers '(' ')'
482 { $$ = MkClassFunction($2, null, null, null); $$.isDestructor = true; $$.loc = @$; }
485 virtual_class_function_definition_start:
486 VIRTUAL guess_declaration_specifiers declarator_function_type_ok
487 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; }
488 | VIRTUAL declarator_function
489 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; }
492 class_function_definition_start_error:
493 guess_declaration_specifiers declarator_function_error_type_ok
494 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; }
495 | declarator_function_error
496 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; }
499 virtual_class_function_definition_start_error:
500 VIRTUAL guess_declaration_specifiers declarator_function_error_type_ok
501 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; }
502 | VIRTUAL declarator_function_error
503 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; }
506 class_function_definition:
507 class_function_definition_start compound_statement
508 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
509 | virtual_class_function_definition_start compound_statement
510 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
511 | virtual_class_function_definition_start ';'
512 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
513 | constructor_function_definition_start compound_statement
514 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
515 | destructor_function_definition_start compound_statement
516 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
519 | class_function_definition_start ';'
520 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
522 // Added this to fix attrib not working after function pointer declarations
523 | class_function_definition_start attrib ';'
527 $1.declarator = MkStructDeclarator($1.declarator, null);
528 $1.declarator.structDecl.attrib = $2;
530 ProcessClassFunctionBody($1, null);
535 class_function_definition_error:
536 class_function_definition_start compound_statement_error
537 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
538 | class_function_definition_start_error
539 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
540 | virtual_class_function_definition_start compound_statement_error
541 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
542 | virtual_class_function_definition_start_error
543 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
544 | virtual_class_function_definition_start_error ';'
545 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
548 // In Instances, return type is required to distinguish from calling the function
549 instance_class_function_definition_start:
550 declaration_specifiers declarator_function_type_ok
551 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; }
552 | declaration_specifiers declarator_nofunction_type_ok
553 { $$ = MkClassFunction($1, null, MkDeclaratorFunction($2, null), null); $$.loc = @$; }
556 instance_class_function_definition_start_error:
557 declaration_specifiers declarator_function_error_type_ok
558 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; }
561 instance_class_function_definition:
562 instance_class_function_definition_start compound_statement
563 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
566 instance_class_function_definition_error:
567 instance_class_function_definition_start compound_statement_error
568 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; $$.loc.end.charPos++; $$.loc.end.pos++;}
569 | instance_class_function_definition_start_error
570 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
571 | instance_class_function_definition_start
572 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
575 data_member_initialization:
576 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
577 | initializer_condition { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
580 data_member_initialization_error:
581 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
582 | postfix_expression '=' error
584 $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy()));
585 $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = $$.initializer.loc.end = @2.end;
587 fileInput.Seek(@2.end.pos, start);
589 resetScannerPos(&@2.end);
593 | initializer_condition_error { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
596 data_member_initialization_list:
597 data_member_initialization { $$ = MkList(); ListAdd($$, $1); }
598 | data_member_initialization_list ',' data_member_initialization
599 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
600 | data_member_initialization_list_error ',' data_member_initialization
601 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
604 data_member_initialization_list_error:
605 data_member_initialization_error { $$ = MkList(); ListAdd($$, $1); }
606 | data_member_initialization_list ',' data_member_initialization_error
607 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
608 | data_member_initialization_list_error ',' data_member_initialization_error
609 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
611 | data_member_initialization_list ',' error
612 { ((MemberInit)$1->last).loc.end = @2.end;
614 Initializer dummy = MkInitializerAssignment(MkExpDummy());
615 MemberInit memberInit = MkMemberInit(null, dummy);
616 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
617 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
618 ListAdd($1, memberInit);
623 data_member_initialization_list_error ',' error
624 { ((MemberInit)$1->last).loc.end = @2.end;
626 Initializer dummy = MkInitializerAssignment(MkExpDummy());
627 MemberInit memberInit = MkMemberInit(null, dummy);
628 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
629 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
630 ListAdd($1, memberInit);
636 Initializer dummy = MkInitializerAssignment(MkExpDummy());
637 MemberInit memberInit = MkMemberInit(null, dummy);
638 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.start;
639 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.start;
642 ListAdd($$, memberInit);
644 dummy = MkInitializerAssignment(MkExpDummy());
645 memberInit = MkMemberInit(null, dummy);
646 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.end;
647 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.end;
648 ListAdd($$, memberInit);
652 data_member_initialization_list_coloned:
653 data_member_initialization_list ';'
654 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; $$ = $1; }
655 | data_member_initialization_list_error ';'
656 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; $$ = $1; }
659 members_initialization_list_coloned:
660 data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($1); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
661 | instance_class_function_definition { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
662 | members_initialization_list_error data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; $$ = $1; }
663 | members_initialization_list_error instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
664 | members_initialization_list_coloned data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; $$ = $1; }
665 | members_initialization_list_coloned instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
666 | members_initialization_list_error ';'
667 | members_initialization_list_coloned ';'
669 MembersInit members = (MembersInit)$$->last;
670 if(members.type == dataMembersInit)
671 members.loc.end = @$.end;
674 MembersInit members = MkMembersInitList(MkList());
675 ListAdd($$, members);
680 | ';' { MembersInit members = MkMembersInitList(MkList()); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
683 members_initialization_list:
684 members_initialization_list_coloned
685 | data_member_initialization_list { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
686 | members_initialization_list_coloned data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
687 | members_initialization_list_error data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
690 members_initialization_list_error:
691 instance_class_function_definition_error { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
692 | members_initialization_list instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
693 | members_initialization_list_error instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
694 | members_initialization_list_coloned instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
695 | members_initialization_list_coloned data_member_initialization_list_error { ListAdd($$, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
696 | data_member_initialization_list_error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
697 | data_member_initialization_list error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @2; }
701 instantiation_named_error '}'
702 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
703 | instantiation_named_error error '}'
704 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
707 instantiation_named_error:
708 declaration_specifiers identifier '{' members_initialization_list_error
709 { $$ = 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++; }
710 | declaration_specifiers identifier '{' members_initialization_list error
711 { $$ = 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++; }
712 | declaration_specifiers identifier '{' members_initialization_list
713 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
714 | declaration_specifiers identifier '{'
715 { $$ = 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++; }
716 | declaration_specifiers identifier '{' error
717 { $$ = 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++; }
722 declaration_specifiers identifier '{' members_initialization_list '}'
723 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
724 | declaration_specifiers identifier '{' members_initialization_list_error '}'
725 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
726 | declaration_specifiers identifier '{' '}'
727 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
730 instantiation_named_error:
731 declaration_specifiers identifier '{' members_initialization_list_error
732 { $$ = 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++; }
733 | declaration_specifiers identifier '{' members_initialization_list error
734 { $$ = 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++; }
735 | declaration_specifiers identifier '{' members_initialization_list
736 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
737 | declaration_specifiers identifier '{'
738 { $$ = 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++; }
739 | declaration_specifiers identifier '{' error
740 { $$ = 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++; }
745 guess_instantiation_named:
746 guess_instantiation_named_error '}'
747 { $$.loc = @$; $$.insideLoc.end = @2.start; }
748 | guess_instantiation_named_error error '}'
749 { $$.loc = @$; $$.insideLoc.end = @2.start; }
752 guess_instantiation_named_error:
753 guess_declaration_specifiers identifier '{' members_initialization_list_error
754 { $$ = 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++; }
755 | guess_declaration_specifiers identifier '{' members_initialization_list error
756 { $$ = 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++; }
757 | guess_declaration_specifiers identifier '{' members_initialization_list
758 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
759 | guess_declaration_specifiers identifier '{'
760 { $$ = 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++; }
761 | guess_declaration_specifiers identifier '{' error
762 { $$ = 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++; }
766 guess_instantiation_named:
767 guess_declaration_specifiers identifier '{' members_initialization_list '}'
768 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
769 | guess_declaration_specifiers identifier '{' members_initialization_list_error '}'
770 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
771 | guess_declaration_specifiers identifier '{' '}'
772 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
775 guess_instantiation_named_error:
776 guess_declaration_specifiers identifier '{' members_initialization_list_error
777 { $$ = 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++; }
778 | guess_declaration_specifiers identifier '{' members_initialization_list error
779 { $$ = 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++; }
780 | guess_declaration_specifiers identifier '{' members_initialization_list
781 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
782 | guess_declaration_specifiers identifier '{'
783 { $$ = 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++; }
784 | guess_declaration_specifiers identifier '{' error
785 { $$ = 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++; }
789 external_guess_instantiation_named:
790 external_guess_declaration_specifiers identifier '{' members_initialization_list '}'
791 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
792 | external_guess_declaration_specifiers identifier '{' members_initialization_list_error '}'
793 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
794 | external_guess_declaration_specifiers identifier '{' '}'
795 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
798 instantiation_unnamed:
799 instantiation_unnamed_error '}'
800 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
801 | instantiation_unnamed_error error '}'
802 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
805 instantiation_unnamed_error:
806 strict_type '{' members_initialization_list
807 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
808 | identifier '{' members_initialization_list
809 { Location tmpLoc = yylloc; yylloc = @1;
810 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; FreeIdentifier($1); }
812 | strict_type '{' members_initialization_list_error
813 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
815 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
816 | strict_type '{' members_initialization_list error
817 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
818 | strict_type '{' error
819 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
823 | identifier '{' members_initialization_list_error
824 { Location tmpLoc = yylloc; yylloc = @1;
825 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); }
827 { Location tmpLoc = yylloc; yylloc = @1;
828 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); }
829 | identifier '{' members_initialization_list error
830 { Location tmpLoc = yylloc; yylloc = @1;
831 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); }
832 | identifier '{' error
833 { Location tmpLoc = yylloc; yylloc = @1;
834 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); }
838 instantiation_unnamed:
839 strict_type '{' members_initialization_list '}'
840 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
841 | strict_type '{' members_initialization_list error '}'
842 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; }
843 | strict_type '{' members_initialization_list_error '}'
844 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
845 | strict_type '{' '}'
846 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start;}
847 | strict_type '{' error '}'
848 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start;}
851 | identifier '{' members_initialization_list '}'
852 { Location tmpLoc = yylloc; yylloc = @1;
853 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
854 | identifier '{' members_initialization_list_error '}'
855 { Location tmpLoc = yylloc; yylloc = @1;
856 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
857 | identifier '{' members_initialization_list error '}'
859 $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; FreeIdentifier($1); }
861 { Location tmpLoc = yylloc; yylloc = @1;
862 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start; FreeIdentifier($1);}
863 | identifier '{' error '}'
864 { Location tmpLoc = yylloc; yylloc = @1;
865 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
869 instantiation_unnamed_error:
870 strict_type '{' members_initialization_list_error
871 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
873 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
874 | strict_type '{' members_initialization_list error
875 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
876 | strict_type '{' error
877 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
881 | identifier '{' members_initialization_list_error
882 { Location tmpLoc = yylloc; yylloc = @1;
883 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); }
885 { Location tmpLoc = yylloc; yylloc = @1;
886 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); }
887 | identifier '{' members_initialization_list error
888 { Location tmpLoc = yylloc; yylloc = @1;
889 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); }
890 | identifier '{' error
891 { Location tmpLoc = yylloc; yylloc = @1;
892 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); }
897 instantiation_anon_error '}'
898 { $$.loc = @$; $$.insideLoc.end = @2.start; }
899 | instantiation_anon_error error '}'
900 { $$.loc = @$; $$.insideLoc.end = @2.start; }
903 instantiation_anon_error:
904 '{' members_initialization_list_error
905 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
906 | '{' members_initialization_list error
907 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
909 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
911 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
912 | '{' members_initialization_list
913 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
918 '{' members_initialization_list '}'
919 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
920 | '{' members_initialization_list error '}'
921 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @4.start; }
922 | '{' members_initialization_list_error '}'
923 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
925 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.start;}
927 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start;}
930 instantiation_anon_error:
931 '{' members_initialization_list_error
932 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
934 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
935 | '{' members_initialization_list error
936 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
938 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
943 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; }
946 default_property_error:
947 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; }
948 | postfix_expression '=' error { $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; $$.initializer.loc.end = @2.end; }
949 | postfix_expression error { $$ = MkMemberInitExp($1, null); $$.loc = @$; $$.realLoc = @$; }
952 default_property_list:
953 default_property { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
954 | default_property_list ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
955 | default_property_list_error ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
958 default_property_list_error:
959 default_property_error { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
960 | default_property_list ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
961 | default_property_list_error ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
962 | default_property_list error
966 PROPERTY property_specifiers identifier '{'
967 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
969 | PROPERTY property_specifiers abstract_declarator identifier '{'
970 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
972 | PROPERTY property_specifiers '{'
973 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
975 | PROPERTY property_specifiers abstract_declarator '{'
976 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
979 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
984 | property_body SETPROP compound_statement
986 | property_body GETPROP compound_statement
988 | property_body ISPROPSET compound_statement
989 { $1.issetStmt = $3; }
990 | property_body WATCHABLE
991 { $1.isWatchable = true; }
992 | property_body PROPERTY_CATEGORY i18n_string
993 { $1.category = $3; }
997 property_body '}' { $1.loc.end = @2.end; $$ = $1; }
1000 class_property_start:
1001 CLASS_PROPERTY property_specifiers identifier '{'
1002 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
1004 | CLASS_PROPERTY property_specifiers abstract_declarator identifier '{'
1005 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
1007 | CLASS_PROPERTY property_specifiers '{'
1008 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
1010 | CLASS_PROPERTY property_specifiers abstract_declarator '{'
1011 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
1013 | CLASS_PROPERTY error '{'
1014 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
1017 class_property_body:
1018 class_property_start
1019 | class_property_body SETPROP compound_statement
1020 { $1.setStmt = $3; }
1021 | class_property_body GETPROP compound_statement
1022 { $1.getStmt = $3; }
1026 class_property_body '}' { $1.loc.end = @2.end; }
1029 watch_property_list:
1031 { $$ = MkListOne($1); }
1032 | watch_property_list identifier
1033 { ListAdd($1, $2); }
1037 watch_property_list compound_statement
1038 { $$ = MkPropertyWatch($1, $2); }
1039 | DELETE compound_statement
1040 { $$ = MkDeleteWatch($2); }
1043 property_watch_list:
1045 { $$ = MkListOne($1); }
1046 | property_watch_list property_watch
1047 { ListAdd($1, $2); }
1050 self_watch_definition:
1051 WATCH '(' watch_property_list ')' compound_statement
1052 { $$ = MkPropertyWatch($3, $5); }
1056 WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1057 { $$ = MkWatchStmt(null, $3, $6); }
1058 | assignment_expression '.' WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1059 { $$ = MkWatchStmt($1, $5, $8); }
1063 STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1064 { $$ = MkStopWatchingStmt(null, $3, $5); }
1065 | assignment_expression '.' STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1066 { $$ = MkStopWatchingStmt($1, $5, $7); }
1067 | STOPWATCHING '(' assignment_expression ')'
1068 { $$ = MkStopWatchingStmt(null, $3, null); }
1069 | assignment_expression '.' STOPWATCHING '(' assignment_expression ')'
1070 { $$ = MkStopWatchingStmt($1, $5, null); }
1075 { $$ = MkFireWatchersStmt(null, null); }
1076 | FIREWATCHERS watch_property_list
1077 { $$ = MkFireWatchersStmt(null, $2); }
1078 | postfix_expression '.' FIREWATCHERS
1079 { $$ = MkFireWatchersStmt($1, null); }
1080 | assignment_expression '.' FIREWATCHERS watch_property_list
1081 { $$ = MkFireWatchersStmt($1, $4); }
1085 struct_declaration_error ';' { $$ = $1; $$.loc.end = @2.end; }
1086 | default_property_list ';' { $$ = MkClassDefDefaultProperty($1); if($1->last) ((MemberInit)$1->last).loc.end = @2.start; $$.loc = @$; }
1087 | class_function_definition { $$ = MkClassDefFunction($1); $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1088 | property { $$ = MkClassDefProperty($1); $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1089 | member_access class_function_definition { $$ = MkClassDefFunction($2); $$.loc = @$; $$.memberAccess = $1; }
1090 | member_access property { $$ = MkClassDefProperty($2); $$.loc = @$; $$.memberAccess = $1; }
1091 | class_property { $$ = MkClassDefClassProperty($1); $$.loc = @$; }
1092 | WATCHABLE { $$ = null; deleteWatchable = true; }
1093 | CLASS_NO_EXPANSION { $$ = MkClassDefNoExpansion(); }
1094 | CLASS_FIXED { $$ = MkClassDefFixed(); }
1095 | CLASS_PROPERTY '(' identifier ')' '=' initializer_condition ';' { $$ = MkClassDefClassPropertyValue($3, $6); $$.loc = @$; }
1097 | ';' { $$ = null; }
1098 | member_access ':' { memberAccessStack[defaultMemberAccess] = $1; if(defaultMemberAccess == 0) { $$ = MkClassDefMemberAccess(); $$.memberAccess = $1; $$.loc = @$; } else $$ = null; }
1100 | member_access '(' identifier ')' { $$ = MkClassDefAccessOverride($1, $3); $$.loc = @$; }
1103 struct_declaration_error:
1104 class_function_definition_error { $$ = MkClassDefFunction($1); $$.loc = $1.loc; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1106 // Moved all these in here without the ';'
1107 | guess_declaration_specifiers { $$ = MkClassDefDeclaration(MkStructDeclaration($1, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1108 | guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefDeclaration(MkStructDeclaration($1, $2, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1109 | member_access guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefDeclaration(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1110 | member_access guess_declaration_specifiers { $$ = MkClassDefDeclaration(MkStructDeclaration($2, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1111 | member_access instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1112 | member_access guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1113 | CLASS_DATA guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefClassData(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; }
1114 | self_watch_definition { $$ = MkClassDefPropertyWatch($1); $$.loc = @$; }
1115 | CLASS_DESIGNER identifier { $$ = MkClassDefDesigner($2.string); FreeIdentifier($2); }
1116 | CLASS_DESIGNER strict_type { $$ = MkClassDefDesigner($2.name); FreeSpecifier($2); }
1117 | CLASS_DEFAULT_PROPERTY identifier { $$ = MkClassDefDesignerDefaultProperty($2); }
1118 | instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1119 | guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1120 | default_property_list { $$ = MkClassDefDefaultProperty($1); if($1->last) ((MemberInit)$1->last).loc.end = @1.end; $$.loc = @$; }
1122 | guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1123 | instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1124 // | guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1125 // | instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1127 | member_access class_function_definition_error { $$ = MkClassDefFunction($2); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = $1; }
1128 | member_access guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1129 | member_access instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1130 // | member_access guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1131 // | member_access instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1133 | default_property_list_error { $$ = MkClassDefDefaultProperty($1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
1136 struct_declaration_list:
1137 struct_declaration { $$ = MkList(); ListAdd($$, $1); }
1138 | struct_declaration_list struct_declaration { $$ = $1; ListAdd($1, $2); }
1139 | struct_declaration_list_error struct_declaration { $$ = $1; ListAdd($1, $2); }
1142 struct_declaration_list_error:
1143 struct_declaration_error { yyerror(); $$ = MkList(); ListAdd($$, $1); }
1144 | struct_declaration_list error
1145 | struct_declaration_list_error error
1146 | struct_declaration_list struct_declaration_error { yyerror(); $$ = $1; ListAdd($$, $2); }
1147 | struct_declaration_list_error struct_declaration_error { $$ = $1; ListAdd($$, $2); }
1151 guess_declaration_specifiers { $$ = MkTemplateDatatype($1, null); }
1152 | guess_declaration_specifiers abstract_declarator { $$ = MkTemplateDatatype($1, $2); }
1153 // | identifier { $$ = MkTemplateDatatype(MkListOne(MkSpecifierName($1.string)), null); FreeIdentifier($1); }
1156 template_type_argument:
1157 // template_datatype { $$ = MkTemplateTypeArgument($1); }
1159 // Explicitly copied the rules here to handle:
1160 // ast.ec: Map<List<Location>> intlStrings { };
1162 // LinkList.ec: class LinkList<bool circ = false>
1164 guess_declaration_specifiers { $$ = MkTemplateTypeArgument(MkTemplateDatatype($1, null)); }
1165 | guess_declaration_specifiers abstract_declarator { $$ = MkTemplateTypeArgument(MkTemplateDatatype($1, $2)); }
1168 template_type_parameter:
1169 CLASS identifier { $$ = MkTypeTemplateParameter($2, null, null); }
1170 | CLASS identifier '=' template_type_argument { $$ = MkTypeTemplateParameter($2, null, $4); }
1171 | CLASS identifier ':' template_datatype { $$ = MkTypeTemplateParameter($2, $4, null); }
1172 | CLASS identifier ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter($2, $4, $6); }
1173 | CLASS base_strict_type_name { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, null); delete $2; }
1174 | CLASS base_strict_type_name '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, $4); }
1175 | CLASS base_strict_type_name ':' template_datatype { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, null); }
1176 | CLASS base_strict_type_name ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, $6); }
1179 template_identifier_argument:
1180 identifier { $$ = MkTemplateIdentifierArgument($1); }
1183 template_identifier_parameter:
1184 identifier { $$ = MkIdentifierTemplateParameter($1, dataMember, null); }
1185 | identifier '=' template_identifier_argument { $$ = MkIdentifierTemplateParameter($1, dataMember, $3); }
1188 template_expression_argument:
1189 shift_expression /*constant_expression*/ { $$ = MkTemplateExpressionArgument($1); }
1192 template_expression_parameter:
1194 template_datatype identifier { $$ = MkExpressionTemplateParameter($2, $1, null); }
1195 | template_datatype identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($2, $1, $4); }
1197 guess_declaration_specifiers identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($2, MkTemplateDatatype($1, null), $4); }
1198 | guess_declaration_specifiers abstract_declarator identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($3, MkTemplateDatatype($1, $2), $5); }
1202 template_type_parameter
1203 | template_identifier_parameter
1204 | template_expression_parameter
1207 template_parameters_list:
1208 template_parameter { $$ = MkList(); ListAdd($$, $1); }
1209 | template_parameters_list ',' template_parameter { $$ = $1; ListAdd($1, $3); }
1213 template_expression_argument
1214 | template_identifier_argument
1215 | template_type_argument
1216 | identifier '=' template_expression_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1217 | identifier '=' template_identifier_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1218 | identifier '=' template_type_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1219 /*| template_datatype '=' template_expression_argument
1222 if($1.specifiers && $1.specifiers->first)
1224 Specifier spec = $1.specifiers->first;
1225 if(spec.type == nameSpecifier)
1226 $$.name = MkIdentifier(spec.name);
1228 FreeTemplateDataType($1);
1231 | template_datatype '=' template_identifier_argument
1234 if($1.specifiers && $1.specifiers->first)
1236 Specifier spec = $1.specifiers->first;
1237 if(spec.type == nameSpecifier)
1238 $$.name = MkIdentifier(spec.name);
1240 FreeTemplateDataType($1);
1243 | template_datatype '=' template_type_argument
1246 if($1.specifiers && $1.specifiers->first)
1248 Specifier spec = $1.specifiers->first;
1249 if(spec.type == nameSpecifier)
1250 $$.name = MkIdentifier(spec.name);
1252 FreeTemplateDataType($1);
1257 template_arguments_list:
1258 template_argument { $$ = MkList(); ListAdd($$, $1); }
1259 | template_arguments_list ',' template_argument { $$ = $1; ListAdd($1, $3); }
1265 if(curContext != globalContext)
1266 PopContext(curContext);
1271 class_entry identifier { (void)$1; $$ = DeclClassAddNameSpace($2._class, $2.string); FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1272 | class_entry base_strict_type
1274 (void)$1; $$ = DeclClass($2.nsSpec, $2.name);
1277 ++defaultMemberAccess;
1278 memberAccessStack[defaultMemberAccess] = privateAccess;
1280 | identifier class_entry identifier { (void)$2; $$ = DeclClassAddNameSpace($3._class, $3.string); FreeIdentifier($1); FreeIdentifier($3); $$.nameLoc = @3; $$.isRemote = true; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1281 | identifier class_entry base_strict_type { (void)$2; $$ = DeclClass($3.nsSpec, $3.name); FreeIdentifier($1); $$.nameLoc = @3; $$.isRemote = true; FreeSpecifier($3); memberAccessStack[++defaultMemberAccess] = privateAccess; }
1283 | class_entry identifier '<' template_parameters_list '>' { (void)$1; $$ = DeclClassAddNameSpace($2._class, $2.string); $$.templateParams = $4; FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1284 | class_entry base_strict_type '<' template_parameters_list '>'
1286 (void)$1; $$ = DeclClass($2.nsSpec, $2.name);
1287 $$.templateParams = $4;
1290 ++defaultMemberAccess;
1291 memberAccessStack[defaultMemberAccess] = privateAccess;
1293 | identifier class_entry identifier '<' template_parameters_list '>' { (void)$2; $$ = DeclClassAddNameSpace($3._class, $3.string); $$.templateParams = $5; FreeIdentifier($1); FreeIdentifier($3); $$.nameLoc = @3; $$.isRemote = true; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1294 | identifier class_entry base_strict_type '<' template_parameters_list '>' { (void)$2; $$ = DeclClass($3.nsSpec, $3.name); $$.templateParams = $5; FreeIdentifier($1); $$.nameLoc = @3; $$.isRemote = true; FreeSpecifier($3); memberAccessStack[++defaultMemberAccess] = privateAccess; }
1304 // Added this for unit classes...
1307 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$;
1309 PopContext(curContext);
1312 | class_decl '{' '}'
1314 $$ = MkClass($1, null, MkList()); $$.blockStart = @2; $$.loc = @$;
1316 PopContext(curContext);
1318 | class_head '{' '}'
1320 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$;
1322 PopContext(curContext);
1325 | class_entry identifier ';'
1327 (void)$1; $$ = MkClass(DeclClassAddNameSpace($2._class, $2.string), null, null); FreeIdentifier($2);
1329 PopContext(curContext);
1331 | class_entry type ';'
1333 (void)$1; $$ = MkClass(DeclClass($2.nsSpec, $2.name), null, null); FreeSpecifier($2);
1335 PopContext(curContext);
1340 class_decl ':' inheritance_specifiers
1342 $$ = MkClass($1, $3, null);
1347 class_decl '{' struct_declaration_list_error
1349 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;
1351 PopContext(curContext);
1353 | class_head '{' struct_declaration_list_error
1355 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;
1357 PopContext(curContext);
1359 | class_decl '{' struct_declaration_list
1361 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;
1363 PopContext(curContext);
1365 | class_head '{' struct_declaration_list
1367 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;
1369 PopContext(curContext);
1371 | class_decl '{' error
1373 $$ = MkClass($1, null, MkList()); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;
1375 PopContext(curContext);
1377 | class_head '{' error
1379 $$ = $1; $$.definitions = MkList(); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;
1381 PopContext(curContext);
1385 /**** EXPRESSIONS ********************************************************************/
1389 { $$ = MkIdentifier(yytext); $$.loc = @1; }
1393 simple_primary_expression
1394 | '(' expression ')'
1395 { $$ = MkExpBrackets($2); $$.loc = @$; }
1399 string_literal { $$ = MkExpString($1); delete $1; $$.loc = @$; }
1400 | '$' string_literal { $$ = MkExpIntlString($2, null); delete $2; $$.loc = @$; }
1401 | '$' string_literal '.' string_literal { $$ = MkExpIntlString($4, $2); delete $2; delete $4; $$.loc = @$; }
1405 CONSTANT { $$ = MkExpConstant(yytext); $$.loc = @$; }
1408 simple_primary_expression:
1409 identifier { $$ = MkExpIdentifier($1); $$.loc = @$; }
1410 | instantiation_unnamed { $$ = MkExpInstance($1); $$.loc = @$; }
1411 | EXTENSION '(' compound_statement ')' { $$ = MkExpExtensionCompound($3); $$.loc = @$; }
1412 | EXTENSION '(' expression ')' { $$ = MkExpExtensionExpression($3); $$.loc = @$; }
1413 | EXTENSION '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, $5); $$.loc = @$; }
1414 | EXTENSION '(' type_name ')' '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, MkInitializerAssignment(MkExpExtensionInitializer($6, $8))); $$.loc = @$; }
1415 | constant identifier
1417 char * constant = $1.constant;
1418 int len = strlen(constant);
1419 if(constant[len-1] == '.')
1421 constant[len-1] = 0;
1422 $$ = MkExpMember($1, $2);
1428 | constant { $$ = $1; }
1430 | WIDE_STRING_LITERAL { $$ = MkExpWideString(yytext); $$.loc = @$; }
1431 | '(' ')' { Expression exp = MkExpDummy(); exp.loc.start = @1.end; exp.loc.end = @2.start; $$ = MkExpBrackets(MkListOne(exp)); $$.loc = @$; yyerror(); }
1432 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1433 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1434 | NEWOP new_specifiers '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1435 | NEWOP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1436 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1437 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1438 | NEW0OP new_specifiers '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1439 | NEW0OP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1440 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1441 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1442 | RENEW constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1443 | RENEW constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1444 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1445 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1446 | RENEW0 constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1447 | RENEW0 constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1448 | CLASS '(' declaration_specifiers ')' { $$ = MkExpClass($3, null); $$.loc = @$; }
1449 | CLASS '(' declaration_specifiers abstract_declarator ')' { $$ = MkExpClass($3, $4); $$.loc = @$; }
1450 | CLASS '(' identifier ')' { $$ = MkExpClass(MkListOne(MkSpecifierName($3.string)), null); FreeIdentifier($3); $$.loc = @$; }
1451 | VAARG '(' assignment_expression ',' type_name ')' { $$ = MkExpVaArg($3, $5); $$.loc = @$; }
1453 | CLASS_DATA '(' identifier ')' { $$ = MkExpClassData($3); $$.loc = @$; }
1459 | '[' argument_expression_list /*expression*/ ']' { $$ = MkExpArray($2); $$.loc = @$; }
1460 | '[' ']' { $$ = MkExpArray(null); $$.loc = @$; }
1463 anon_instantiation_expression:
1464 instantiation_anon { $$ = MkExpInstance($1); $$.loc = @$; }
1467 anon_instantiation_expression_error:
1468 instantiation_anon_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1471 primary_expression_error:
1472 '(' expression { yyerror(); $$ = MkExpBrackets($2); $$.loc = @$; }
1473 | '(' expression_error { $$ = MkExpBrackets($2); $$.loc = @$; }
1479 | postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1480 | postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1481 | postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1482 | postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1483 | 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; }
1484 | postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1485 | postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1486 | postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1487 | postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1489 | postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1490 | postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1491 | postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1492 | postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1493 | postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1494 | postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1495 | postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1496 | postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1499 /*simple_postfix_expression:
1500 simple_primary_expression
1502 | simple_postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1503 | simple_postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1504 | simple_postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1505 | simple_postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1506 | 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; }
1507 | simple_postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1508 | simple_postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1509 | simple_postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1510 | simple_postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1512 | simple_postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1513 | simple_postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1514 | simple_postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1515 | simple_postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1516 | simple_postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1517 | simple_postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1518 | simple_postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1519 | simple_postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1522 argument_expression_list:
1523 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1524 | anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1525 | argument_expression_list ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1526 | argument_expression_list ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1529 argument_expression_list_error:
1530 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
1531 | anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
1532 | argument_expression_list ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
1533 | argument_expression_list ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
1534 | argument_expression_list ',' { Expression exp = MkExpDummy(); yyerror(); exp.loc.start = @2.end; exp.loc.end = @2.end; $$ = $1; ListAdd($1, exp); }
1537 common_unary_expression:
1538 INC_OP unary_expression { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1539 | DEC_OP unary_expression { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1540 | unary_operator cast_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1541 | unary_operator anon_instantiation_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1542 //| SIZEOF '(' unary_expression ')' { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1543 | SIZEOF unary_expression { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1544 | SIZEOF '(' guess_type_name ')' { $$ = MkExpTypeSize($3); $$.loc = @$; }
1545 | SIZEOF '(' CLASS type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1546 | SIZEOF '(' CLASS guess_type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1548 //| ALIGNOF '(' unary_expression ')' { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1549 | ALIGNOF unary_expression { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1550 | ALIGNOF '(' guess_type_name ')' { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1554 common_unary_expression
1555 | postfix_expression
1559 common_unary_expression
1560 | simple_postfix_expression
1570 | DELETE { $$ = DELETE; }
1571 | _INCREF { $$ = _INCREF; }
1576 | '(' type_name ')' cast_expression { $$ = MkExpCast($2, $4); $$.loc = @$; }
1579 multiplicative_expression:
1581 | multiplicative_expression '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1582 | multiplicative_expression '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1583 | multiplicative_expression '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1584 | multiplicative_expression_error '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1585 | multiplicative_expression_error '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1586 | multiplicative_expression_error '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1589 additive_expression:
1590 multiplicative_expression
1591 | additive_expression '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1592 | additive_expression '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1593 | additive_expression_error '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1594 | additive_expression_error '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1599 | shift_expression LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1600 | shift_expression RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1601 | shift_expression_error LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1602 | shift_expression_error RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1605 relational_expression_smaller_than:
1606 relational_expression '<'
1613 relational_expression:
1615 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression { skipErrors = false; $$ = MkExpOp($1, '<', $2/*$3*/); $$.loc = @$; }
1616 | relational_expression '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1617 | relational_expression LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1618 | relational_expression GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1619 | relational_expression_error '<' shift_expression { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1620 | relational_expression_error '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1621 | relational_expression_error LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1622 | relational_expression_error GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1626 : relational_expression
1627 | equality_expression EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1628 | equality_expression NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1629 | equality_expression_error EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1630 | equality_expression_error NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1632 | equality_expression EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1633 | equality_expression NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1634 | equality_expression_error EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1635 | equality_expression_error NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1639 : equality_expression
1640 | and_expression '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1641 | and_expression_error '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1643 | and_expression '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1644 | and_expression_error '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1647 exclusive_or_expression
1649 | exclusive_or_expression '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1650 | exclusive_or_expression_error '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1652 | exclusive_or_expression '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1653 | exclusive_or_expression_error '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1656 inclusive_or_expression
1657 : exclusive_or_expression
1658 | inclusive_or_expression '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1659 | inclusive_or_expression_error '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1661 | inclusive_or_expression '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1662 | inclusive_or_expression_error '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1665 logical_and_expression
1666 : inclusive_or_expression
1667 | logical_and_expression AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1668 | logical_and_expression_error AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1671 logical_or_expression
1672 : logical_and_expression
1673 | logical_or_expression OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1674 | logical_or_expression_error OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1677 conditional_expression
1678 : logical_or_expression
1679 | logical_or_expression '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1680 | logical_or_expression '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1681 | logical_or_expression_error '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1682 | logical_or_expression_error '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1684 | logical_or_expression '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1685 | logical_or_expression '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1686 | logical_or_expression_error '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1687 | logical_or_expression_error '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1689 | logical_or_expression '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1690 | logical_or_expression '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1691 | logical_or_expression_error '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1692 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1694 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1695 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1696 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1697 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1700 assignment_expression:
1701 conditional_expression
1702 | unary_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1703 | unary_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1704 | conditional_expression assignment_operator assignment_expression { Compiler_Error($"l-value expected\n"); $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1705 | conditional_expression_error assignment_operator assignment_expression { Compiler_Error($"l-value expected\n"); $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1707 | unary_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1708 | unary_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1709 | conditional_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1710 | conditional_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1713 assignment_operator:
1715 | MUL_ASSIGN { $$ = MUL_ASSIGN; }
1716 | DIV_ASSIGN { $$ = DIV_ASSIGN; }
1717 | MOD_ASSIGN { $$ = MOD_ASSIGN; }
1718 | ADD_ASSIGN { $$ = ADD_ASSIGN; }
1719 | SUB_ASSIGN { $$ = SUB_ASSIGN; }
1720 | LEFT_ASSIGN { $$ = LEFT_ASSIGN; }
1721 | RIGHT_ASSIGN { $$ = RIGHT_ASSIGN; }
1722 | AND_ASSIGN { $$ = AND_ASSIGN; }
1723 | XOR_ASSIGN { $$ = XOR_ASSIGN; }
1724 | OR_ASSIGN { $$ = OR_ASSIGN; }
1728 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1729 | expression ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1730 | expression_error ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1731 | expression_error ')'
1734 expression_anon_inst:
1735 anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1736 | expression ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1737 | expression_error ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1740 postfix_expression_error:
1741 primary_expression_error
1742 | error { $$ = MkExpDummy(); $$.loc = @$; /*printf("Sorry, didn't mean that syntax error\n");*/ }
1743 | postfix_expression error
1744 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1746 | postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1747 | postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1749 | postfix_expression '(' argument_expression_list { yyerror(); $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1750 | postfix_expression '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1751 /* Useless rules due to conflicts
1752 | postfix_expression '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; $$.call.argLoc.end.charPos++;}
1753 | postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1755 | postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1757 | 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++;}
1758 /* Useless rules due to conflicts
1759 | 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++;}
1760 | postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1762 | postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1765 /*simple_postfix_expression_error:
1766 error { $$ = MkExpDummy(); $$.loc = @$; }
1767 | simple_postfix_expression error
1768 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1770 | simple_postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1771 | simple_postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1773 | simple_postfix_expression '(' argument_expression_list { yyerror(); $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1774 | 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++;}
1775 // Useless rules due to conflicts
1776 //| 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++;}
1777 //| simple_postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1779 | simple_postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1781 | 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++;}
1782 // Useless rules due to conflicts
1783 //| 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++;}
1784 //| simple_postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1785 | simple_postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1789 common_unary_expression_error:
1790 INC_OP unary_expression_error { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1791 | DEC_OP unary_expression_error { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1792 | unary_operator cast_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1793 | unary_operator anon_instantiation_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1794 //| SIZEOF '(' unary_expression_error { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1795 | SIZEOF unary_expression_error { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1796 | SIZEOF '(' guess_type_name ')' error { $$ = MkExpTypeSize($3); $$.loc = @$; }
1797 | SIZEOF '(' CLASS type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1798 | SIZEOF '(' CLASS guess_type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1799 //| ALIGNOF '(' unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1800 | ALIGNOF unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1801 | ALIGNOF '(' guess_type_name ')' error { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1804 unary_expression_error:
1805 common_unary_expression_error
1806 | postfix_expression_error
1809 /*simple_unary_expression_error:
1810 common_unary_expression_error
1811 | simple_postfix_expression_error
1814 cast_expression_error:
1815 unary_expression_error
1816 | '(' type_name ')' cast_expression_error { $$ = MkExpCast($2, $4); $$.loc = @$; }
1819 multiplicative_expression_error:
1820 cast_expression_error
1821 | multiplicative_expression '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1822 | multiplicative_expression '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1823 | multiplicative_expression '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1824 | multiplicative_expression_error '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1825 | multiplicative_expression_error '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1826 | multiplicative_expression_error '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1829 additive_expression_error:
1830 multiplicative_expression_error
1831 | additive_expression '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1832 /* Useless rules due to conflicts
1833 | additive_expression '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1835 | additive_expression '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1836 /* Useless rules due to conflicts
1837 | additive_expression '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1839 | additive_expression_error '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1840 /* Useless rules due to conflicts
1841 | additive_expression_error '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1843 | additive_expression_error '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1844 /* Useless rules due to conflicts
1845 | additive_expression_error '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1849 shift_expression_error:
1850 additive_expression_error
1851 | shift_expression LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1852 | shift_expression RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1853 | shift_expression_error LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1854 | shift_expression_error RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1857 relational_expression_error:
1858 shift_expression_error
1859 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression_error
1861 if($1.type == identifierExp)
1863 _DeclClass($1.identifier._class, $1.identifier.string);
1865 // printf("Declaring Class %s\n", $1.identifier.string);
1871 fileInput.Seek(@1.start.pos, start);
1872 resetScannerPos(&@1.start);
1877 YY_STACK_PRINT (yyss, yyssp);
1881 YY_STACK_PRINT (yyss, yyssp);
1885 YY_STACK_PRINT (yyss, yyssp);
1889 YY_STACK_PRINT (yyss, yyssp);
1897 $$ = MkExpOp($1, '<', $2);
1902 | relational_expression '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1903 | relational_expression LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1904 | relational_expression GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1905 | relational_expression_error '<' shift_expression_error { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1906 | relational_expression_error '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1907 | relational_expression_error LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1908 | relational_expression_error GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1911 equality_expression_error:
1912 relational_expression_error
1913 | equality_expression EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1914 | equality_expression NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1915 | equality_expression_error EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1916 | equality_expression_error NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1917 /* Useless rules due to conflicts
1918 | equality_expression EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1919 | equality_expression NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1920 | equality_expression_error EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1921 | equality_expression_error NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1923 | equality_expression EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1924 | equality_expression NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1925 | equality_expression_error EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1926 | equality_expression_error NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1929 and_expression_error:
1930 equality_expression_error
1931 | and_expression '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1932 | and_expression_error '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1934 | and_expression '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1935 | and_expression_error '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1938 exclusive_or_expression_error:
1939 and_expression_error
1940 | exclusive_or_expression '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1941 | exclusive_or_expression_error '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1943 | exclusive_or_expression '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1944 | exclusive_or_expression_error '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1947 inclusive_or_expression_error:
1948 exclusive_or_expression_error
1949 | inclusive_or_expression '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1950 | inclusive_or_expression_error '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1952 | inclusive_or_expression '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1953 | inclusive_or_expression_error '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1956 logical_and_expression_error:
1957 inclusive_or_expression_error
1958 | logical_and_expression AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1959 | logical_and_expression_error AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1962 logical_or_expression_error:
1963 logical_and_expression_error
1964 | logical_or_expression OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1965 | logical_or_expression_error OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1968 conditional_expression_error:
1969 logical_or_expression_error
1970 | logical_or_expression '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1971 | logical_or_expression '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1972 | logical_or_expression_error '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1973 | logical_or_expression_error '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1974 | logical_or_expression '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1975 | logical_or_expression '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1976 | logical_or_expression_error '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1977 | logical_or_expression_error '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1979 | logical_or_expression '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1980 | logical_or_expression '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1981 | logical_or_expression_error '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1982 | logical_or_expression_error '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1983 | logical_or_expression '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1984 | logical_or_expression '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1985 | logical_or_expression_error '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1986 | logical_or_expression_error '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1988 | logical_or_expression '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1989 | logical_or_expression '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1990 | logical_or_expression_error '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1991 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1993 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1994 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1995 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1996 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1998 | logical_or_expression '?' ':'
2001 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy());
2003 ((Expression)$$.cond.exp->last).loc = @2;
2004 $$.cond.elseExp.loc = @3;
2006 | logical_or_expression_error '?' ':'
2008 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @3;
2010 | logical_or_expression '?'
2013 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2015 | logical_or_expression_error '?'
2017 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2021 assignment_expression_error:
2022 conditional_expression_error
2023 | unary_expression assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2024 /* Useless rules due to conflicts
2025 | unary_expression assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2027 | unary_expression_error assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2028 /* Useless rules due to conflicts
2029 | unary_expression_error assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2032 | unary_expression assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2033 | unary_expression_error assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2037 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
2038 | assignment_expression error { $$ = MkList(); ListAdd($$, $1); }
2039 | expression ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2040 | expression_error ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2041 /* Useless rules due to conflicts
2042 | expression ',' error
2043 | expression_error ',' error
2046 | expression expression { yyerror(); $$ = $1; FreeList($2, FreeExpression); }
2047 | expression_error expression { $$ = $1; FreeList($2, FreeExpression); }
2048 | expression expression_error { $$ = $1; FreeList($2, FreeExpression); }
2051 expression_anon_inst_error:
2052 anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
2053 | anon_instantiation_expression error { $$ = MkList(); ListAdd($$, $1); }
2054 | expression ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2055 | expression_error ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2059 constant_expression: conditional_expression;
2061 constant_expression_error: conditional_expression_error;
2063 /**** TYPES **************************************************************************/
2064 storage_class_specifier:
2065 TYPEDEF { $$ = MkSpecifier(TYPEDEF); }
2066 | EXTERN { $$ = MkSpecifier(EXTERN); }
2067 | STATIC { $$ = MkSpecifier(STATIC); }
2068 | THREAD { $$ = MkSpecifier(THREAD); }
2069 | AUTO { $$ = MkSpecifier(AUTO); }
2070 | REGISTER { $$ = MkSpecifier(REGISTER); }
2071 | RESTRICT { $$ = MkSpecifier(RESTRICT); }
2074 external_storage_class_specifier:
2075 TYPEDEF { $$ = MkSpecifier(TYPEDEF); structDeclMode = declMode = defaultAccess; }
2076 | EXTERN { $$ = MkSpecifier(EXTERN); }
2077 | STATIC { $$ = MkSpecifier(STATIC); structDeclMode = declMode = staticAccess; }
2078 | THREAD { $$ = MkSpecifier(THREAD); }
2079 | AUTO { $$ = MkSpecifier(AUTO); }
2080 | REGISTER { $$ = MkSpecifier(REGISTER); }
2081 | RESTRICT { $$ = MkSpecifier(RESTRICT); }
2085 identifier { $$ = MkEnumerator($1, null); }
2086 | identifier '=' constant_expression { $$ = MkEnumerator($1, $3); }
2087 | identifier '=' constant_expression_error { $$ = MkEnumerator($1, $3); }
2091 enumerator { $$ = MkList(); ListAdd($$, $1); }
2092 | enumerator_list ',' enumerator { $$ = $1; ListAdd($1, $3); }
2093 | enumerator_list ','
2097 ENUM { memberAccessStack[++defaultMemberAccess] = publicAccess; }
2100 enum_specifier_nocompound:
2101 enum_specifier identifier { $$ = MkEnum($2, null); POP_DEFAULT_ACCESS }
2102 | enum_specifier strict_type { $$ = MkEnum(MkIdentifier($2.name), null); POP_DEFAULT_ACCESS }
2105 enum_specifier_compound:
2106 enum_specifier_compound_error '}' { $$.loc = @$; POP_DEFAULT_ACCESS $$ = $1; }
2107 | enum_specifier identifier '{' '}' { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2108 | enum_specifier strict_type '{' '}' { $$ = MkEnum(MkIdentifier($2.name), null); FreeSpecifier($2); $$.loc = @$; POP_DEFAULT_ACCESS }
2111 enum_specifier_compound_error:
2112 enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2113 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2115 | enum_specifier identifier '{' enumerator_list { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2116 | enum_specifier identifier '{' enumerator_list error { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2117 | enum_specifier identifier '{' error { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2118 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2119 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2121 | enum_specifier strict_type '{' enumerator_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2122 | enum_specifier strict_type '{' enumerator_list error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2123 | enum_specifier strict_type '{' error { $$ = MkEnum(MkIdentifier($2.name), null); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2124 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2125 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2127 | enum_specifier identifier '{' enumerator_list ';' { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2128 | enum_specifier strict_type '{' enumerator_list ';' { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2132 enum_specifier identifier { $$ = $2; if(declMode) DeclClassAddNameSpace($2._class, $2.string); }
2133 | enum_specifier strict_type { $$ = MkIdentifier($2.name); if(declMode) DeclClass($2.nsSpec, $2.name); FreeSpecifier($2); }
2137 enum_class_error '}' { $$ = $1; $$.loc = @$; }
2138 | enum_decl ':' inheritance_specifiers '{' '}' { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2139 | enum_decl '{' '}' { $$ = MkEnum($1, null); POP_DEFAULT_ACCESS }
2143 enum_decl ':' inheritance_specifiers '{' enumerator_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2144 | enum_decl ':' inheritance_specifiers '{' enumerator_list error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2145 | enum_decl ':' inheritance_specifiers '{' error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2146 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2147 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2148 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2149 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2150 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2151 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list_error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2153 | enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2154 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2156 | enum_decl '{' enumerator_list { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2157 | enum_decl '{' enumerator_list error { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2158 | enum_decl '{' error { $$ = MkEnum($1, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2159 | enum_decl '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2160 | enum_decl '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2162 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2163 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2164 | enum_decl ':' inheritance_specifiers '{' error ';' { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2165 | enum_decl '{' enumerator_list ';' { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2173 class_specifier_error:
2175 | struct_class_error
2179 ext_decl { $$ = MkSpecifierExtended($1); }
2183 CONST { $$ = MkSpecifier(CONST); }
2184 | VOLATILE { $$ = MkSpecifier(VOLATILE); }
2185 | ext_storage { $$ = $1; }
2189 type_qualifier_list:
2190 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2191 | type_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2195 VOID { $$ = MkSpecifier(VOID); }
2196 | CHAR { $$ = MkSpecifier(CHAR); }
2197 | SHORT { $$ = MkSpecifier(SHORT); }
2198 | INT { $$ = MkSpecifier(INT); }
2199 | UINT { $$ = MkSpecifier(UINT); }
2200 | INT64 { $$ = MkSpecifier(INT64); }
2201 | VALIST { $$ = MkSpecifier(VALIST); }
2202 | LONG { $$ = MkSpecifier(LONG); }
2203 | FLOAT { $$ = MkSpecifier(FLOAT); }
2204 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2205 | SIGNED { $$ = MkSpecifier(SIGNED); }
2206 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2207 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2208 | struct_or_union_specifier_nocompound
2209 | enum_specifier_nocompound
2211 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2212 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2213 | SUBCLASS '(' identifier ')' { _DeclClass($3._class, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2214 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2215 | TYPED_OBJECT { $$ = MkSpecifier(TYPED_OBJECT); }
2216 | ANY_OBJECT { $$ = MkSpecifier(ANY_OBJECT); }
2217 | _BOOL { $$ = MkSpecifier(_BOOL); }
2218 | BOOL { $$ = MkSpecifier(BOOL); }
2219 | _COMPLEX { $$ = MkSpecifier(_COMPLEX); }
2220 | _IMAGINARY { $$ = MkSpecifier(_IMAGINARY); }
2223 strict_type_specifier:
2224 VOID { $$ = MkSpecifier(VOID); }
2225 | CHAR { $$ = MkSpecifier(CHAR); }
2226 | SHORT { $$ = MkSpecifier(SHORT); }
2227 | INT { $$ = MkSpecifier(INT); }
2228 | UINT { $$ = MkSpecifier(UINT); }
2229 | INT64 { $$ = MkSpecifier(INT64); }
2230 | VALIST { $$ = MkSpecifier(VALIST); }
2231 | LONG { $$ = MkSpecifier(LONG); }
2232 | FLOAT { $$ = MkSpecifier(FLOAT); }
2233 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2234 | SIGNED { $$ = MkSpecifier(SIGNED); }
2235 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2236 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2237 | struct_or_union_specifier_nocompound
2238 | enum_specifier_nocompound
2240 | _BOOL { $$ = MkSpecifier(_BOOL); }
2241 | BOOL { $$ = MkSpecifier(BOOL); }
2242 | _COMPLEX { $$ = MkSpecifier(_COMPLEX); }
2243 | _IMAGINARY { $$ = MkSpecifier(_IMAGINARY); }
2244 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2245 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2246 | SUBCLASS '(' identifier ')' { _DeclClass($3._class, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2247 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2250 // TESTING declarator_nofunction here... For function declarations
2253 declarator_nofunction_type_ok
2254 { $$ = MkStructDeclarator($1, null); $$.loc = @$; }
2255 | declarator_nofunction_type_ok attrib
2256 { $$ = MkStructDeclarator($1, null); $$.structDecl.attrib = $2; $$.loc = @$; }
2257 | ':' constant_expression
2258 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2259 | declarator_nofunction_type_ok ':' constant_expression
2260 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2261 | declarator_nofunction_type_ok ':' constant_expression ':' constant_expression
2262 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2263 | ':' constant_expression_error
2264 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2265 | declarator_nofunction_type_ok ':' constant_expression_error
2266 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2267 | declarator_nofunction_type_ok ':' constant_expression ':' constant_expression_error
2268 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2269 | declarator_nofunction_type_ok ':' constant_expression_error ':' constant_expression_error
2270 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2271 | declarator_nofunction_type_ok ':' constant_expression_error ':' constant_expression
2272 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2275 struct_declarator_list:
2276 struct_declarator { $$ = MkList(); ListAdd($$, $1); }
2277 | struct_declarator_list ',' struct_declarator { $$ = $1; ListAdd($1, $3); }
2281 struct_or_union identifier
2283 $$ = MkStructOrUnion($1, $2, null);
2284 $$.addNameSpace = true;
2285 $$.ctx = PushContext();
2287 | struct_or_union base_strict_type
2289 $$ = MkStructOrUnion($1, MkIdentifier($2.name), null);
2290 $$.ctx = PushContext();
2293 | struct_or_union ext_decl identifier
2295 $$ = MkStructOrUnion($1, $3, null);
2296 $$.extDeclStruct = $2;
2297 $$.addNameSpace = true;
2298 $$.ctx = PushContext();
2300 | struct_or_union ext_decl base_strict_type
2302 $$ = MkStructOrUnion($1, MkIdentifier($3.name), null);
2303 $$.extDeclStruct = $2;
2304 $$.ctx = PushContext();
2309 struct_or_union_specifier_compound:
2310 struct_or_union_specifier_compound_error '}' { $$ = $1; $$.loc = @$; }
2311 | struct_entry '{' '}' { $$ = $1; $$.loc = @$; POP_DEFAULT_ACCESS PopContext(curContext); }
2312 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2313 | struct_or_union ext_decl '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; $$.loc = @$; POP_DEFAULT_ACCESS }
2316 struct_or_union_specifier_compound_error:
2317 struct_entry '{' struct_declaration_list { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2318 | struct_entry '{' struct_declaration_list_error { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2319 | struct_entry '{' error { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2321 | struct_or_union '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2322 | struct_or_union '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2323 | struct_or_union '{' error { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2325 | struct_or_union ext_decl '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2326 | struct_or_union ext_decl '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2327 | struct_or_union ext_decl '{' error { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2330 struct_or_union_specifier_nocompound:
2331 struct_entry { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2340 ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)($1.id._class, $1.id.string);
2343 | struct_entry '<' template_parameters_list '>'
2345 Symbol symbol = ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)($1.id._class, $1.id.string);
2347 symbol.templateParams = $3;
2352 struct_decl ':' inheritance_specifiers
2356 SetupBaseSpecs(null, $3);
2361 struct_class_error '}' { $$ = $1; $$.loc = @$; }
2362 | struct_head '{' '}'
2363 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2364 | struct_decl '{' '}' { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2365 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2369 struct_head '{' struct_declaration_list
2372 $$.definitions = $3;
2374 PopContext(curContext);
2376 | struct_head '{' struct_declaration_list_error
2379 $$.definitions = $3;
2381 PopContext(curContext);
2383 | struct_head '{' error
2384 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext);}
2386 | struct_decl '{' struct_declaration_list
2388 PopContext(curContext);
2391 $$ = MkStructOrUnion($1.type, $1.id, $3);
2396 $$.definitions = $3;
2399 | struct_decl '{' struct_declaration_list_error
2401 PopContext(curContext);
2405 $$ = MkStructOrUnion($1.type, $1.id, $3);
2410 $$.definitions = $3;
2413 | struct_decl '{' error
2414 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2416 | struct_or_union '{' struct_declaration_list
2417 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2418 | struct_or_union '{' struct_declaration_list_error
2419 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2420 | struct_or_union '{' error
2421 { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2425 STRUCT { $$ = structSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2426 | UNION { $$ = unionSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2429 specifier_qualifier_list:
2430 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2431 | specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2432 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2433 | specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2434 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2435 | specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2436 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2437 | specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2440 guess_specifier_qualifier_list:
2441 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2442 | guess_specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2443 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2444 | guess_specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2445 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2446 | guess_specifier_qualifier_list guess_type { $$ = $1; ListAdd($1, $2); }
2447 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2448 | guess_specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2449 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2450 | guess_specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2453 declaration_specifiers:
2454 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2455 | declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2456 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2457 | declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2458 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2459 | declaration_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2460 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2461 | declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2462 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2463 | declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2466 guess_declaration_specifiers:
2467 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2468 | guess_declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2469 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2470 | guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2471 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2472 | guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2473 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2474 | guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2475 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2476 | guess_declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2477 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2478 | guess_declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2481 external_guess_declaration_specifiers:
2482 external_storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2483 | external_guess_declaration_specifiers external_storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2484 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2485 | external_guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2486 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2487 | external_guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2488 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2489 | external_guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2490 | class_specifier { $$ = MkList(); ListAdd($$, $1); }
2491 | external_guess_declaration_specifiers class_specifier { $$ = $1; ListAdd($1, $2); }
2494 external_guess_declaration_specifiers_error:
2495 class_specifier_error { $$ = MkList(); ListAdd($$, $1); }
2496 | external_guess_declaration_specifiers class_specifier_error { $$ = $1; ListAdd($1, $2); }
2499 _inheritance_specifiers:
2500 PRIVATE { $$ = MkList(); ListAdd($$, MkSpecifier(PRIVATE)); }
2501 | PUBLIC { $$ = MkList(); ListAdd($$, MkSpecifier(PUBLIC)); }
2502 | storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2503 | _inheritance_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2504 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2505 | _inheritance_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2506 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2507 | _inheritance_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2509 { _DeclClass($1._class, $1.string); $$ = MkListOne(MkSpecifierName($1.string)); FreeIdentifier($1); }
2510 | _inheritance_specifiers identifier { $$ = $1; _DeclClass($2._class, $2.string); ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2); }
2512 | identifier '<' template_arguments_list '>'
2514 _DeclClass($1._class, $1.string);
2517 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2520 | _inheritance_specifiers identifier '<' template_arguments_list '>'
2523 _DeclClass($2._class, $2.string);
2524 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2529 inheritance_specifiers:
2530 _inheritance_specifiers
2531 | struct_or_union { $$ = MkListOne(MkStructOrUnion($1, null, null)); POP_DEFAULT_ACCESS }
2534 property_specifiers:
2535 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2536 | property_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2537 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2538 | property_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2539 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2540 | property_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2541 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2542 | property_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2543 | identifier '<' template_arguments_list '>'
2545 _DeclClass($1._class, $1.string);
2548 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2551 | property_specifiers identifier '<' template_arguments_list '>'
2553 _DeclClass($2._class, $2.string);
2554 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2560 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2561 | renew_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2562 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2563 | renew_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2564 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2565 | renew_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2566 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2567 | renew_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2568 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2569 | renew_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2570 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2571 | renew_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2572 | identifier '<' template_arguments_list '>'
2574 _DeclClass($1._class, $1.string);
2577 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2580 | renew_specifiers identifier '<' template_arguments_list '>'
2582 _DeclClass($2._class, $2.string);
2583 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2589 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2590 | new_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2591 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2592 | new_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2593 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2594 | new_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2595 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2596 | new_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2597 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2598 | new_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2599 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2600 | new_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2601 | identifier '<' template_arguments_list '>'
2603 _DeclClass($1._class, $1.string);
2606 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2609 | new_specifiers identifier '<' template_arguments_list '>'
2611 _DeclClass($2._class, $2.string);
2612 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2617 identifier_list_error:
2618 identifier_list ',' error { $$ = $1; ListAdd($1, null); }
2619 | identifier_list_error ',' error { $$ = $1; ListAdd($1, null); }
2623 identifier { $$ = MkList(); ListAdd($$, MkTypeName(null, MkDeclaratorIdentifier($1))); }
2624 | identifier_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2625 | identifier_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2626 | parameter_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2627 | parameter_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2630 direct_declarator_nofunction_type_ok:
2631 direct_declarator_nofunction
2634 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2635 String s = colon ? colon + 2 : $1.name;
2636 $$ = MkDeclaratorIdentifier(MkIdentifier(s));
2639 | UINT { $$ = MkDeclaratorIdentifier(MkIdentifier("uint")); }
2640 // These rules need to be reviewed in lights of prototypes with types only...
2641 | base_strict_type '[' constant_expression ']'
2644 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2645 String s = colon ? colon + 2 : $1.name;
2646 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2648 $$ = MkDeclaratorArray(decl, $3);
2650 | base_strict_type '[' constant_expression_error ']'
2653 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2654 String s = colon ? colon + 2 : $1.name;
2655 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2657 $$ = MkDeclaratorArray(decl, $3);
2659 | base_strict_type '[' type ']'
2662 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2663 String s = colon ? colon + 2 : $1.name;
2664 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2666 $$ = MkDeclaratorEnumArray(decl, $3);
2668 | base_strict_type '[' ']'
2671 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2672 String s = colon ? colon + 2 : $1.name;
2673 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2675 $$ = MkDeclaratorEnumArray(decl, null);
2677 | direct_declarator_nofunction_type_ok '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2678 | direct_declarator_nofunction_type_ok '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2679 | direct_declarator_nofunction_type_ok '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2680 | direct_declarator_nofunction_type_ok '[' ']' { $$ = MkDeclaratorArray($1, null); }
2683 direct_declarator_nofunction:
2684 identifier { $$ = MkDeclaratorIdentifier($1); }
2685 | '(' declarator ')' { $$ = MkDeclaratorBrackets($2); }
2686 | '(' ext_decl declarator ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2687 | '(' declarator_type_ok ')' { $$ = MkDeclaratorBrackets($2); }
2688 | '(' ext_decl declarator_type_ok ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2689 | direct_declarator_nofunction '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2690 | direct_declarator_nofunction '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2691 | direct_declarator_nofunction '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2692 | direct_declarator_nofunction '[' ']' { $$ = MkDeclaratorArray($1, null); }
2695 direct_declarator_function_start:
2696 direct_declarator_nofunction '('
2699 direct_declarator_function:
2700 direct_declarator_function_start parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2701 | direct_declarator_function_start parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2702 | direct_declarator_function_start identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2703 | direct_declarator_function_start identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2704 | direct_declarator_function_start ')' { $$ = MkDeclaratorFunction($1, null); }
2707 // Tricky stuff here for overriding...
2708 direct_declarator_function_error:
2709 direct_declarator_function_start identifier_list_error
2711 $$ = MkDeclaratorFunction($1, $2);
2712 fileInput.Seek(@1.end.pos, start);
2714 resetScannerPos(&@1.end);
2715 @$.start = @1.start;
2718 | direct_declarator_function_start error
2720 $$ = MkDeclaratorFunction($1, null);
2721 fileInput.Seek(@1.end.pos, start);
2723 resetScannerPos(&@1.end);
2724 @$.start = @1.start;
2727 | direct_declarator_function_start parameter_list '('
2729 $$ = MkDeclaratorFunction($1, $2);
2730 fileInput.Seek(@1.end.pos, start);
2732 resetScannerPos(&@1.end);
2733 @$.start = @1.start;
2736 | direct_declarator_function_start guess_declaration_specifiers identifier '('
2738 $$ = MkDeclaratorFunction($1, null);
2739 fileInput.Seek(@1.end.pos, start);
2741 resetScannerPos(&@1.end);
2742 @$.start = @1.start;
2744 FreeList($2, FreeSpecifier);
2750 direct_declarator_function
2751 | direct_declarator_nofunction
2755 direct_declarator_function_start_type_ok:
2756 direct_declarator_nofunction_type_ok '('
2759 direct_declarator_function_type_ok:
2760 direct_declarator_function_start_type_ok parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2761 | direct_declarator_function_start_type_ok parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2762 | direct_declarator_function_start_type_ok identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2763 | direct_declarator_function_start_type_ok identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2764 | direct_declarator_function_start_type_ok ')' { $$ = MkDeclaratorFunction($1, null); }
2767 // Tricky stuff here for overriding...
2768 direct_declarator_function_error_type_ok:
2769 direct_declarator_function_start_type_ok identifier_list_error
2771 $$ = MkDeclaratorFunction($1, $2);
2772 fileInput.Seek(@1.end.pos, start);
2774 resetScannerPos(&@1.end);
2775 @$.start = @1.start;
2778 | direct_declarator_function_start_type_ok error
2780 $$ = MkDeclaratorFunction($1, null);
2781 fileInput.Seek(@1.end.pos, start);
2783 resetScannerPos(&@1.end);
2784 @$.start = @1.start;
2787 | direct_declarator_function_start_type_ok parameter_list '('
2789 $$ = MkDeclaratorFunction($1, $2);
2790 fileInput.Seek(@1.end.pos, start);
2792 resetScannerPos(&@1.end);
2793 @$.start = @1.start;
2796 | direct_declarator_function_start_type_ok guess_declaration_specifiers identifier '('
2798 $$ = MkDeclaratorFunction($1, null);
2799 fileInput.Seek(@1.end.pos, start);
2801 resetScannerPos(&@1.end);
2802 @$.start = @1.start;
2804 FreeList($2, FreeSpecifier);
2809 direct_declarator_type_ok:
2810 direct_declarator_function_type_ok
2811 | direct_declarator_nofunction_type_ok
2813 | ext_decl direct_declarator_function_type_ok
2814 { $$ = MkDeclaratorExtended($1, $2); }
2815 | ext_decl direct_declarator_nofunction_type_ok
2816 { $$ = MkDeclaratorExtended($1, $2); }
2821 ASM '(' STRING_LITERAL { $<string>$ = CopyString(yytext); } STRING_LITERAL { $<string>$ = CopyString(yytext); }
2824 strcpy(temp, "__asm__(");
2825 strcat(temp, $<string>4);
2827 strcat(temp, $<string>6);
2830 $<string>$ = CopyString(temp);
2835 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2836 | attrib { $$ = MkExtDeclAttrib($1);
2840 strcpy(temp, $<string>1);
2843 $$ = MkExtDeclString(CopyString(temp));
2845 | asm_start STRING_LITERAL { $$ = CopyString(yytext); } ')'
2848 strcpy(temp, $<string>1);
2850 strcat(temp, $<string>3);
2854 $$ = MkExtDeclString(CopyString(temp));
2860 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2861 | EXT_STORAGE { $$ = MkExtDeclString(CopyString(yytext)); }
2862 | attrib { $$ = MkExtDeclAttrib($1); }
2863 | ASM '(' string_literal ')'
2866 strcpy(temp, "__asm__(");
2869 $$ = MkExtDeclString(CopyString(temp));
2875 ATTRIB { $<i>$ = ATTRIB; }
2876 | ATTRIB_DEP { $<i>$ = ATTRIB_DEP; }
2877 | __ATTRIB { $<i>$ = __ATTRIB; }
2882 IDENTIFIER { $$ = CopyString(yytext); }
2883 | TYPE_NAME { $$ = CopyString(yytext); }
2884 | EXT_STORAGE { $$ = CopyString(yytext); }
2885 | EXT_DECL { $$ = CopyString(yytext); }
2886 | CONST { $$ = CopyString(yytext); }
2890 attribute_word { $$ = MkAttribute($1, null); $$.loc = @$; }
2891 | attribute_word '(' expression ')' { $$ = MkAttribute($1, MkExpBrackets($3)); $$.loc = @$; }
2895 attribute { $$ = MkListOne($1); }
2896 | attribs_list attribute { ListAdd($1, $2); $$ = $1; }
2897 | attribs_list ',' attribute { ListAdd($1, $3); $$ = $1; }
2901 _attrib '(' '(' attribs_list ')' ')' { $$ = MkAttrib($<i>1, $4); $$.loc = @$; }
2902 | _attrib '(' '(' ')' ')' { $$ = MkAttrib($<i>1, null); $$.loc = @$; }
2905 direct_abstract_declarator:
2906 '(' abstract_declarator ')' { $$ = MkDeclaratorBrackets($2); }
2907 | '(' ext_decl abstract_declarator ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2908 | '[' ']' { $$ = MkDeclaratorArray(null, null); }
2909 | '[' constant_expression ']' { $$ = MkDeclaratorArray(null, $2); }
2910 | '[' constant_expression_error ']' { $$ = MkDeclaratorArray(null, $2); }
2911 | '[' type ']' { $$ = MkDeclaratorEnumArray(null, $2); }
2912 | direct_abstract_declarator '[' ']' { $$ = MkDeclaratorArray($1, null); }
2913 | direct_abstract_declarator '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2914 | direct_abstract_declarator '[' type']' { $$ = MkDeclaratorEnumArray($1, $3); }
2915 | direct_abstract_declarator '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2916 | '(' ')' { $$ = MkDeclaratorFunction(null, null); }
2917 | '(' parameter_type_list ')' { $$ = MkDeclaratorFunction(null, $2); }
2918 | '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction(null, $2); }
2919 | direct_abstract_declarator '(' ')' { $$ = MkDeclaratorFunction($1, null); }
2920 | direct_abstract_declarator '(' parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $3); }
2921 | direct_abstract_declarator '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $3); }
2924 direct_abstract_declarator_noarray:
2925 '(' abstract_declarator_noarray ')' { $$ = MkDeclaratorBrackets($2); }
2926 | '(' ext_decl abstract_declarator_noarray ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2927 | '(' ')' { $$ = MkDeclaratorFunction(null, null); }
2928 | '(' parameter_type_list ')' { $$ = MkDeclaratorFunction(null, $2); }
2929 | '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction(null, $2); }
2930 | direct_abstract_declarator_noarray '(' ')' { $$ = MkDeclaratorFunction($1, null); }
2931 | direct_abstract_declarator_noarray '(' parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $3); }
2932 | direct_abstract_declarator_noarray '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $3); }
2936 '*' { $$ = MkPointer(null, null); }
2937 | '*' type_qualifier_list { $$ = MkPointer($2, null); }
2938 | '*' pointer { $$ = MkPointer(null, $2); }
2939 | '*' type_qualifier_list pointer { $$ = MkPointer($2, $3); }
2942 abstract_declarator:
2943 pointer { $$ = MkDeclaratorPointer($1, null); }
2944 | direct_abstract_declarator
2945 | pointer direct_abstract_declarator { $$ = MkDeclaratorPointer($1, $2); }
2946 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
2947 | ext_decl pointer direct_abstract_declarator { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2950 abstract_declarator_noarray:
2951 pointer { $$ = MkDeclaratorPointer($1, null); }
2952 | direct_abstract_declarator_noarray
2953 | pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorPointer($1, $2); }
2954 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
2955 | ext_decl pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2960 | pointer direct_declarator
2961 { $$ = MkDeclaratorPointer($1, $2); }
2962 | ext_decl pointer direct_declarator
2963 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2964 | declarator ext_decl
2965 { $$ = MkDeclaratorExtendedEnd($2, $1); }
2966 | declarator_nofunction_type_ok ext_decl
2967 { $$ = MkDeclaratorExtendedEnd($2, $1); }
2971 direct_declarator_type_ok
2972 | pointer direct_declarator_type_ok
2973 { $$ = MkDeclaratorPointer($1, $2); }
2974 | ext_decl pointer direct_declarator_type_ok
2975 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2976 | declarator_type_ok ext_decl
2977 { $$ = MkDeclaratorExtendedEnd($2, $1); }
2980 declarator_function:
2981 direct_declarator_function
2982 | pointer direct_declarator_function { $$ = MkDeclaratorPointer($1, $2); }
2983 | ext_decl pointer direct_declarator_function { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2984 | pointer ext_decl direct_declarator_function { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
2987 declarator_function_error:
2988 direct_declarator_function_error
2989 | pointer direct_declarator_function_error { $$ = MkDeclaratorPointer($1, $2); }
2990 | ext_decl pointer direct_declarator_function_error { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2991 | pointer ext_decl direct_declarator_function_error { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
2994 declarator_function_type_ok:
2995 direct_declarator_function_type_ok
2996 | pointer direct_declarator_function_type_ok { $$ = MkDeclaratorPointer($1, $2); }
2997 | ext_decl pointer direct_declarator_function_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2998 | pointer ext_decl direct_declarator_function_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3001 declarator_function_error_type_ok:
3002 direct_declarator_function_error_type_ok
3003 | pointer direct_declarator_function_error_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3004 | ext_decl pointer direct_declarator_function_error_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3005 | pointer ext_decl direct_declarator_function_error_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3008 declarator_nofunction_type_ok:
3009 direct_declarator_nofunction_type_ok
3010 | pointer direct_declarator_nofunction_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3011 | ext_decl pointer direct_declarator_nofunction_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3012 | pointer ext_decl direct_declarator_nofunction_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3016 assignment_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3017 | '{' initializer_list '}' { $$ = MkInitializerList($2); $$.loc = @$; }
3018 | '{' initializer_list ',' '}'
3020 Compiler_Warning($"extra comma\n");
3021 $$ = MkInitializerList($2);
3025 Expression exp = MkExpDummy();
3026 Initializer init = MkInitializerAssignment(exp);
3035 assignment_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3036 | '{' initializer_list '}' error { $$ = MkInitializerList($2); $$.loc = @$; }
3037 | '{' initializer_list { yyerror(); $$ = MkInitializerList($2); $$.loc = @$; }
3038 | '{' initializer_list ',' '}' error
3040 $$ = MkInitializerList($2);
3044 Expression exp = MkExpDummy();
3045 Initializer init = MkInitializerAssignment(exp);
3051 | '{' initializer_list ','
3054 $$ = MkInitializerList($2);
3058 Expression exp = MkExpDummy();
3059 Initializer init = MkInitializerAssignment(exp);
3067 initializer_condition:
3068 conditional_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3069 | anon_instantiation_expression
3070 { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3073 initializer_condition_error:
3074 conditional_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3075 | anon_instantiation_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3079 initializer { $$ = MkList(); ListAdd($$, $1); }
3080 | initializer_error { $$ = MkList(); ListAdd($$, $1); }
3081 | initializer_list ',' initializer { $$ = $1; ListAdd($1, $3); }
3082 | initializer_list ',' initializer_error { $$ = $1; ListAdd($1, $3); }
3085 | initializer_list initializer { yyerror(); $$ = $1; ListAdd($1, $2); }
3086 | initializer_list initializer_error { $$ = $1; ListAdd($1, $2); }
3090 declarator { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3091 | declarator_type_ok { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3092 | declarator '=' initializer { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3095 init_declarator_error:
3096 declarator error { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3097 /* Useless rules due to conflicts
3098 | declarator '=' error { $$ = MkInitDeclarator($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.initializer.loc = @2; $$.initializer.exp.loc = @2; }
3100 | declarator '=' initializer_error { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3103 init_declarator_list:
3104 init_declarator { $$ = MkList(); ListAdd($$, $1); }
3105 | init_declarator_list ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3106 | UINT ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("uint")), null)); ListAdd($$, $3); }
3107 | INT64 ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("int64")), null)); ListAdd($$, $3); }
3108 | base_strict_type ',' init_declarator
3110 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
3111 String s = colon ? colon + 2 : $1.name;
3113 ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(s)), null));
3117 | init_declarator_list_error ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3118 /*| base_strict_type ',' init_declarator
3125 init_declarator_list_error:
3126 init_declarator_error { $$ = MkList(); ListAdd($$, $1); }
3127 | init_declarator error { $$ = MkList(); ListAdd($$, $1); }
3128 | init_declarator_list ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3129 | init_declarator_list_error ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3133 specifier_qualifier_list { $$ = MkTypeName($1, null); }
3134 | specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3138 guess_specifier_qualifier_list { $$ = MkTypeName($1, null); }
3139 | guess_specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3142 /*** PARAMETERS **********************************************************************/
3143 parameter_declaration:
3144 guess_declaration_specifiers declarator_type_ok { $$ = MkTypeName($1, $2); }
3145 | guess_declaration_specifiers abstract_declarator { $$ = MkTypeName($1, $2); }
3146 | guess_declaration_specifiers '&' { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), null)); }
3147 | guess_declaration_specifiers '&' declarator_type_ok { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), $3)); }
3148 | guess_declaration_specifiers { $$ = MkTypeNameGuessDecl($1, null); }
3150 { $$ = MkTypeName(MkListOne(MkSpecifier(CLASS)), null); }
3153 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), null); }
3155 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), null)); }
3156 | TYPED_OBJECT declarator
3157 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), $2); }
3158 | TYPED_OBJECT '&' declarator
3159 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), $3)); }
3161 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), null); }
3162 | ANY_OBJECT declarator
3163 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), $2); }
3167 parameter_declaration_error:
3168 guess_declaration_specifiers declarator_type_ok error { $$ = MkTypeName($1, $2); }
3169 | guess_declaration_specifiers abstract_declarator error { $$ = MkTypeName($1, $2); }
3173 parameter_declaration { $$ = MkList(); ListAdd($$, $1); }
3174 | parameter_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3175 | parameter_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3176 | parameter_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3177 | parameter_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3178 | error ',' parameter_declaration { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3180 | identifier_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3181 | identifier_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3182 | identifier_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3183 | identifier_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3186 parameter_list_error:
3187 parameter_declaration_error { $$ = MkList(); ListAdd($$, $1); }
3188 | parameter_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3189 | parameter_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3190 | parameter_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3191 | error ',' parameter_declaration_error { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3193 | identifier_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3194 | identifier_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3195 | identifier_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3198 parameter_type_list:
3200 | parameter_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3201 | parameter_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3202 | identifier_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3203 | identifier_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3204 | error ',' ELLIPSIS { $$ = MkList(); ListAdd($$, MkTypeName(null, null)); }
3207 parameter_type_list_error:
3208 parameter_list_error
3209 | parameter_list ',' error { $$ = $1; ListAdd($1, null); }
3210 | parameter_list_error error
3213 /****** STATEMENTS *******************************************************************/
3216 | attrib { $$ = MkExpressionStmt(null); FreeAttrib($1); } // Ignoring this for now... ( For __attribute__ ((__unused__)) )
3217 | compound_statement
3218 | ';' { $$ = MkExpressionStmt(null); }
3219 | ':' { $$ = MkExpressionStmt(null); }
3220 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3221 | selection_statement
3222 | iteration_statement
3227 | watch_definition ';'
3231 labeled_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3232 | iteration_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3233 | compound_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3234 | selection_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3235 | jump_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3236 | jump_statement error { $$ = $1; Compiler_Error($"syntax error\n"); }
3237 | expression_error { $$ = MkExpressionStmt($1); Compiler_Error($"syntax error\n"); $$.loc = @1; }
3241 string_literal { $$ = MkAsmField($1, null, null); $$.loc = @1; }
3242 | string_literal '(' assignment_expression ')' { $$ = MkAsmField($1, $3, null); $$.loc = @$; }
3243 | '[' identifier ']' string_literal '(' assignment_expression ')' { $$ = MkAsmField($4, $6, $2); $$.loc = @$; }
3247 asm_field { $$ = MkListOne($1); }
3248 | asm_field_list ',' asm_field { ListAdd($$, $3); }
3253 ASM type_qualifier '(' string_literal ')' ';' { $$ = MkAsmStmt($2, $4, null, null, null); $$.loc = @$; }
3254 | ASM type_qualifier '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, null); $$.loc = @$; }
3255 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, null); $$.loc = @$; }
3256 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, $10); $$.loc = @$; }
3258 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, null); $$.loc = @$; }
3259 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, $8); $$.loc = @$; }
3260 | ASM type_qualifier '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, $8); $$.loc = @$; }
3262 | ASM '(' string_literal ')' ';' { $$ = MkAsmStmt(null, $3, null, null, null); $$.loc = @$; }
3263 | ASM '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, null); $$.loc = @$; }
3264 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, null); $$.loc = @$; }
3265 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, $9); $$.loc = @$; }
3267 | ASM '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, null); $$.loc = @$; }
3268 | ASM '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, $7); $$.loc = @$; }
3269 | ASM '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, $7); $$.loc = @$; }
3273 identifier ':' statement { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3274 | CASE constant_expression ':' statement { /*if($4.type == labeledStmt) Compiler_Warning(CASE_LABELED_STMT_WARNING);*/ $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3275 | CASE constant_expression_error ':' statement { /*if($4.type == labeledStmt) Compiler_Warning(CASE_LABELED_STMT_WARNING);*/ $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3276 | CASE ':' statement { /*if($3.type == labeledStmt) Compiler_Warning(CASE_LABELED_STMT_WARNING);*/ $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3277 | DEFAULT ':' statement { /*if($3.type == labeledStmt) Compiler_Warning(CASE_LABELED_STMT_WARNING);*/ $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3279 | identifier ':' declaration { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkLabeledStmt($1, stmt); $$.loc = @$; }
3280 | CASE constant_expression ':' declaration { Statement stmt = MkBadDeclStmt($4); stmt.loc = @4; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt($2, stmt); $$.loc = @$; $2.loc.start = @1.end; }
3281 | CASE constant_expression_error ':' declaration { Statement stmt = MkBadDeclStmt($4); stmt.loc = @4; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt($2, stmt); $$.loc = @$; $2.loc.start = @1.end; }
3282 | CASE ':' declaration { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt(MkExpDummy(), stmt); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3283 | DEFAULT ':' declaration { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt(null, stmt); $$.loc = @$; }
3286 labeled_statement_error:
3287 identifier ':' statement_error { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3288 | CASE constant_expression ':' statement_error { /*if($4.type == labeledStmt) Compiler_Warning(CASE_LABELED_STMT_WARNING);*/ $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3289 | CASE constant_expression_error ':' statement_error { /*if($4.type == labeledStmt) Compiler_Warning(CASE_LABELED_STMT_WARNING);*/ $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3290 | CASE ':' statement_error { /*if($3.type == labeledStmt) Compiler_Warning(CASE_LABELED_STMT_WARNING);*/ $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3291 | CASE ':' { $$ = MkCaseStmt(MkExpDummy(), null); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3292 | DEFAULT ':' statement_error { /*if($3.type == labeledStmt) Compiler_Warning(CASE_LABELED_STMT_WARNING);*/ $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3293 | DEFAULT ':' { $$ = MkCaseStmt(null, null); $$.loc = @$; }
3295 | identifier ':' declaration_error { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkLabeledStmt($1, stmt); $$.loc = @$; }
3296 | CASE constant_expression ':' declaration_error { Statement stmt = MkBadDeclStmt($4); stmt.loc = @4; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt($2, stmt); $$.loc = @$; $2.loc.start = @1.end; }
3297 | CASE constant_expression_error ':' declaration_error { Statement stmt = MkBadDeclStmt($4); stmt.loc = @4; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt($2, stmt); $$.loc = @$; $2.loc.start = @1.end; }
3298 | CASE ':' declaration_error { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt(MkExpDummy(), stmt); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3299 | DEFAULT ':' declaration_error { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt(null, stmt); $$.loc = @$; }
3303 PUBLIC { $$ = structDeclMode = declMode = publicAccess; }
3304 | PRIVATE { $$ = structDeclMode = declMode = privateAccess; }
3305 | DEFAULT { $$ = structDeclMode = declMode = defaultAccess; }
3309 PUBLIC { $$ = publicAccess; }
3310 | PRIVATE { $$ = privateAccess; }
3314 declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; structDeclMode = defaultDeclMode; }
3315 | declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; structDeclMode = defaultDeclMode; }
3316 | instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; structDeclMode = defaultDeclMode; }
3317 | declaration_error ';' { $$ = $1; structDeclMode = defaultDeclMode; }
3320 external_guess_declaration:
3321 external_guess_declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3322 | external_guess_declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3323 | external_guess_declaration_specifiers_error init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3325 | external_guess_instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3326 | DEFINE identifier '=' conditional_expression ';' { $$ = MkDeclarationDefine($2, $4); $$.loc = @$; }
3327 | STATIC DEFINE identifier '=' conditional_expression ';' { structDeclMode = declMode = staticAccess; $$ = MkDeclarationDefine($3, $5); $$.loc = @$; }
3330 external_guess_declaration_error:
3331 external_guess_declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; yyerrok; }
3335 declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; structDeclMode = defaultDeclMode; }
3336 | declaration_error error { structDeclMode = defaultDeclMode; }
3338 | instantiation_named_error error { $$ = MkDeclarationInst($1); $$.loc = @$; structDeclMode = defaultDeclMode; }
3339 | instantiation_named error { $$ = MkDeclarationInst($1); $$.loc = @$; structDeclMode = defaultDeclMode; }
3340 | declaration_specifiers init_declarator_list_error { $$ = MkDeclaration($1, $2); $$.loc = @$; structDeclMode = defaultDeclMode; }
3344 declaration { $$ = MkList(); ListAdd($$, $1); /*declMode = defaultDeclMode;*/ }
3345 | declaration_list declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3346 | declaration_list_error declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3347 | declaration_list error ';' { $$ = $1; }
3350 declaration_list_error:
3351 declaration_error { $$ = MkList(); ListAdd($$, $1); }
3352 | declaration_list declaration_error { $$ = $1; ListAdd($1, $2); }
3356 statement { $$ = MkList(); ListAdd($$, $1); }
3357 | statement_list statement { $$ = $1; ListAdd($1, $2); }
3358 | statement_list_error statement { $$ = $1; ListAdd($1, $2); }
3361 statement_list_error:
3362 statement_error { $$ = MkList(); ListAdd($$, $1); }
3363 | statement_list statement_error { $$ = $1; ListAdd($1, $2); }
3364 | statement_list_error statement_error { $$ = $1; ListAdd($1, $2); }
3365 | statement_list declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3366 | statement_list_error declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3367 | statement_list declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3368 | statement_list_error declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3372 statement_list { $$ = MkCompoundStmt(null, $1); }
3373 | declaration_list { $$ = MkCompoundStmt($1, null); }
3374 | declaration_list statement_list { $$ = MkCompoundStmt($1, $2); }
3375 | declaration_list_error statement_list { $$ = MkCompoundStmt($1, $2); }
3378 compound_inside_error:
3379 statement_list_error { $$ = MkCompoundStmt(null, $1); }
3380 | declaration_list_error { $$ = MkCompoundStmt($1, null); }
3381 | declaration_list statement_list_error { $$ = MkCompoundStmt($1, $2); }
3382 | declaration_list_error statement_list_error { $$ = MkCompoundStmt($1, $2); }
3386 '{' { $<context>$ = PushContext(); }
3390 compound_statement_error '}' { $$ = $1; $$.loc = @$; }
3393 compound_statement_error:
3394 compound_start compound_inside_error
3395 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3397 { $$ = MkCompoundStmt(null, null); $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3399 | compound_start compound_inside
3400 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3404 expression_statement:
3405 ';' { $$ = MkExpressionStmt(null); $$.loc = @$; }
3406 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3407 | expression_error ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3410 selection_statement:
3411 IF '(' expression ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3412 | IF '(' expression_error ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3413 | IF '(' expression ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3414 | IF '(' expression_error ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3415 | SWITCH '(' expression ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3416 | SWITCH '(' expression_error ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3419 selection_statement_error:
3420 IF '(' expression_error { $$ = MkIfStmt($3, null, null); $$.loc = @$; }
3421 | selection_statement error
3424 iteration_statement:
3425 WHILE '(' expression ')' statement { $$ = MkWhileStmt($3, $5); $$.loc = @$; }
3426 | WHILE '(' expression_error statement { $$ = MkWhileStmt($3, $4); $$.loc = @$; }
3427 | WHILE '(' ')' statement { yyerror(); $$ = MkWhileStmt(null, $4); $$.loc = @$; }
3429 | DO statement WHILE '(' expression ')' ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3430 | DO statement WHILE '(' expression_error ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3432 | FOR '(' expression_statement expression_statement ')' statement { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; }
3433 | FOR '(' expression_statement ')' statement { yyerror(); $$ = MkForStmt($3, null, null, $5); $$.loc = @$; }
3434 | FOR '(' expression_statement expression_statement expression ')' statement { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; }
3435 | FOR '(' expression_statement expression_statement expression_error statement { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; }
3436 | FOR '(' ')' statement { yyerror(); $$ = MkForStmt(null, null, null, $4); $$.loc = @$; }
3438 | FOR '(' identifier ':' expression ')' statement { $$ = MkForEachStmt($3, $5, null, $7); $$.loc = @$; }
3439 | FOR '(' identifier ':' expression ';' expression ')' statement { $$ = MkForEachStmt($3, $5, $7, $9); $$.loc = @$; }
3442 iteration_statement_error:
3443 FOR '(' error { $$ = MkForStmt(null, null, null, null); $$.loc = @$; } |
3444 FOR '(' expression_error error { $$ = MkForStmt(MkExpressionStmt($3), null, null, null); $$.forStmt.init.loc = @3; $$.loc = @$; } |
3445 FOR '(' expression_statement error { $$ = MkForStmt($3, null, null, null); $$.loc = @$; } |
3446 FOR '(' expression_statement expression_error error { $$ = MkForStmt($3, MkExpressionStmt($4), null, null); $$.loc = @$; $$.forStmt.check.loc = @4; } |
3447 /* Useless rules due to conflicts
3448 FOR '(' expression_statement expression_statement error { $$ = MkForStmt($3, $4, null, null); $$.loc = @$; } |
3450 FOR '(' expression_statement expression_statement expression_error { $$ = MkForStmt($3, $4, $5, null); $$.loc = @$; } |
3451 FOR '(' expression_statement expression_statement ')' statement_error { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; } |
3452 FOR '(' expression_statement expression_statement expression ')' statement_error { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; } |
3453 FOR '(' expression_statement expression_statement expression_error statement_error { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; } |
3455 DO statement WHILE '(' expression ')' { yyerror(); $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3456 DO statement WHILE '(' expression { yyerror(); $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3457 DO statement WHILE '(' expression_error { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3458 DO statement WHILE '(' { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3459 DO statement WHILE { yyerror(); $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3460 DO statement { yyerror(); $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3461 DO { yyerror(); $$ = MkDoWhileStmt(null, null); $$.loc = @$; } |
3464 WHILE error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3465 /* Useless rules due to conflicts
3466 WHILE '(' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3468 WHILE '(' ')' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3469 WHILE '(' expression_error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3470 /* Useless rules due to conflicts
3471 WHILE '(' expression_error error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3473 WHILE '(' expression ')' statement_error { $$ = MkWhileStmt($3, $5); $$.loc = @$; } |
3474 WHILE '(' expression_error statement_error { $$ = MkWhileStmt($3, $4 ); $$.loc = @$; }
3478 GOTO identifier ';' { $$ = MkGotoStmt($2); $$.loc = @$; }
3479 | CONTINUE ';' { $$ = MkContinueStmt(); $$.loc = @$; }
3480 | BREAK ';' { $$ = MkBreakStmt(); $$.loc = @$; }
3481 | RETURN ';' { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc = @2; }
3482 | RETURN expression ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3483 | RETURN expression_error ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3484 | RETURN anon_instantiation_expression ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3485 | RETURN anon_instantiation_expression_error ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3488 jump_statement_error:
3489 RETURN expression_error { $$ = MkReturnStmt($2); $$.loc = @$; } |
3490 RETURN anon_instantiation_expression_error { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; } |
3491 RETURN { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc.start = exp.loc.end = @1.end; } |
3492 GOTO { $$ = MkGotoStmt(null); $$.loc = @$; }
3495 /*************************************************************************************/
3497 function_definition:
3498 external_guess_declaration_specifiers declarator_function declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3499 | external_guess_declaration_specifiers declarator_function compound_statement
3500 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3501 | external_guess_declaration_specifiers declarator_function_type_ok declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3502 | external_guess_declaration_specifiers declarator_function_type_ok compound_statement
3503 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3505 | declarator_function declaration_list compound_statement { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; }
3506 | declarator_function compound_statement { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$;}
3508 function_definition_error:
3509 external_guess_declaration_specifiers declarator_function declaration_list compound_statement_error { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; $$.loc.end = $4.loc.end; }
3510 | external_guess_declaration_specifiers declarator_function compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3511 | 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; }
3512 | external_guess_declaration_specifiers declarator_function_type_ok compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3513 | declarator_function declaration_list compound_statement_error { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3514 | declarator_function compound_statement_error { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
3518 STRING_LITERAL { $$ = CopyString(yytext); }
3519 | string_literal STRING_LITERAL
3521 int len1 = strlen($1);
3522 int len2 = strlen(yytext);
3523 $$ = new byte[len1-1 + len2-1 + 1];
3524 memcpy($$, $1, len1-1);
3525 memcpy($$ + len1-1, yytext+1, len2);
3530 external_declaration:
3531 function_definition { $$ = MkExternalFunction($1); $$.loc = @$; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3533 { $$ = MkExternalClass($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3535 | external_guess_declaration_specifiers class
3536 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; FreeList($1, FreeSpecifier); }
3538 | external_guess_declaration
3539 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3540 | IMPORT string_literal { $$ = MkExternalImport($2, normalImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3541 | IMPORT STATIC string_literal { $$ = MkExternalImport($3, staticImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3542 | IMPORT identifier string_literal
3544 bool isRemote = !strcmp($2.string, "remote");
3545 $$ = MkExternalImport($3, isRemote ? remoteImport : normalImport, (declMode != defaultAccess) ? declMode : privateAccess);
3552 | ';' { $$ = null; }
3554 | declaration_mode function_definition { $$ = MkExternalFunction($2); $$.loc = @$; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3555 | declaration_mode class
3556 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3557 | declaration_mode external_guess_declaration { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3558 | declaration_mode IMPORT string_literal { $$ = MkExternalImport($3, normalImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; structDeclMode = declMode = defaultDeclMode; }
3559 | declaration_mode IMPORT STATIC string_literal { $$ = MkExternalImport($4, staticImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; structDeclMode = declMode = defaultDeclMode; }
3560 | declaration_mode IMPORT identifier string_literal
3562 bool isRemote = !strcmp($3.string, "remote");
3563 $$ = MkExternalImport($4, isRemote ? remoteImport : normalImport, ($1 != defaultAccess) ? $1 : privateAccess);
3566 structDeclMode = declMode = defaultDeclMode;
3570 | declaration_mode ':' { defaultDeclMode = $1; $$ = null; }
3571 | STATIC ':' { defaultDeclMode = staticAccess; $$ = null; }
3572 | NAMESPACE identifier { $$ = MkExternalNameSpace($2); $$.loc = @$; }
3573 | NAMESPACE strict_type { $$ = MkExternalNameSpace(MkIdentifier($2.name)); FreeSpecifier($2); $$.loc = @$; }
3574 | dbtable_definition { $$ = MkExternalDBTable($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3575 | declaration_mode dbtable_definition { $$ = MkExternalDBTable($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3578 external_declaration_error:
3579 class_error { yyerror(); $$ = MkExternalClass($1); $$.loc = $1.loc; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3580 | external_guess_declaration_specifiers class_error
3583 FreeList($1, FreeSpecifier);
3584 $$ = MkExternalClass($2);
3586 $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess;
3587 structDeclMode = declMode = defaultDeclMode;
3589 | function_definition_error { yyerror(); $$ = MkExternalFunction($1); $$.loc = $1.loc; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3591 | declaration_mode class_error { yyerror(); $$ = MkExternalClass($2); $$.loc = $2.loc; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3592 | declaration_mode function_definition_error { yyerror(); $$ = MkExternalFunction($2); $$.loc = $2.loc; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3594 | external_guess_declaration_error
3595 { yyerror(); $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3596 | declaration_mode external_guess_declaration_error { yyerror(); $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3599 translation_unit_error:
3600 external_declaration_error { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3601 | translation_unit external_declaration_error { $$ = $1; ListAdd($1, $2); }
3602 | translation_unit_error external_declaration_error { $$ = $1; ListAdd($1, $2); }
3603 | translation_unit error
3604 | translation_unit_error error
3608 external_declaration { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3609 | translation_unit external_declaration { $$ = $1; ListAdd($1, $2); }
3610 | translation_unit_error class
3611 { External _class = MkExternalClass($2); $$ = $1; ListAdd($1, _class); _class.loc = @2; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3612 | translation_unit_error declaration_mode class
3613 { External _class = MkExternalClass($3); $$ = $1; ListAdd($1, _class); _class.loc = @3; $3.declMode = ($2 != defaultAccess) ? $2 : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3618 | translation_unit_error
3619 | { ast = MkList(); }
3623 DBTABLE string_literal identifier '{' dbfield_definition_list '}' { Symbol symbol = DeclClassAddNameSpace($3._class, $3.string); FreeIdentifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3624 | DBTABLE string_literal strict_type '{' dbfield_definition_list '}' { Symbol symbol = DeclClass($3.nsSpec, $3.name); FreeSpecifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3625 | DBTABLE string_literal '{' dbfield_definition_list '}' { $$ = MkDBTableDef($2, null, $4); }
3629 guess_declaration_specifiers identifier string_literal ';' { $$ = MkDBFieldEntry(MkTypeName($1, null), $2, $3); }
3633 identifier { $$ = MkDBIndexItem($1, ascending); }
3634 | '>' identifier { $$ = MkDBIndexItem($2, descending); }
3635 | '<' identifier { $$ = MkDBIndexItem($2, ascending); }
3639 dbindex_item { $$ = MkList(); ListAdd($$, $1); }
3640 | dbindex_item_list ',' dbindex_item { ListAdd($1, $3); }
3644 DBINDEX dbindex_item_list ';' { $$ = MkDBIndexEntry($2, null); }
3645 | DBINDEX dbindex_item_list identifier ';' { $$ = MkDBIndexEntry($2, $3); }
3648 dbfield_definition_list:
3649 dbfield_entry { $$ = MkList(); ListAdd($$, $1); }
3650 | dbindex_entry { $$ = MkList(); ListAdd($$, $1); }
3651 | dbfield_definition_list dbfield_entry { ListAdd($1, $2); }
3652 | dbfield_definition_list dbindex_entry { ListAdd($1, $2); }
3656 DATABASE_OPEN '(' assignment_expression ',' assignment_expression ')' { $$ = MkExpDBOpen($3, $5); }
3660 DBFIELD '(' string_literal ',' identifier ')' { $$ = MkExpDBField($3, $5); }
3664 DBINDEX '(' string_literal ',' identifier ')' { $$ = MkExpDBIndex($3, $5); }
3668 DBTABLE '(' string_literal ')' { $$ = MkExpDBTable($3); }