4 #define YYSIZE_T size_t
5 #define YYLTYPE Location
9 # define YYLLOC_DEFAULT(Current, Rhs, N) \
10 (Current).start = (Rhs)[1].start; \
11 (Current).end = (Rhs)[N].end;
15 extern File fileInput;
21 bool deleteWatchable = false;
23 #define MAX_STRUCT_LEVELS 256
24 AccessMode memberAccessStack[MAX_STRUCT_LEVELS];
25 int defaultMemberAccess = -1;
27 #define POP_DEFAULT_ACCESS if(defaultMemberAccess > -1) defaultMemberAccess--;
29 #define C89_DECL_WARNING $"eC expects all declarations to precede statements in the block (C89 style)\n"
30 #define CASE_LABELED_STMT_WARNING $"labeled statement directly within a case statement\n"
40 SpecifierType specifierType;
47 Enumerator enumerator;
48 Declarator declarator;
50 Initializer initializer;
51 InitDeclarator initDeclarator;
53 Declaration declaration;
55 FunctionDefinition function;
63 Instantiation instance;
64 MembersInit membersInit;
65 MemberInit memberInit;
66 ClassFunction classFunction;
67 ClassDefinition _class;
72 PropertyWatch propertyWatch;
73 TemplateParameter templateParameter;
74 TemplateArgument templateArgument;
75 TemplateDatatype templateDatatype;
77 DBTableEntry dbtableEntry;
78 DBIndexItem dbindexItem;
79 DBTableDef dbtableDef;
84 %type <symbol> class_decl
85 %type <specifierType> struct_or_union
86 %type <i> unary_operator assignment_operator
87 %type <declMode> member_access declaration_mode
88 %type <id> identifier enum_decl
89 %type <exp> primary_expression primary_expression_error postfix_expression unary_expression cast_expression
90 multiplicative_expression additive_expression shift_expression
91 relational_expression relational_expression_smaller_than equality_expression and_expression
92 exclusive_or_expression inclusive_or_expression logical_and_expression
93 logical_or_expression conditional_expression assignment_expression
94 constant_expression constant_expression_error
95 anon_instantiation_expression anon_instantiation_expression_error i18n_string
96 postfix_expression_error unary_expression_error cast_expression_error
97 multiplicative_expression_error additive_expression_error shift_expression_error
98 relational_expression_error equality_expression_error and_expression_error
99 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
100 logical_or_expression_error conditional_expression_error assignment_expression_error
101 simple_primary_expression constant
102 common_unary_expression common_unary_expression_error
103 database_open dbfield dbindex dbtable
105 //simple_unary_expression simple_unary_expression_error
106 // simple_postfix_expression simple_postfix_expression_error
108 %type <list> argument_expression_list expression expression_anon_inst expression_anon_inst_error enumerator_list type_qualifier_list
109 struct_declarator_list struct_declaration_list
110 declaration_specifiers identifier_list identifier_list_error initializer_list init_declarator_list
111 parameter_list parameter_list_error parameter_type_list parameter_type_list_error declaration_list declaration_list_error statement_list statement_list_error
112 translation_unit members_initialization_list members_initialization_list_coloned members_initialization_list_error data_member_initialization_list data_member_initialization_list_coloned
113 default_property_list data_member_initialization_list_error
114 expression_error init_declarator_list_error argument_expression_list_error default_property_list_error struct_declaration_list_error
115 translation_unit_error
116 guess_declaration_specifiers
117 external_guess_declaration_specifiers external_guess_declaration_specifiers_error
118 specifier_qualifier_list guess_specifier_qualifier_list
119 _inheritance_specifiers inheritance_specifiers property_specifiers
120 new_specifiers renew_specifiers asm_field_list
121 property_watch_list watch_property_list
122 dbindex_item_list dbfield_definition_list
123 template_arguments_list template_parameters_list attribs_list
125 %type <asmField> asm_field
126 %type <specifier> storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier class_specifier class_specifier_error
127 struct_or_union_specifier_compound struct_or_union_specifier_nocompound ext_storage type strict_type guess_type enum_class strict_type_specifier struct_class
128 struct_or_union_specifier_compound_error struct_class_error struct_decl
129 enum_specifier_compound_error enum_class_error external_storage_class_specifier
130 base_strict_type struct_head struct_entry
131 %type <enumerator> enumerator
132 %type <declarator> declarator direct_declarator direct_abstract_declarator abstract_declarator
133 direct_abstract_declarator_noarray abstract_declarator_noarray
134 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction
135 direct_declarator_function_type_ok declarator_nofunction_type_ok direct_declarator_nofunction_type_ok declarator_function_type_ok direct_declarator_function_error_type_ok
136 direct_declarator_function_start_type_ok direct_declarator_type_ok declarator_type_ok declarator_function_error_type_ok
137 %type <pointer> pointer
138 %type <initializer> initializer initializer_error initializer_condition initializer_condition_error
139 %type <initDeclarator> init_declarator init_declarator_error
140 %type <typeName> type_name guess_type_name parameter_declaration parameter_declaration_error
141 %type <stmt> statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
142 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
143 iteration_statement_error statement_error asm_statement
144 stopwatching watch_definition firewatchers
146 %type <declaration> declaration declaration_error external_guess_declaration external_guess_declaration_error
147 %type <function> function_definition function_definition_error
148 %type <external> external_declaration external_declaration_error
150 %type <instance> instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error guess_instantiation_named guess_instantiation_named_error external_guess_instantiation_named
151 instantiation_anon instantiation_anon_error
152 %type <memberInit> data_member_initialization data_member_initialization_error default_property default_property_error
153 %type <classFunction> class_function_definition class_function_definition_error class_function_definition_start
154 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
155 constructor_function_definition_start destructor_function_definition_start
156 %type <classFunction> instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
157 %type <_class> class class_error class_head
158 %type <classDef> struct_declaration struct_declaration_error
159 %type <string> string_literal base_strict_type_name attribute_word
160 %type <extDecl> ext_decl
161 %type <attrib> attrib
162 %type <attribute> attribute
163 %type <prop> property property_start property_body class_property class_property_start class_property_body
164 %type <propertyWatch> property_watch self_watch_definition
166 %type <templateParameter> template_parameter template_type_parameter template_identifier_parameter template_expression_parameter
167 %type <templateArgument> template_argument template_type_argument template_identifier_argument template_expression_argument
168 %type <templateDatatype> template_datatype
170 %type <dbtableEntry> dbindex_entry dbfield_entry
171 %type <dbindexItem> dbindex_item
172 %type <dbtableDef> dbtable_definition
173 %type <context> compound_start class_entry
175 %token IDENTIFIER CONSTANT STRING_LITERAL SIZEOF
176 %token PTR_OP INC_OP DEC_OP LEFT_OP RIGHT_OP LE_OP GE_OP EQ_OP NE_OP
177 %token AND_OP OR_OP MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN
178 %token SUB_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN
179 %token XOR_ASSIGN OR_ASSIGN TYPE_NAME
181 %token TYPEDEF EXTERN STATIC AUTO REGISTER
182 %token CHAR SHORT INT UINT INT64 INT128 LONG SIGNED UNSIGNED FLOAT DOUBLE CONST VOLATILE VOID VALIST
183 %token STRUCT UNION ENUM ELLIPSIS
185 %token CASE DEFAULT IF SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN
189 %token CLASS THISCLASS CLASS_NAME
190 %token PROPERTY SETPROP GETPROP NEWOP RENEW DELETE EXT_DECL EXT_STORAGE IMPORT DEFINE VIRTUAL ATTRIB
191 %token PUBLIC PRIVATE
192 %token TYPED_OBJECT ANY_OBJECT _INCREF EXTENSION ASM TYPEOF
193 %token WATCH STOPWATCHING FIREWATCHERS WATCHABLE CLASS_DESIGNER CLASS_NO_EXPANSION CLASS_FIXED ISPROPSET
194 %token CLASS_DEFAULT_PROPERTY PROPERTY_CATEGORY CLASS_DATA CLASS_PROPERTY SUBCLASS NAMESPACE
195 %token NEW0OP RENEW0 VAARG
196 %token DBTABLE DBFIELD DBINDEX DATABASE_OPEN
197 %token ALIGNOF ATTRIB_DEP __ATTRIB
198 %token BOOL _BOOL _COMPLEX _IMAGINARY RESTRICT THREAD
199 %token WIDE_STRING_LITERAL
200 %token BUILTIN_OFFSETOF
202 %destructor { FreeIdentifier($$); } identifier
203 %destructor { FreePointer($$); } pointer
204 %destructor { FreeExpression($$); } primary_expression primary_expression_error postfix_expression unary_expression cast_expression
205 multiplicative_expression additive_expression shift_expression
206 relational_expression equality_expression and_expression
207 exclusive_or_expression inclusive_or_expression logical_and_expression
208 logical_or_expression conditional_expression assignment_expression
209 constant_expression constant_expression_error
210 postfix_expression_error unary_expression_error cast_expression_error
211 multiplicative_expression_error additive_expression_error shift_expression_error
212 relational_expression_error equality_expression_error and_expression_error
213 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
214 logical_or_expression_error conditional_expression_error assignment_expression_error i18n_string
215 %destructor { FreeSpecifier($$); } storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier class_specifier class_specifier_error
216 struct_or_union_specifier_compound struct_or_union_specifier_nocompound ext_storage type strict_type guess_type enum_class strict_type_specifier struct_class
217 struct_or_union_specifier_compound_error struct_class_error struct_decl
218 enum_specifier_compound_error enum_class_error external_storage_class_specifier
219 base_strict_type struct_head struct_entry
220 %destructor { FreeEnumerator($$); } enumerator
221 %destructor { FreeDeclarator($$); } declarator direct_declarator direct_abstract_declarator abstract_declarator
222 direct_abstract_declarator_noarray abstract_declarator_noarray
223 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction
224 direct_declarator_function_type_ok declarator_nofunction_type_ok direct_declarator_nofunction_type_ok declarator_function_type_ok direct_declarator_function_error_type_ok
225 direct_declarator_function_start_type_ok direct_declarator_type_ok declarator_type_ok declarator_function_error_type_ok
227 %destructor { FreeInitializer($$); } initializer initializer_error initializer_condition initializer_condition_error
228 %destructor { FreeInitDeclarator($$); } init_declarator init_declarator_error
229 %destructor { FreeTypeName($$); } type_name guess_type_name parameter_declaration parameter_declaration_error
230 %destructor { FreeStatement($$); } statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
231 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
232 iteration_statement_error statement_error
234 %destructor { FreeDeclaration($$); } declaration
235 %destructor { FreeFunction($$); } function_definition function_definition_error
236 %destructor { FreeExternal($$); } external_declaration external_declaration_error
238 %destructor { FreeInstance($$); } instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error
240 %destructor { FreeMemberInit($$); } data_member_initialization data_member_initialization_error default_property default_property_error
242 %destructor { FreeClassFunction($$); } class_function_definition class_function_definition_error class_function_definition_start
243 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
244 constructor_function_definition_start destructor_function_definition_start
245 instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
246 %destructor { Context ctx = curContext; PopContext(ctx); FreeContext(ctx); delete ctx; } class_entry
247 %destructor { Context ctx = curContext; PopContext(ctx); FreeContext(ctx); delete ctx; } class_decl
248 %destructor { FreeClass($$); } class class_error class_head
249 %destructor { FreeClassDef($$); } struct_declaration struct_declaration_error
250 %destructor { delete $$; } string_literal attribute_word base_strict_type_name
251 %destructor { FreeProperty($$); } property
253 %destructor { FreeList($$, FreeExpression); } argument_expression_list expression expression_error argument_expression_list_error
254 %destructor { FreeList($$, FreeEnumerator); } enumerator_list
255 %destructor { FreeList($$, FreeSpecifier); } type_qualifier_list specifier_qualifier_list declaration_specifiers inheritance_specifiers _inheritance_specifiers external_guess_declaration_specifiers external_guess_declaration_specifiers_error
256 guess_declaration_specifiers guess_specifier_qualifier_list
257 %destructor { FreeList($$, FreeDeclarator); } struct_declarator_list
258 %destructor { FreeList($$, FreeDeclaration); } declaration_list declaration_list_error
259 %destructor { FreeList($$, FreeInitializer); } initializer_list
260 %destructor { FreeList($$, FreeInitDeclarator); } init_declarator_list init_declarator_list_error
261 %destructor { FreeList($$, FreeTypeName); } parameter_list parameter_list_error parameter_type_list parameter_type_list_error identifier_list identifier_list_error
262 %destructor { FreeList($$, FreeStatement); } statement_list statement_list_error
263 %destructor { if($$ != ast) FreeList($$, FreeExternal); } translation_unit translation_unit_error
264 %destructor { FreeList($$, FreeClassDef); } struct_declaration_list struct_declaration_list_error
265 %destructor { FreeList($$, FreeMemberInit); } default_property_list default_property_list_error data_member_initialization_list data_member_initialization_list_coloned data_member_initialization_list_error
266 %destructor { FreeList($$, FreeMembersInit); } members_initialization_list members_initialization_list_coloned members_initialization_list_error
267 %destructor { PopContext($$); FreeContext($$); delete $$; } compound_start
268 %destructor { FreeTemplateParameter($$); } template_parameter template_type_parameter template_identifier_parameter template_expression_parameter
269 %destructor { FreeTemplateArgument($$); } template_argument template_type_argument template_identifier_argument template_expression_argument
270 %destructor { FreeTemplateDataType($$); } template_datatype
271 %destructor { FreeList($$, FreeTemplateParameter); } template_parameters_list
272 %destructor { FreeList($$, FreeTemplateArgument); } template_arguments_list
273 %destructor { } declaration_mode
274 %destructor { FreeAttrib($$); } attrib
275 %destructor { FreeExtDecl($$); } ext_decl
276 %destructor { FreeAttribute($$); } attribute
277 %destructor { FreeList($$, FreeAttribute); } attribs_list
287 _DeclClass($1._class, $1.string);
291 fileInput.Seek(@1.start.pos, start);
292 resetScannerPos(&@1.start);
297 YY_STACK_PRINT (yyss, yyssp);
300 YY_STACK_PRINT (yyss, yyssp);
307 _DeclClass($1._class, $1.string);
311 fileInput.Seek(@1.start.pos, start);
312 resetScannerPos(&@1.start);
317 YY_STACK_PRINT (yyss, yyssp);
320 YY_STACK_PRINT (yyss, yyssp);
324 /* | identifier '*' '<' template_arguments_list '>'
326 _DeclClass($1._class, $1.string);
327 fileInput.Seek(@1.start.pos, start);
328 resetScannerPos(&@1.start);
333 YY_STACK_PRINT (yyss, yyssp);
336 YY_STACK_PRINT (yyss, yyssp);
342 strict_type { $$ = $1; }
343 | identifier identifier
348 $$ = MkSpecifierName($1.string);
354 _DeclClass($1._class, $1.string);
359 fileInput.Seek(@1.start.pos, start);
360 resetScannerPos(&@1.start);
365 YY_STACK_PRINT (yyss, yyssp);
368 YY_STACK_PRINT (yyss, yyssp);
371 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
372 Compiler_Error($"Not a type: %s\n", $1.string);
373 yylloc = tmpLoc; $2.badID = $1;
381 _DeclClass($1._class, $1.string);
382 fileInput.Seek(@1.start.pos, start);
383 resetScannerPos(&@1.start);
388 YY_STACK_PRINT (yyss, yyssp);
391 YY_STACK_PRINT (yyss, yyssp);
395 /* | strict_type '<' template_arguments_list '>' { $$ = $1; }
396 | identifier identifier '<' template_arguments_list '>'
399 _DeclClass($1._class, $1.string);
403 fileInput.Seek(@1.start.pos, start);
404 resetScannerPos(&@1.start);
409 YY_STACK_PRINT (yyss, yyssp);
412 YY_STACK_PRINT (yyss, yyssp);
415 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
416 Compiler_Error($"Not a type: %s\n", $1.string);
417 yylloc = tmpLoc; $2.badID = $1;
423 TYPE_NAME { $$ = MkSpecifierName(yytext); }
426 base_strict_type_name:
427 TYPE_NAME { $$ = CopyString(yytext); }
431 | base_strict_type '<' template_arguments_list '>' { $$ = $1; SetClassTemplateArgs($$, $3); $$.loc = @$; }
432 | base_strict_type '<' template_arguments_list RIGHT_OP
435 SetClassTemplateArgs($$, $3);
439 fileInput.Seek(@4.end.pos, start);
440 resetScannerPos(&@4.end);
444 /* | identifier '<' template_arguments_list '>' */
445 /*| identifier '<' error
447 _DeclClass($1._class, $1.string);
451 fileInput.Seek(@1.start.pos, start);
452 resetScannerPos(&@1.start);
457 YY_STACK_PRINT (yyss, yyssp);
460 YY_STACK_PRINT (yyss, yyssp);
463 YY_STACK_PRINT (yyss, yyssp);
466 /* $$ = MkSpecifierNameArgs($1.string, $3); $$.loc = @$; FreeIdentifier($1); */
470 class_function_definition_start:
471 guess_declaration_specifiers declarator_function_type_ok
472 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; }
473 | declarator_function
474 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; }
477 constructor_function_definition_start:
478 guess_declaration_specifiers '(' ')'
479 { $$ = MkClassFunction($1, null, null, null); $$.isConstructor = true; $$.loc = @$; }
482 destructor_function_definition_start:
483 '~' guess_declaration_specifiers '(' ')'
484 { $$ = MkClassFunction($2, null, null, null); $$.isDestructor = true; $$.loc = @$; }
487 virtual_class_function_definition_start:
488 VIRTUAL guess_declaration_specifiers declarator_function_type_ok
489 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; }
490 | VIRTUAL declarator_function
491 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; }
494 class_function_definition_start_error:
495 guess_declaration_specifiers declarator_function_error_type_ok
496 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; }
497 | declarator_function_error
498 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; }
501 virtual_class_function_definition_start_error:
502 VIRTUAL guess_declaration_specifiers declarator_function_error_type_ok
503 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; }
504 | VIRTUAL declarator_function_error
505 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; }
508 class_function_definition:
509 class_function_definition_start compound_statement
510 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
511 | virtual_class_function_definition_start compound_statement
512 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
513 | virtual_class_function_definition_start ';'
514 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
515 | constructor_function_definition_start compound_statement
516 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
517 | destructor_function_definition_start compound_statement
518 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
521 | class_function_definition_start ';'
522 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
524 // Added this to fix attrib not working after function pointer declarations
525 | class_function_definition_start attrib ';'
529 $1.declarator = MkStructDeclarator($1.declarator, null);
530 $1.declarator.structDecl.attrib = $2;
532 ProcessClassFunctionBody($1, null);
537 class_function_definition_error:
538 class_function_definition_start compound_statement_error
539 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
540 | class_function_definition_start_error
541 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
542 | virtual_class_function_definition_start compound_statement_error
543 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
544 | virtual_class_function_definition_start_error
545 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
546 | virtual_class_function_definition_start_error ';'
547 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
550 // In Instances, return type is required to distinguish from calling the function
551 instance_class_function_definition_start:
552 declaration_specifiers declarator_function_type_ok
553 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; }
554 | declaration_specifiers declarator_nofunction_type_ok
555 { $$ = MkClassFunction($1, null, MkDeclaratorFunction($2, null), null); $$.loc = @$; }
558 instance_class_function_definition_start_error:
559 declaration_specifiers declarator_function_error_type_ok
560 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; }
563 instance_class_function_definition:
564 instance_class_function_definition_start compound_statement
565 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
568 instance_class_function_definition_error:
569 instance_class_function_definition_start compound_statement_error
570 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; $$.loc.end.charPos++; $$.loc.end.pos++;}
571 | instance_class_function_definition_start_error
572 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
573 | instance_class_function_definition_start
574 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
577 data_member_initialization:
578 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
579 | initializer_condition { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
582 data_member_initialization_error:
583 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
584 | postfix_expression '=' error
586 $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy()));
587 $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = $$.initializer.loc.end = @2.end;
589 fileInput.Seek(@2.end.pos, start);
591 resetScannerPos(&@2.end);
595 | initializer_condition_error { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
598 data_member_initialization_list:
599 data_member_initialization { $$ = MkList(); ListAdd($$, $1); }
600 | data_member_initialization_list ',' data_member_initialization
601 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
602 | data_member_initialization_list_error ',' data_member_initialization
603 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
606 data_member_initialization_list_error:
607 data_member_initialization_error { $$ = MkList(); ListAdd($$, $1); }
608 | data_member_initialization_list ',' data_member_initialization_error
609 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
610 | data_member_initialization_list_error ',' data_member_initialization_error
611 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
613 | data_member_initialization_list ',' error
614 { ((MemberInit)$1->last).loc.end = @2.end;
616 Initializer dummy = MkInitializerAssignment(MkExpDummy());
617 MemberInit memberInit = MkMemberInit(null, dummy);
618 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
619 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
620 ListAdd($1, memberInit);
625 data_member_initialization_list_error ',' error
626 { ((MemberInit)$1->last).loc.end = @2.end;
628 Initializer dummy = MkInitializerAssignment(MkExpDummy());
629 MemberInit memberInit = MkMemberInit(null, dummy);
630 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
631 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
632 ListAdd($1, memberInit);
638 Initializer dummy = MkInitializerAssignment(MkExpDummy());
639 MemberInit memberInit = MkMemberInit(null, dummy);
640 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.start;
641 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.start;
644 ListAdd($$, memberInit);
646 dummy = MkInitializerAssignment(MkExpDummy());
647 memberInit = MkMemberInit(null, dummy);
648 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.end;
649 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.end;
650 ListAdd($$, memberInit);
654 data_member_initialization_list_coloned:
655 data_member_initialization_list ';'
656 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; $$ = $1; }
657 | data_member_initialization_list_error ';'
658 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; $$ = $1; }
661 members_initialization_list_coloned:
662 data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($1); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
663 | instance_class_function_definition { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
664 | members_initialization_list_error data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; $$ = $1; }
665 | members_initialization_list_error instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
666 | members_initialization_list_coloned data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; $$ = $1; }
667 | members_initialization_list_coloned instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
668 | members_initialization_list_error ';'
669 | members_initialization_list_coloned ';'
671 MembersInit members = (MembersInit)$$->last;
672 if(members.type == dataMembersInit)
673 members.loc.end = @$.end;
676 MembersInit members = MkMembersInitList(MkList());
677 ListAdd($$, members);
682 | ';' { MembersInit members = MkMembersInitList(MkList()); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
685 members_initialization_list:
686 members_initialization_list_coloned
687 | data_member_initialization_list { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
688 | members_initialization_list_coloned data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
689 | members_initialization_list_error data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
692 members_initialization_list_error:
693 instance_class_function_definition_error { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
694 | members_initialization_list instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
695 | members_initialization_list_error instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
696 | members_initialization_list_coloned instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
697 | members_initialization_list_coloned data_member_initialization_list_error { ListAdd($$, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
698 | data_member_initialization_list_error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
699 | data_member_initialization_list error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @2; }
703 instantiation_named_error '}'
704 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
705 | instantiation_named_error error '}'
706 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
709 instantiation_named_error:
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 error
713 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
714 | declaration_specifiers identifier '{' members_initialization_list
715 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
716 | declaration_specifiers identifier '{'
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++; }
718 | declaration_specifiers identifier '{' error
719 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
724 declaration_specifiers identifier '{' members_initialization_list '}'
725 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
726 | declaration_specifiers identifier '{' members_initialization_list_error '}'
727 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
728 | declaration_specifiers identifier '{' '}'
729 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
732 instantiation_named_error:
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 error
736 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
737 | declaration_specifiers identifier '{' members_initialization_list
738 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
739 | declaration_specifiers identifier '{'
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++; }
741 | declaration_specifiers identifier '{' error
742 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
747 guess_instantiation_named:
748 guess_instantiation_named_error '}'
749 { $$.loc = @$; $$.insideLoc.end = @2.start; }
750 | guess_instantiation_named_error error '}'
751 { $$.loc = @$; $$.insideLoc.end = @2.start; }
754 guess_instantiation_named_error:
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 error
758 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
759 | guess_declaration_specifiers identifier '{' members_initialization_list
760 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
761 | guess_declaration_specifiers identifier '{'
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++; }
763 | guess_declaration_specifiers identifier '{' error
764 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
768 guess_instantiation_named:
769 guess_declaration_specifiers identifier '{' members_initialization_list '}'
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 '{' members_initialization_list_error '}'
772 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
773 | guess_declaration_specifiers identifier '{' '}'
774 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
777 guess_instantiation_named_error:
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 error
781 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
782 | guess_declaration_specifiers identifier '{' members_initialization_list
783 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
784 | guess_declaration_specifiers identifier '{'
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++; }
786 | guess_declaration_specifiers identifier '{' error
787 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
791 external_guess_instantiation_named:
792 external_guess_declaration_specifiers identifier '{' members_initialization_list '}'
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 '{' members_initialization_list_error '}'
795 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
796 | external_guess_declaration_specifiers identifier '{' '}'
797 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
800 instantiation_unnamed:
801 instantiation_unnamed_error '}'
802 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
803 | instantiation_unnamed_error error '}'
804 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
807 instantiation_unnamed_error:
808 strict_type '{' members_initialization_list
809 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
810 | identifier '{' members_initialization_list
811 { Location tmpLoc = yylloc; yylloc = @1;
812 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; FreeIdentifier($1); }
814 | strict_type '{' members_initialization_list_error
815 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
817 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
818 | strict_type '{' members_initialization_list error
819 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
820 | strict_type '{' error
821 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
825 | identifier '{' members_initialization_list_error
826 { Location tmpLoc = yylloc; yylloc = @1;
827 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); }
829 { Location tmpLoc = yylloc; yylloc = @1;
830 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); }
831 | identifier '{' members_initialization_list error
832 { Location tmpLoc = yylloc; yylloc = @1;
833 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); }
834 | identifier '{' error
835 { Location tmpLoc = yylloc; yylloc = @1;
836 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); }
840 instantiation_unnamed:
841 strict_type '{' members_initialization_list '}'
842 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
843 | strict_type '{' members_initialization_list error '}'
844 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; }
845 | strict_type '{' members_initialization_list_error '}'
846 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
847 | strict_type '{' '}'
848 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start;}
849 | strict_type '{' error '}'
850 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start;}
853 | identifier '{' members_initialization_list '}'
854 { Location tmpLoc = yylloc; yylloc = @1;
855 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
856 | identifier '{' members_initialization_list_error '}'
857 { Location tmpLoc = yylloc; yylloc = @1;
858 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
859 | identifier '{' members_initialization_list error '}'
861 $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; FreeIdentifier($1); }
863 { Location tmpLoc = yylloc; yylloc = @1;
864 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start; FreeIdentifier($1);}
865 | identifier '{' error '}'
866 { Location tmpLoc = yylloc; yylloc = @1;
867 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
871 instantiation_unnamed_error:
872 strict_type '{' members_initialization_list_error
873 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
875 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
876 | strict_type '{' members_initialization_list error
877 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
878 | strict_type '{' error
879 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
883 | identifier '{' members_initialization_list_error
884 { Location tmpLoc = yylloc; yylloc = @1;
885 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); }
887 { Location tmpLoc = yylloc; yylloc = @1;
888 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); }
889 | identifier '{' members_initialization_list error
890 { Location tmpLoc = yylloc; yylloc = @1;
891 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); }
892 | identifier '{' error
893 { Location tmpLoc = yylloc; yylloc = @1;
894 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); }
899 instantiation_anon_error '}'
900 { $$.loc = @$; $$.insideLoc.end = @2.start; }
901 | instantiation_anon_error error '}'
902 { $$.loc = @$; $$.insideLoc.end = @2.start; }
905 instantiation_anon_error:
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++; }
908 | '{' members_initialization_list error
909 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
911 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
913 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
914 | '{' members_initialization_list
915 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
920 '{' members_initialization_list '}'
921 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
922 | '{' members_initialization_list error '}'
923 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @4.start; }
924 | '{' members_initialization_list_error '}'
925 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
927 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.start;}
929 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start;}
932 instantiation_anon_error:
933 '{' members_initialization_list_error
934 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
936 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
937 | '{' members_initialization_list error
938 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
940 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
945 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; }
948 default_property_error:
949 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; }
950 | postfix_expression '=' error { $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; $$.initializer.loc.end = @2.end; }
951 | postfix_expression error { $$ = MkMemberInitExp($1, null); $$.loc = @$; $$.realLoc = @$; }
954 default_property_list:
955 default_property { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
956 | default_property_list ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
957 | default_property_list_error ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
960 default_property_list_error:
961 default_property_error { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
962 | default_property_list ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
963 | default_property_list_error ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
964 | default_property_list error
968 PROPERTY property_specifiers identifier '{'
969 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
971 | PROPERTY property_specifiers abstract_declarator identifier '{'
972 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
974 | PROPERTY property_specifiers '{'
975 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
977 | PROPERTY property_specifiers abstract_declarator '{'
978 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
981 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
986 | property_body SETPROP compound_statement
988 | property_body GETPROP compound_statement
990 | property_body ISPROPSET compound_statement
991 { $1.issetStmt = $3; }
992 | property_body WATCHABLE
993 { $1.isWatchable = true; }
994 | property_body PROPERTY_CATEGORY i18n_string
995 { $1.category = $3; }
999 property_body '}' { $1.loc.end = @2.end; $$ = $1; }
1002 class_property_start:
1003 CLASS_PROPERTY property_specifiers identifier '{'
1004 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
1006 | CLASS_PROPERTY property_specifiers abstract_declarator identifier '{'
1007 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
1009 | CLASS_PROPERTY property_specifiers '{'
1010 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
1012 | CLASS_PROPERTY property_specifiers abstract_declarator '{'
1013 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
1015 | CLASS_PROPERTY error '{'
1016 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
1019 class_property_body:
1020 class_property_start
1021 | class_property_body SETPROP compound_statement
1022 { $1.setStmt = $3; }
1023 | class_property_body GETPROP compound_statement
1024 { $1.getStmt = $3; }
1028 class_property_body '}' { $1.loc.end = @2.end; }
1031 watch_property_list:
1033 { $$ = MkListOne($1); }
1034 | watch_property_list identifier
1035 { ListAdd($1, $2); }
1039 watch_property_list compound_statement
1040 { $$ = MkPropertyWatch($1, $2); }
1041 | DELETE compound_statement
1042 { $$ = MkDeleteWatch($2); }
1045 property_watch_list:
1047 { $$ = MkListOne($1); }
1048 | property_watch_list property_watch
1049 { ListAdd($1, $2); }
1052 self_watch_definition:
1053 WATCH '(' watch_property_list ')' compound_statement
1054 { $$ = MkPropertyWatch($3, $5); }
1058 WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1059 { $$ = MkWatchStmt(null, $3, $6); }
1060 | assignment_expression '.' WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1061 { $$ = MkWatchStmt($1, $5, $8); }
1065 STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1066 { $$ = MkStopWatchingStmt(null, $3, $5); }
1067 | assignment_expression '.' STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1068 { $$ = MkStopWatchingStmt($1, $5, $7); }
1069 | STOPWATCHING '(' assignment_expression ')'
1070 { $$ = MkStopWatchingStmt(null, $3, null); }
1071 | assignment_expression '.' STOPWATCHING '(' assignment_expression ')'
1072 { $$ = MkStopWatchingStmt($1, $5, null); }
1077 { $$ = MkFireWatchersStmt(null, null); }
1078 | FIREWATCHERS watch_property_list
1079 { $$ = MkFireWatchersStmt(null, $2); }
1080 | postfix_expression '.' FIREWATCHERS
1081 { $$ = MkFireWatchersStmt($1, null); }
1082 | assignment_expression '.' FIREWATCHERS watch_property_list
1083 { $$ = MkFireWatchersStmt($1, $4); }
1087 struct_declaration_error ';' { $$ = $1; $$.loc.end = @2.end; }
1088 | default_property_list ';' { $$ = MkClassDefDefaultProperty($1); if($1->last) ((MemberInit)$1->last).loc.end = @2.start; $$.loc = @$; }
1089 | class_function_definition { $$ = MkClassDefFunction($1); $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1090 | property { $$ = MkClassDefProperty($1); $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1091 | member_access class_function_definition { $$ = MkClassDefFunction($2); $$.loc = @$; $$.memberAccess = $1; }
1092 | member_access property { $$ = MkClassDefProperty($2); $$.loc = @$; $$.memberAccess = $1; }
1093 | class_property { $$ = MkClassDefClassProperty($1); $$.loc = @$; }
1094 | WATCHABLE { $$ = null; deleteWatchable = true; }
1095 | CLASS_NO_EXPANSION { $$ = MkClassDefNoExpansion(); }
1096 | CLASS_FIXED { $$ = MkClassDefFixed(); }
1097 | CLASS_PROPERTY '(' identifier ')' '=' initializer_condition ';' { $$ = MkClassDefClassPropertyValue($3, $6); $$.loc = @$; }
1099 | ';' { $$ = null; }
1100 | member_access ':' { memberAccessStack[defaultMemberAccess] = $1; if(defaultMemberAccess == 0) { $$ = MkClassDefMemberAccess(); $$.memberAccess = $1; $$.loc = @$; } else $$ = null; }
1102 | member_access '(' identifier ')' { $$ = MkClassDefAccessOverride($1, $3); $$.loc = @$; }
1105 struct_declaration_error:
1106 class_function_definition_error { $$ = MkClassDefFunction($1); $$.loc = $1.loc; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1108 // Moved all these in here without the ';'
1109 | guess_declaration_specifiers { $$ = MkClassDefDeclaration(MkStructDeclaration($1, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1110 | guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefDeclaration(MkStructDeclaration($1, $2, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1111 | member_access guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefDeclaration(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1112 | member_access guess_declaration_specifiers { $$ = MkClassDefDeclaration(MkStructDeclaration($2, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1113 | member_access instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1114 | member_access guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1115 | CLASS_DATA guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefClassData(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; }
1116 | self_watch_definition { $$ = MkClassDefPropertyWatch($1); $$.loc = @$; }
1117 | CLASS_DESIGNER identifier { $$ = MkClassDefDesigner($2.string); FreeIdentifier($2); }
1118 | CLASS_DESIGNER strict_type { $$ = MkClassDefDesigner($2.name); FreeSpecifier($2); }
1119 | CLASS_DEFAULT_PROPERTY identifier { $$ = MkClassDefDesignerDefaultProperty($2); }
1120 | instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1121 | guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1122 | default_property_list { $$ = MkClassDefDefaultProperty($1); if($1->last) ((MemberInit)$1->last).loc.end = @1.end; $$.loc = @$; }
1124 | guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1125 | instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1126 // | guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1127 // | instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1129 | member_access class_function_definition_error { $$ = MkClassDefFunction($2); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = $1; }
1130 | member_access guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1131 | member_access instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1132 // | member_access guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1133 // | member_access instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1135 | default_property_list_error { $$ = MkClassDefDefaultProperty($1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
1138 struct_declaration_list:
1139 struct_declaration { $$ = MkList(); ListAdd($$, $1); }
1140 | struct_declaration_list struct_declaration { $$ = $1; ListAdd($1, $2); }
1141 | struct_declaration_list_error struct_declaration { $$ = $1; ListAdd($1, $2); }
1144 struct_declaration_list_error:
1145 struct_declaration_error { yyerror(); $$ = MkList(); ListAdd($$, $1); }
1146 | struct_declaration_list error
1147 | struct_declaration_list_error error
1148 | struct_declaration_list struct_declaration_error { yyerror(); $$ = $1; ListAdd($$, $2); }
1149 | struct_declaration_list_error struct_declaration_error { $$ = $1; ListAdd($$, $2); }
1153 guess_declaration_specifiers { $$ = MkTemplateDatatype($1, null); }
1154 | guess_declaration_specifiers abstract_declarator { $$ = MkTemplateDatatype($1, $2); }
1155 // | identifier { $$ = MkTemplateDatatype(MkListOne(MkSpecifierName($1.string)), null); FreeIdentifier($1); }
1158 template_type_argument:
1159 // template_datatype { $$ = MkTemplateTypeArgument($1); }
1161 // Explicitly copied the rules here to handle:
1162 // ast.ec: Map<List<Location>> intlStrings { };
1164 // LinkList.ec: class LinkList<bool circ = false>
1166 guess_declaration_specifiers { $$ = MkTemplateTypeArgument(MkTemplateDatatype($1, null)); }
1167 | guess_declaration_specifiers abstract_declarator { $$ = MkTemplateTypeArgument(MkTemplateDatatype($1, $2)); }
1170 template_type_parameter:
1171 CLASS identifier { $$ = MkTypeTemplateParameter($2, null, null); }
1172 | CLASS identifier '=' template_type_argument { $$ = MkTypeTemplateParameter($2, null, $4); }
1173 | CLASS identifier ':' template_datatype { $$ = MkTypeTemplateParameter($2, $4, null); }
1174 | CLASS identifier ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter($2, $4, $6); }
1175 | CLASS base_strict_type_name { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, null); delete $2; }
1176 | CLASS base_strict_type_name '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, $4); }
1177 | CLASS base_strict_type_name ':' template_datatype { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, null); }
1178 | CLASS base_strict_type_name ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, $6); }
1181 template_identifier_argument:
1182 identifier { $$ = MkTemplateIdentifierArgument($1); }
1185 template_identifier_parameter:
1186 identifier { $$ = MkIdentifierTemplateParameter($1, dataMember, null); }
1187 | identifier '=' template_identifier_argument { $$ = MkIdentifierTemplateParameter($1, dataMember, $3); }
1190 template_expression_argument:
1191 shift_expression /*constant_expression*/ { $$ = MkTemplateExpressionArgument($1); }
1194 template_expression_parameter:
1196 template_datatype identifier { $$ = MkExpressionTemplateParameter($2, $1, null); }
1197 | template_datatype identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($2, $1, $4); }
1199 guess_declaration_specifiers identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($2, MkTemplateDatatype($1, null), $4); }
1200 | guess_declaration_specifiers abstract_declarator identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($3, MkTemplateDatatype($1, $2), $5); }
1204 template_type_parameter
1205 | template_identifier_parameter
1206 | template_expression_parameter
1209 template_parameters_list:
1210 template_parameter { $$ = MkList(); ListAdd($$, $1); }
1211 | template_parameters_list ',' template_parameter { $$ = $1; ListAdd($1, $3); }
1215 template_expression_argument
1216 | template_identifier_argument
1217 | template_type_argument
1218 | identifier '=' template_expression_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1219 | identifier '=' template_identifier_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1220 | identifier '=' template_type_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1221 /*| template_datatype '=' template_expression_argument
1224 if($1.specifiers && $1.specifiers->first)
1226 Specifier spec = $1.specifiers->first;
1227 if(spec.type == nameSpecifier)
1228 $$.name = MkIdentifier(spec.name);
1230 FreeTemplateDataType($1);
1233 | template_datatype '=' template_identifier_argument
1236 if($1.specifiers && $1.specifiers->first)
1238 Specifier spec = $1.specifiers->first;
1239 if(spec.type == nameSpecifier)
1240 $$.name = MkIdentifier(spec.name);
1242 FreeTemplateDataType($1);
1245 | template_datatype '=' template_type_argument
1248 if($1.specifiers && $1.specifiers->first)
1250 Specifier spec = $1.specifiers->first;
1251 if(spec.type == nameSpecifier)
1252 $$.name = MkIdentifier(spec.name);
1254 FreeTemplateDataType($1);
1259 template_arguments_list:
1260 template_argument { $$ = MkList(); ListAdd($$, $1); }
1261 | template_arguments_list ',' template_argument { $$ = $1; ListAdd($1, $3); }
1267 if(curContext != globalContext)
1268 PopContext(curContext);
1273 class_entry identifier { (void)$1; $$ = DeclClassAddNameSpace($2._class, $2.string); FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1274 | class_entry base_strict_type
1276 (void)$1; $$ = DeclClass($2.nsSpec, $2.name);
1279 ++defaultMemberAccess;
1280 memberAccessStack[defaultMemberAccess] = privateAccess;
1282 | identifier class_entry identifier { (void)$2; $$ = DeclClassAddNameSpace($3._class, $3.string); FreeIdentifier($1); FreeIdentifier($3); $$.nameLoc = @3; $$.isRemote = true; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1283 | identifier class_entry base_strict_type { (void)$2; $$ = DeclClass($3.nsSpec, $3.name); FreeIdentifier($1); $$.nameLoc = @3; $$.isRemote = true; FreeSpecifier($3); memberAccessStack[++defaultMemberAccess] = privateAccess; }
1285 | class_entry identifier '<' template_parameters_list '>' { (void)$1; $$ = DeclClassAddNameSpace($2._class, $2.string); $$.templateParams = $4; FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1286 | class_entry base_strict_type '<' template_parameters_list '>'
1288 (void)$1; $$ = DeclClass($2.nsSpec, $2.name);
1289 $$.templateParams = $4;
1292 ++defaultMemberAccess;
1293 memberAccessStack[defaultMemberAccess] = privateAccess;
1295 | 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; }
1296 | 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; }
1306 // Added this for unit classes...
1309 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$;
1311 PopContext(curContext);
1314 | class_decl '{' '}'
1316 $$ = MkClass($1, null, MkList()); $$.blockStart = @2; $$.loc = @$;
1318 PopContext(curContext);
1320 | class_head '{' '}'
1322 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$;
1324 PopContext(curContext);
1327 | class_entry identifier ';'
1329 (void)$1; $$ = MkClass(DeclClassAddNameSpace($2._class, $2.string), null, null); FreeIdentifier($2);
1331 PopContext(curContext);
1333 | class_entry type ';'
1335 (void)$1; $$ = MkClass(DeclClass($2.nsSpec, $2.name), null, null); FreeSpecifier($2);
1337 PopContext(curContext);
1342 class_decl ':' inheritance_specifiers
1344 $$ = MkClass($1, $3, null);
1349 class_decl '{' struct_declaration_list_error
1351 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;
1353 PopContext(curContext);
1355 | class_head '{' struct_declaration_list_error
1357 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;
1359 PopContext(curContext);
1361 | class_decl '{' struct_declaration_list
1363 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;
1365 PopContext(curContext);
1367 | class_head '{' struct_declaration_list
1369 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;
1371 PopContext(curContext);
1373 | class_decl '{' error
1375 $$ = MkClass($1, null, MkList()); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;
1377 PopContext(curContext);
1379 | class_head '{' error
1381 $$ = $1; $$.definitions = MkList(); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;
1383 PopContext(curContext);
1387 /**** EXPRESSIONS ********************************************************************/
1391 { $$ = MkIdentifier(yytext); $$.loc = @1; }
1395 simple_primary_expression
1396 | '(' expression ')'
1397 { $$ = MkExpBrackets($2); $$.loc = @$; }
1401 string_literal { $$ = MkExpString($1); delete $1; $$.loc = @$; }
1402 | '$' string_literal { $$ = MkExpIntlString($2, null); delete $2; $$.loc = @$; }
1403 | '$' string_literal '.' string_literal { $$ = MkExpIntlString($4, $2); delete $2; delete $4; $$.loc = @$; }
1407 CONSTANT { $$ = MkExpConstant(yytext); $$.loc = @$; }
1410 simple_primary_expression:
1411 identifier { $$ = MkExpIdentifier($1); $$.loc = @$; }
1412 | instantiation_unnamed { $$ = MkExpInstance($1); $$.loc = @$; }
1413 | EXTENSION '(' compound_statement ')' { $$ = MkExpExtensionCompound($3); $$.loc = @$; }
1414 | EXTENSION '(' expression ')' { $$ = MkExpExtensionExpression($3); $$.loc = @$; }
1415 | EXTENSION '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, $5); $$.loc = @$; }
1416 | EXTENSION '(' type_name ')' '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, MkInitializerAssignment(MkExpExtensionInitializer($6, $8))); $$.loc = @$; }
1417 | constant identifier
1419 char * constant = $1.constant;
1420 int len = strlen(constant);
1421 if(constant[len-1] == '.')
1423 constant[len-1] = 0;
1424 $$ = MkExpMember($1, $2);
1430 | constant { $$ = $1; }
1432 | WIDE_STRING_LITERAL { $$ = MkExpWideString(yytext); $$.loc = @$; }
1433 | '(' ')' { Expression exp = MkExpDummy(); exp.loc.start = @1.end; exp.loc.end = @2.start; $$ = MkExpBrackets(MkListOne(exp)); $$.loc = @$; yyerror(); }
1434 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1435 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1436 | NEWOP new_specifiers '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1437 | NEWOP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1438 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1439 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1440 | NEW0OP new_specifiers '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1441 | NEW0OP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1442 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1443 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1444 | RENEW constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1445 | RENEW constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1446 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1447 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1448 | RENEW0 constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1449 | RENEW0 constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1450 | CLASS '(' declaration_specifiers ')' { $$ = MkExpClass($3, null); $$.loc = @$; }
1451 | CLASS '(' declaration_specifiers abstract_declarator ')' { $$ = MkExpClass($3, $4); $$.loc = @$; }
1452 | CLASS '(' identifier ')' { $$ = MkExpClass(MkListOne(MkSpecifierName($3.string)), null); FreeIdentifier($3); $$.loc = @$; }
1453 | VAARG '(' assignment_expression ',' type_name ')' { $$ = MkExpVaArg($3, $5); $$.loc = @$; }
1455 | CLASS_DATA '(' identifier ')' { $$ = MkExpClassData($3); $$.loc = @$; }
1461 | '[' argument_expression_list /*expression*/ ']' { $$ = MkExpArray($2); $$.loc = @$; }
1462 | '[' ']' { $$ = MkExpArray(null); $$.loc = @$; }
1465 anon_instantiation_expression:
1466 instantiation_anon { $$ = MkExpInstance($1); $$.loc = @$; }
1469 anon_instantiation_expression_error:
1470 instantiation_anon_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1473 primary_expression_error:
1474 '(' expression { yyerror(); $$ = MkExpBrackets($2); $$.loc = @$; }
1475 | '(' expression_error { $$ = MkExpBrackets($2); $$.loc = @$; }
1481 | postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1482 | postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1483 | postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1484 | postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1485 | 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; }
1486 | postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1487 | postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1488 | postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1489 | postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1491 | postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1492 | postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1493 | postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1494 | postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1495 | postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1496 | postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1497 | postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1498 | postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1501 /*simple_postfix_expression:
1502 simple_primary_expression
1504 | simple_postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1505 | simple_postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1506 | simple_postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1507 | simple_postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1508 | 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; }
1509 | simple_postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1510 | simple_postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1511 | simple_postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1512 | simple_postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1514 | simple_postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1515 | simple_postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1516 | simple_postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1517 | simple_postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1518 | simple_postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1519 | simple_postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1520 | simple_postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1521 | simple_postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1524 argument_expression_list:
1525 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1526 | anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1527 | argument_expression_list ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1528 | argument_expression_list ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1531 argument_expression_list_error:
1532 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
1533 | anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
1534 | argument_expression_list ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
1535 | argument_expression_list ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
1536 | argument_expression_list ',' { Expression exp = MkExpDummy(); yyerror(); exp.loc.start = @2.end; exp.loc.end = @2.end; $$ = $1; ListAdd($1, exp); }
1539 common_unary_expression:
1540 INC_OP unary_expression { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1541 | DEC_OP unary_expression { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1542 | unary_operator cast_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1543 | unary_operator anon_instantiation_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1544 //| SIZEOF '(' unary_expression ')' { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1545 | SIZEOF unary_expression { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1546 | SIZEOF '(' guess_type_name ')' { $$ = MkExpTypeSize($3); $$.loc = @$; }
1547 | SIZEOF '(' CLASS type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1548 | SIZEOF '(' CLASS guess_type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1550 //| ALIGNOF '(' unary_expression ')' { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1551 | ALIGNOF unary_expression { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1552 | ALIGNOF '(' guess_type_name ')' { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1554 | BUILTIN_OFFSETOF '(' guess_type_name ',' identifier ')' { $$ = MkExpOffsetOf($3, $5); $$.loc = @$; }
1558 common_unary_expression
1559 | postfix_expression
1563 common_unary_expression
1564 | simple_postfix_expression
1574 | DELETE { $$ = DELETE; }
1575 | _INCREF { $$ = _INCREF; }
1580 | '(' type_name ')' cast_expression { $$ = MkExpCast($2, $4); $$.loc = @$; }
1583 multiplicative_expression:
1585 | multiplicative_expression '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1586 | multiplicative_expression '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1587 | multiplicative_expression '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1588 | multiplicative_expression_error '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1589 | multiplicative_expression_error '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1590 | multiplicative_expression_error '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1593 additive_expression:
1594 multiplicative_expression
1595 | additive_expression '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1596 | additive_expression '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1597 | additive_expression_error '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1598 | additive_expression_error '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1603 | shift_expression LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1604 | shift_expression RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1605 | shift_expression_error LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1606 | shift_expression_error RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1609 relational_expression_smaller_than:
1610 relational_expression '<'
1617 relational_expression:
1619 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression { skipErrors = false; $$ = MkExpOp($1, '<', $2/*$3*/); $$.loc = @$; }
1620 | relational_expression '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1621 | relational_expression LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1622 | relational_expression GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1623 | relational_expression_error '<' shift_expression { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1624 | relational_expression_error '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1625 | relational_expression_error LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1626 | relational_expression_error GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1630 : relational_expression
1631 | equality_expression EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1632 | equality_expression NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1633 | equality_expression_error EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1634 | equality_expression_error NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1636 | equality_expression EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1637 | equality_expression NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1638 | equality_expression_error EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1639 | equality_expression_error NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1643 : equality_expression
1644 | and_expression '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1645 | and_expression_error '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1647 | and_expression '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1648 | and_expression_error '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1651 exclusive_or_expression
1653 | exclusive_or_expression '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1654 | exclusive_or_expression_error '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1656 | exclusive_or_expression '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1657 | exclusive_or_expression_error '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1660 inclusive_or_expression
1661 : exclusive_or_expression
1662 | inclusive_or_expression '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1663 | inclusive_or_expression_error '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1665 | inclusive_or_expression '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1666 | inclusive_or_expression_error '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1669 logical_and_expression
1670 : inclusive_or_expression
1671 | logical_and_expression AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1672 | logical_and_expression_error AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1675 logical_or_expression
1676 : logical_and_expression
1677 | logical_or_expression OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1678 | logical_or_expression_error OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1681 conditional_expression
1682 : logical_or_expression
1683 | logical_or_expression '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1684 | logical_or_expression '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1685 | logical_or_expression_error '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1686 | logical_or_expression_error '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1688 | logical_or_expression '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1689 | logical_or_expression '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1690 | logical_or_expression_error '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1691 | logical_or_expression_error '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1693 | logical_or_expression '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1694 | logical_or_expression '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1695 | logical_or_expression_error '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1696 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1698 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1699 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1700 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1701 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1704 assignment_expression:
1705 conditional_expression
1706 | unary_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1707 | unary_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1708 | conditional_expression assignment_operator assignment_expression { Compiler_Error($"l-value expected\n"); $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1709 | conditional_expression_error assignment_operator assignment_expression { Compiler_Error($"l-value expected\n"); $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1711 | unary_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1712 | unary_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1713 | conditional_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1714 | conditional_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1717 assignment_operator:
1719 | MUL_ASSIGN { $$ = MUL_ASSIGN; }
1720 | DIV_ASSIGN { $$ = DIV_ASSIGN; }
1721 | MOD_ASSIGN { $$ = MOD_ASSIGN; }
1722 | ADD_ASSIGN { $$ = ADD_ASSIGN; }
1723 | SUB_ASSIGN { $$ = SUB_ASSIGN; }
1724 | LEFT_ASSIGN { $$ = LEFT_ASSIGN; }
1725 | RIGHT_ASSIGN { $$ = RIGHT_ASSIGN; }
1726 | AND_ASSIGN { $$ = AND_ASSIGN; }
1727 | XOR_ASSIGN { $$ = XOR_ASSIGN; }
1728 | OR_ASSIGN { $$ = OR_ASSIGN; }
1732 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1733 | expression ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1734 | expression_error ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1735 | expression_error ')'
1738 expression_anon_inst:
1739 anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1740 | expression ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1741 | expression_error ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1744 postfix_expression_error:
1745 primary_expression_error
1746 | error { $$ = MkExpDummy(); $$.loc = @$; /*printf("Sorry, didn't mean that syntax error\n");*/ }
1747 | postfix_expression error
1748 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1750 | postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1751 | postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1753 | postfix_expression '(' argument_expression_list { yyerror(); $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1754 | postfix_expression '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1755 /* Useless rules due to conflicts
1756 | postfix_expression '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; $$.call.argLoc.end.charPos++;}
1757 | postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1759 | postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1761 | 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++;}
1762 /* Useless rules due to conflicts
1763 | 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++;}
1764 | postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1766 | postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1769 /*simple_postfix_expression_error:
1770 error { $$ = MkExpDummy(); $$.loc = @$; }
1771 | simple_postfix_expression error
1772 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1774 | simple_postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1775 | simple_postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1777 | 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++;}
1778 | 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++;}
1779 // Useless rules due to conflicts
1780 //| 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++;}
1781 //| simple_postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1783 | simple_postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1785 | 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++;}
1786 // Useless rules due to conflicts
1787 //| 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++;}
1788 //| simple_postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1789 | simple_postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1793 common_unary_expression_error:
1794 INC_OP unary_expression_error { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1795 | DEC_OP unary_expression_error { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1796 | unary_operator cast_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1797 | unary_operator anon_instantiation_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1798 //| SIZEOF '(' unary_expression_error { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1799 | SIZEOF unary_expression_error { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1800 | SIZEOF '(' guess_type_name ')' error { $$ = MkExpTypeSize($3); $$.loc = @$; }
1801 | SIZEOF '(' CLASS type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1802 | SIZEOF '(' CLASS guess_type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1803 //| ALIGNOF '(' unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1804 | ALIGNOF unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1805 | ALIGNOF '(' guess_type_name ')' error { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1808 unary_expression_error:
1809 common_unary_expression_error
1810 | postfix_expression_error
1813 /*simple_unary_expression_error:
1814 common_unary_expression_error
1815 | simple_postfix_expression_error
1818 cast_expression_error:
1819 unary_expression_error
1820 | '(' type_name ')' cast_expression_error { $$ = MkExpCast($2, $4); $$.loc = @$; }
1823 multiplicative_expression_error:
1824 cast_expression_error
1825 | multiplicative_expression '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1826 | multiplicative_expression '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1827 | multiplicative_expression '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1828 | multiplicative_expression_error '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1829 | multiplicative_expression_error '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1830 | multiplicative_expression_error '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1833 additive_expression_error:
1834 multiplicative_expression_error
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 '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1840 /* Useless rules due to conflicts
1841 | additive_expression '-' 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 = @$; }
1847 | additive_expression_error '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1848 /* Useless rules due to conflicts
1849 | additive_expression_error '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1853 shift_expression_error:
1854 additive_expression_error
1855 | shift_expression LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1856 | shift_expression RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1857 | shift_expression_error LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1858 | shift_expression_error RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1861 relational_expression_error:
1862 shift_expression_error
1863 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression_error
1865 if($1.type == identifierExp)
1867 _DeclClass($1.identifier._class, $1.identifier.string);
1869 // printf("Declaring Class %s\n", $1.identifier.string);
1875 fileInput.Seek(@1.start.pos, start);
1876 resetScannerPos(&@1.start);
1881 YY_STACK_PRINT (yyss, yyssp);
1885 YY_STACK_PRINT (yyss, yyssp);
1889 YY_STACK_PRINT (yyss, yyssp);
1893 YY_STACK_PRINT (yyss, yyssp);
1901 $$ = MkExpOp($1, '<', $2);
1906 | relational_expression '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1907 | relational_expression LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1908 | relational_expression GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1909 | relational_expression_error '<' shift_expression_error { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1910 | relational_expression_error '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1911 | relational_expression_error LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1912 | relational_expression_error GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1915 equality_expression_error:
1916 relational_expression_error
1917 | equality_expression EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1918 | equality_expression NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1919 | equality_expression_error EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1920 | equality_expression_error NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1921 /* Useless rules due to conflicts
1922 | equality_expression EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1923 | equality_expression NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1924 | equality_expression_error EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1925 | equality_expression_error NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1927 | equality_expression EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1928 | equality_expression NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1929 | equality_expression_error EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1930 | equality_expression_error NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1933 and_expression_error:
1934 equality_expression_error
1935 | and_expression '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1936 | and_expression_error '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1938 | and_expression '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1939 | and_expression_error '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1942 exclusive_or_expression_error:
1943 and_expression_error
1944 | exclusive_or_expression '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1945 | exclusive_or_expression_error '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1947 | exclusive_or_expression '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1948 | exclusive_or_expression_error '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1951 inclusive_or_expression_error:
1952 exclusive_or_expression_error
1953 | inclusive_or_expression '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1954 | inclusive_or_expression_error '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1956 | inclusive_or_expression '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1957 | inclusive_or_expression_error '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1960 logical_and_expression_error:
1961 inclusive_or_expression_error
1962 | logical_and_expression AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1963 | logical_and_expression_error AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1966 logical_or_expression_error:
1967 logical_and_expression_error
1968 | logical_or_expression OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1969 | logical_or_expression_error OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1972 conditional_expression_error:
1973 logical_or_expression_error
1974 | logical_or_expression '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1975 | logical_or_expression '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1976 | logical_or_expression_error '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1977 | logical_or_expression_error '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1978 | logical_or_expression '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1979 | logical_or_expression '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1980 | logical_or_expression_error '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1981 | logical_or_expression_error '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1983 | logical_or_expression '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1984 | logical_or_expression '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1985 | logical_or_expression_error '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1986 | logical_or_expression_error '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1987 | logical_or_expression '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1988 | logical_or_expression '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1989 | logical_or_expression_error '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1990 | logical_or_expression_error '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
1992 | logical_or_expression '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1993 | logical_or_expression '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1994 | logical_or_expression_error '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1995 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1997 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1998 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1999 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2000 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2002 | logical_or_expression '?' ':'
2005 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy());
2007 ((Expression)$$.cond.exp->last).loc = @2;
2008 $$.cond.elseExp.loc = @3;
2010 | logical_or_expression_error '?' ':'
2012 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @3;
2014 | logical_or_expression '?'
2017 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2019 | logical_or_expression_error '?'
2021 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2025 assignment_expression_error:
2026 conditional_expression_error
2027 | unary_expression assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2028 /* Useless rules due to conflicts
2029 | unary_expression assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2031 | unary_expression_error assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2032 /* Useless rules due to conflicts
2033 | unary_expression_error assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2036 | unary_expression assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2037 | unary_expression_error assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2041 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
2042 | assignment_expression error { $$ = MkList(); ListAdd($$, $1); }
2043 | expression ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2044 | expression_error ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2045 /* Useless rules due to conflicts
2046 | expression ',' error
2047 | expression_error ',' error
2050 | expression expression { yyerror(); $$ = $1; FreeList($2, FreeExpression); }
2051 | expression_error expression { $$ = $1; FreeList($2, FreeExpression); }
2052 | expression expression_error { $$ = $1; FreeList($2, FreeExpression); }
2055 expression_anon_inst_error:
2056 anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
2057 | anon_instantiation_expression error { $$ = MkList(); ListAdd($$, $1); }
2058 | expression ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2059 | expression_error ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2063 constant_expression: conditional_expression;
2065 constant_expression_error: conditional_expression_error;
2067 /**** TYPES **************************************************************************/
2068 storage_class_specifier:
2069 TYPEDEF { $$ = MkSpecifier(TYPEDEF); }
2070 | EXTERN { $$ = MkSpecifier(EXTERN); }
2071 | STATIC { $$ = MkSpecifier(STATIC); }
2072 | THREAD { $$ = MkSpecifier(THREAD); }
2073 | AUTO { $$ = MkSpecifier(AUTO); }
2074 | REGISTER { $$ = MkSpecifier(REGISTER); }
2075 | RESTRICT { $$ = MkSpecifier(RESTRICT); }
2078 external_storage_class_specifier:
2079 TYPEDEF { $$ = MkSpecifier(TYPEDEF); structDeclMode = declMode = defaultAccess; }
2080 | EXTERN { $$ = MkSpecifier(EXTERN); }
2081 | STATIC { $$ = MkSpecifier(STATIC); structDeclMode = declMode = staticAccess; }
2082 | THREAD { $$ = MkSpecifier(THREAD); }
2083 | AUTO { $$ = MkSpecifier(AUTO); }
2084 | REGISTER { $$ = MkSpecifier(REGISTER); }
2085 | RESTRICT { $$ = MkSpecifier(RESTRICT); }
2089 identifier { $$ = MkEnumerator($1, null); }
2090 | identifier '=' constant_expression { $$ = MkEnumerator($1, $3); }
2091 | identifier '=' constant_expression_error { $$ = MkEnumerator($1, $3); }
2095 enumerator { $$ = MkList(); ListAdd($$, $1); }
2096 | enumerator_list ',' enumerator { $$ = $1; ListAdd($1, $3); }
2097 | enumerator_list ','
2101 ENUM { memberAccessStack[++defaultMemberAccess] = publicAccess; }
2104 enum_specifier_nocompound:
2105 enum_specifier identifier { $$ = MkEnum($2, null); POP_DEFAULT_ACCESS }
2106 | enum_specifier strict_type { $$ = MkEnum(MkIdentifier($2.name), null); POP_DEFAULT_ACCESS }
2109 enum_specifier_compound:
2110 enum_specifier_compound_error '}' { $$.loc = @$; POP_DEFAULT_ACCESS $$ = $1; }
2111 | enum_specifier identifier '{' '}' { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2112 | enum_specifier strict_type '{' '}' { $$ = MkEnum(MkIdentifier($2.name), null); FreeSpecifier($2); $$.loc = @$; POP_DEFAULT_ACCESS }
2115 enum_specifier_compound_error:
2116 enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2117 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2119 | enum_specifier identifier '{' enumerator_list { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2120 | enum_specifier identifier '{' enumerator_list error { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2121 | enum_specifier identifier '{' error { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2122 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2123 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2125 | enum_specifier strict_type '{' enumerator_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2126 | enum_specifier strict_type '{' enumerator_list error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2127 | enum_specifier strict_type '{' error { $$ = MkEnum(MkIdentifier($2.name), null); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2128 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2129 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2131 | enum_specifier identifier '{' enumerator_list ';' { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2132 | enum_specifier strict_type '{' enumerator_list ';' { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2136 enum_specifier identifier { $$ = $2; if(declMode) DeclClassAddNameSpace($2._class, $2.string); }
2137 | enum_specifier strict_type { $$ = MkIdentifier($2.name); if(declMode) DeclClass($2.nsSpec, $2.name); FreeSpecifier($2); }
2141 enum_class_error '}' { $$ = $1; $$.loc = @$; }
2142 | enum_decl ':' inheritance_specifiers '{' '}' { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2143 | enum_decl '{' '}' { $$ = MkEnum($1, null); POP_DEFAULT_ACCESS }
2147 enum_decl ':' inheritance_specifiers '{' enumerator_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2148 | enum_decl ':' inheritance_specifiers '{' enumerator_list error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2149 | enum_decl ':' inheritance_specifiers '{' error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2150 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2151 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2152 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2153 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2154 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2155 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list_error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2157 | enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2158 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2160 | enum_decl '{' enumerator_list { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2161 | enum_decl '{' enumerator_list error { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2162 | enum_decl '{' error { $$ = MkEnum($1, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2163 | enum_decl '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2164 | enum_decl '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2166 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2167 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2168 | enum_decl ':' inheritance_specifiers '{' error ';' { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2169 | enum_decl '{' enumerator_list ';' { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2177 class_specifier_error:
2179 | struct_class_error
2183 ext_decl { $$ = MkSpecifierExtended($1); }
2187 CONST { $$ = MkSpecifier(CONST); }
2188 | VOLATILE { $$ = MkSpecifier(VOLATILE); }
2189 | ext_storage { $$ = $1; }
2193 type_qualifier_list:
2194 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2195 | type_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2199 VOID { $$ = MkSpecifier(VOID); }
2200 | CHAR { $$ = MkSpecifier(CHAR); }
2201 | SHORT { $$ = MkSpecifier(SHORT); }
2202 | INT { $$ = MkSpecifier(INT); }
2203 | UINT { $$ = MkSpecifier(UINT); }
2204 | INT64 { $$ = MkSpecifier(INT64); }
2205 | INT128 { $$ = MkSpecifier(INT128); }
2206 | VALIST { $$ = MkSpecifier(VALIST); }
2207 | LONG { $$ = MkSpecifier(LONG); }
2208 | FLOAT { $$ = MkSpecifier(FLOAT); }
2209 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2210 | SIGNED { $$ = MkSpecifier(SIGNED); }
2211 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2212 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2213 | struct_or_union_specifier_nocompound
2214 | enum_specifier_nocompound
2216 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2217 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2218 | SUBCLASS '(' identifier ')' { _DeclClass($3._class, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2219 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2220 | TYPED_OBJECT { $$ = MkSpecifier(TYPED_OBJECT); }
2221 | ANY_OBJECT { $$ = MkSpecifier(ANY_OBJECT); }
2222 | _BOOL { $$ = MkSpecifier(_BOOL); }
2223 | BOOL { $$ = MkSpecifier(BOOL); }
2224 | _COMPLEX { $$ = MkSpecifier(_COMPLEX); }
2225 | _IMAGINARY { $$ = MkSpecifier(_IMAGINARY); }
2228 strict_type_specifier:
2229 VOID { $$ = MkSpecifier(VOID); }
2230 | CHAR { $$ = MkSpecifier(CHAR); }
2231 | SHORT { $$ = MkSpecifier(SHORT); }
2232 | INT { $$ = MkSpecifier(INT); }
2233 | UINT { $$ = MkSpecifier(UINT); }
2234 | INT64 { $$ = MkSpecifier(INT64); }
2235 | INT128 { $$ = MkSpecifier(INT128); }
2236 | VALIST { $$ = MkSpecifier(VALIST); }
2237 | LONG { $$ = MkSpecifier(LONG); }
2238 | FLOAT { $$ = MkSpecifier(FLOAT); }
2239 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2240 | SIGNED { $$ = MkSpecifier(SIGNED); }
2241 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2242 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2243 | struct_or_union_specifier_nocompound
2244 | enum_specifier_nocompound
2246 | _BOOL { $$ = MkSpecifier(_BOOL); }
2247 | BOOL { $$ = MkSpecifier(BOOL); }
2248 | _COMPLEX { $$ = MkSpecifier(_COMPLEX); }
2249 | _IMAGINARY { $$ = MkSpecifier(_IMAGINARY); }
2250 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2251 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2252 | SUBCLASS '(' identifier ')' { _DeclClass($3._class, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2253 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2256 // TESTING declarator_nofunction here... For function declarations
2259 declarator_nofunction_type_ok
2260 { $$ = MkStructDeclarator($1, null); $$.loc = @$; }
2261 | declarator_nofunction_type_ok attrib
2262 { $$ = MkStructDeclarator($1, null); $$.structDecl.attrib = $2; $$.loc = @$; }
2263 | ':' constant_expression
2264 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2265 | declarator_nofunction_type_ok ':' constant_expression
2266 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2267 | declarator_nofunction_type_ok ':' constant_expression ':' constant_expression
2268 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2269 | ':' constant_expression_error
2270 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2271 | declarator_nofunction_type_ok ':' constant_expression_error
2272 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2273 | declarator_nofunction_type_ok ':' constant_expression ':' constant_expression_error
2274 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2275 | declarator_nofunction_type_ok ':' constant_expression_error ':' constant_expression_error
2276 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2277 | declarator_nofunction_type_ok ':' constant_expression_error ':' constant_expression
2278 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2281 struct_declarator_list:
2282 struct_declarator { $$ = MkList(); ListAdd($$, $1); }
2283 | struct_declarator_list ',' struct_declarator { $$ = $1; ListAdd($1, $3); }
2287 struct_or_union identifier
2289 $$ = MkStructOrUnion($1, $2, null);
2290 $$.addNameSpace = true;
2291 $$.ctx = PushContext();
2293 | struct_or_union base_strict_type
2295 $$ = MkStructOrUnion($1, MkIdentifier($2.name), null);
2296 $$.ctx = PushContext();
2299 | struct_or_union ext_decl identifier
2301 $$ = MkStructOrUnion($1, $3, null);
2302 $$.extDeclStruct = $2;
2303 $$.addNameSpace = true;
2304 $$.ctx = PushContext();
2306 | struct_or_union ext_decl base_strict_type
2308 $$ = MkStructOrUnion($1, MkIdentifier($3.name), null);
2309 $$.extDeclStruct = $2;
2310 $$.ctx = PushContext();
2315 struct_or_union_specifier_compound:
2316 struct_or_union_specifier_compound_error '}' { $$ = $1; $$.loc = @$; }
2317 | struct_entry '{' '}' { $$ = $1; $$.loc = @$; POP_DEFAULT_ACCESS PopContext(curContext); }
2318 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2319 | struct_or_union ext_decl '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; $$.loc = @$; POP_DEFAULT_ACCESS }
2322 struct_or_union_specifier_compound_error:
2323 struct_entry '{' struct_declaration_list { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2324 | struct_entry '{' struct_declaration_list_error { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2325 | struct_entry '{' error { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2327 | struct_or_union '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2328 | struct_or_union '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2329 | struct_or_union '{' error { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2331 | struct_or_union ext_decl '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2332 | struct_or_union ext_decl '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2333 | struct_or_union ext_decl '{' error { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2336 struct_or_union_specifier_nocompound:
2337 struct_entry { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2346 ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)($1.id._class, $1.id.string);
2349 | struct_entry '<' template_parameters_list '>'
2351 Symbol symbol = ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)($1.id._class, $1.id.string);
2353 symbol.templateParams = $3;
2358 struct_decl ':' inheritance_specifiers
2362 SetupBaseSpecs(null, $3);
2367 struct_class_error '}' { $$ = $1; $$.loc = @$; }
2368 | struct_head '{' '}'
2369 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2370 | struct_decl '{' '}' { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2371 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2375 struct_head '{' struct_declaration_list
2378 $$.definitions = $3;
2380 PopContext(curContext);
2382 | struct_head '{' struct_declaration_list_error
2385 $$.definitions = $3;
2387 PopContext(curContext);
2389 | struct_head '{' error
2390 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext);}
2392 | struct_decl '{' struct_declaration_list
2394 PopContext(curContext);
2397 $$ = MkStructOrUnion($1.type, $1.id, $3);
2402 $$.definitions = $3;
2405 | struct_decl '{' struct_declaration_list_error
2407 PopContext(curContext);
2411 $$ = MkStructOrUnion($1.type, $1.id, $3);
2416 $$.definitions = $3;
2419 | struct_decl '{' error
2420 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2422 | struct_or_union '{' struct_declaration_list
2423 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2424 | struct_or_union '{' struct_declaration_list_error
2425 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2426 | struct_or_union '{' error
2427 { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2431 STRUCT { $$ = structSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2432 | UNION { $$ = unionSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2435 specifier_qualifier_list:
2436 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2437 | specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2438 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2439 | specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2440 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2441 | specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2442 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2443 | specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2446 guess_specifier_qualifier_list:
2447 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2448 | guess_specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2449 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2450 | guess_specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2451 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2452 | guess_specifier_qualifier_list guess_type { $$ = $1; ListAdd($1, $2); }
2453 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2454 | guess_specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2455 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2456 | guess_specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2459 declaration_specifiers:
2460 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2461 | declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2462 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2463 | declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2464 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2465 | declaration_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2466 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2467 | declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2468 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2469 | declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2472 guess_declaration_specifiers:
2473 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2474 | guess_declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2475 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2476 | guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2477 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2478 | guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2479 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2480 | guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2481 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2482 | guess_declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2483 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2484 | guess_declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2487 external_guess_declaration_specifiers:
2488 external_storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2489 | external_guess_declaration_specifiers external_storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2490 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2491 | external_guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2492 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2493 | external_guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2494 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2495 | external_guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2496 | class_specifier { $$ = MkList(); ListAdd($$, $1); }
2497 | external_guess_declaration_specifiers class_specifier { $$ = $1; ListAdd($1, $2); }
2500 external_guess_declaration_specifiers_error:
2501 class_specifier_error { $$ = MkList(); ListAdd($$, $1); }
2502 | external_guess_declaration_specifiers class_specifier_error { $$ = $1; ListAdd($1, $2); }
2505 _inheritance_specifiers:
2506 PRIVATE { $$ = MkList(); ListAdd($$, MkSpecifier(PRIVATE)); }
2507 | PUBLIC { $$ = MkList(); ListAdd($$, MkSpecifier(PUBLIC)); }
2508 | storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2509 | _inheritance_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2510 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2511 | _inheritance_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2512 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2513 | _inheritance_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2515 { _DeclClass($1._class, $1.string); $$ = MkListOne(MkSpecifierName($1.string)); FreeIdentifier($1); }
2516 | _inheritance_specifiers identifier { $$ = $1; _DeclClass($2._class, $2.string); ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2); }
2518 | identifier '<' template_arguments_list '>'
2520 _DeclClass($1._class, $1.string);
2523 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2526 | _inheritance_specifiers identifier '<' template_arguments_list '>'
2529 _DeclClass($2._class, $2.string);
2530 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2535 inheritance_specifiers:
2536 _inheritance_specifiers
2537 | struct_or_union { $$ = MkListOne(MkStructOrUnion($1, null, null)); POP_DEFAULT_ACCESS }
2540 property_specifiers:
2541 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2542 | property_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2543 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2544 | property_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2545 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2546 | property_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2547 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2548 | property_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2549 | identifier '<' template_arguments_list '>'
2551 _DeclClass($1._class, $1.string);
2554 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2557 | property_specifiers identifier '<' template_arguments_list '>'
2559 _DeclClass($2._class, $2.string);
2560 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2566 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2567 | renew_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2568 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2569 | renew_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2570 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2571 | renew_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2572 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2573 | renew_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2574 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2575 | renew_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2576 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2577 | renew_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2578 | identifier '<' template_arguments_list '>'
2580 _DeclClass($1._class, $1.string);
2583 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2586 | renew_specifiers identifier '<' template_arguments_list '>'
2588 _DeclClass($2._class, $2.string);
2589 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2595 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2596 | new_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2597 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2598 | new_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2599 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2600 | new_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2601 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2602 | new_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2603 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2604 | new_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2605 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2606 | new_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2607 | identifier '<' template_arguments_list '>'
2609 _DeclClass($1._class, $1.string);
2612 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2615 | new_specifiers identifier '<' template_arguments_list '>'
2617 _DeclClass($2._class, $2.string);
2618 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2623 identifier_list_error:
2624 identifier_list ',' error { $$ = $1; ListAdd($1, null); }
2625 | identifier_list_error ',' error { $$ = $1; ListAdd($1, null); }
2629 identifier { $$ = MkList(); ListAdd($$, MkTypeName(null, MkDeclaratorIdentifier($1))); }
2630 | identifier_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2631 | identifier_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2632 | parameter_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2633 | parameter_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2636 direct_declarator_nofunction_type_ok:
2637 direct_declarator_nofunction
2640 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2641 String s = colon ? colon + 2 : $1.name;
2642 $$ = MkDeclaratorIdentifier(MkIdentifier(s));
2645 | UINT { $$ = MkDeclaratorIdentifier(MkIdentifier("uint")); }
2646 // These rules need to be reviewed in lights of prototypes with types only...
2647 | base_strict_type '[' constant_expression ']'
2650 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2651 String s = colon ? colon + 2 : $1.name;
2652 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2654 $$ = MkDeclaratorArray(decl, $3);
2656 | base_strict_type '[' constant_expression_error ']'
2659 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2660 String s = colon ? colon + 2 : $1.name;
2661 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2663 $$ = MkDeclaratorArray(decl, $3);
2665 | base_strict_type '[' type ']'
2668 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2669 String s = colon ? colon + 2 : $1.name;
2670 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2672 $$ = MkDeclaratorEnumArray(decl, $3);
2674 | base_strict_type '[' ']'
2677 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2678 String s = colon ? colon + 2 : $1.name;
2679 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2681 $$ = MkDeclaratorEnumArray(decl, null);
2683 | direct_declarator_nofunction_type_ok '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2684 | direct_declarator_nofunction_type_ok '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2685 | direct_declarator_nofunction_type_ok '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2686 | direct_declarator_nofunction_type_ok '[' ']' { $$ = MkDeclaratorArray($1, null); }
2689 direct_declarator_nofunction:
2690 identifier { $$ = MkDeclaratorIdentifier($1); }
2691 | '(' declarator ')' { $$ = MkDeclaratorBrackets($2); }
2692 | '(' ext_decl declarator ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2693 | '(' declarator_type_ok ')' { $$ = MkDeclaratorBrackets($2); }
2694 | '(' ext_decl declarator_type_ok ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2695 | direct_declarator_nofunction '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2696 | direct_declarator_nofunction '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2697 | direct_declarator_nofunction '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2698 | direct_declarator_nofunction '[' ']' { $$ = MkDeclaratorArray($1, null); }
2701 direct_declarator_function_start:
2702 direct_declarator_nofunction '('
2705 direct_declarator_function:
2706 direct_declarator_function_start parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2707 | direct_declarator_function_start parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2708 | direct_declarator_function_start identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2709 | direct_declarator_function_start identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2710 | direct_declarator_function_start ')' { $$ = MkDeclaratorFunction($1, null); }
2713 // Tricky stuff here for overriding...
2714 direct_declarator_function_error:
2715 direct_declarator_function_start identifier_list_error
2717 $$ = MkDeclaratorFunction($1, $2);
2718 fileInput.Seek(@1.end.pos, start);
2720 resetScannerPos(&@1.end);
2721 @$.start = @1.start;
2724 | direct_declarator_function_start error
2726 $$ = MkDeclaratorFunction($1, null);
2727 fileInput.Seek(@1.end.pos, start);
2729 resetScannerPos(&@1.end);
2730 @$.start = @1.start;
2733 | direct_declarator_function_start parameter_list '('
2735 $$ = MkDeclaratorFunction($1, $2);
2736 fileInput.Seek(@1.end.pos, start);
2738 resetScannerPos(&@1.end);
2739 @$.start = @1.start;
2742 | direct_declarator_function_start guess_declaration_specifiers identifier '('
2744 $$ = MkDeclaratorFunction($1, null);
2745 fileInput.Seek(@1.end.pos, start);
2747 resetScannerPos(&@1.end);
2748 @$.start = @1.start;
2750 FreeList($2, FreeSpecifier);
2756 direct_declarator_function
2757 | direct_declarator_nofunction
2761 direct_declarator_function_start_type_ok:
2762 direct_declarator_nofunction_type_ok '('
2765 direct_declarator_function_type_ok:
2766 direct_declarator_function_start_type_ok parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2767 | direct_declarator_function_start_type_ok parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2768 | direct_declarator_function_start_type_ok identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2769 | direct_declarator_function_start_type_ok identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2770 | direct_declarator_function_start_type_ok ')' { $$ = MkDeclaratorFunction($1, null); }
2773 // Tricky stuff here for overriding...
2774 direct_declarator_function_error_type_ok:
2775 direct_declarator_function_start_type_ok identifier_list_error
2777 $$ = MkDeclaratorFunction($1, $2);
2778 fileInput.Seek(@1.end.pos, start);
2780 resetScannerPos(&@1.end);
2781 @$.start = @1.start;
2784 | direct_declarator_function_start_type_ok error
2786 $$ = MkDeclaratorFunction($1, null);
2787 fileInput.Seek(@1.end.pos, start);
2789 resetScannerPos(&@1.end);
2790 @$.start = @1.start;
2793 | direct_declarator_function_start_type_ok parameter_list '('
2795 $$ = MkDeclaratorFunction($1, $2);
2796 fileInput.Seek(@1.end.pos, start);
2798 resetScannerPos(&@1.end);
2799 @$.start = @1.start;
2802 | direct_declarator_function_start_type_ok guess_declaration_specifiers identifier '('
2804 $$ = MkDeclaratorFunction($1, null);
2805 fileInput.Seek(@1.end.pos, start);
2807 resetScannerPos(&@1.end);
2808 @$.start = @1.start;
2810 FreeList($2, FreeSpecifier);
2815 direct_declarator_type_ok:
2816 direct_declarator_function_type_ok
2817 | direct_declarator_nofunction_type_ok
2819 | ext_decl direct_declarator_function_type_ok
2820 { $$ = MkDeclaratorExtended($1, $2); }
2821 | ext_decl direct_declarator_nofunction_type_ok
2822 { $$ = MkDeclaratorExtended($1, $2); }
2827 ASM '(' STRING_LITERAL { $<string>$ = CopyString(yytext); } STRING_LITERAL { $<string>$ = CopyString(yytext); }
2830 strcpy(temp, "__asm__(");
2831 strcat(temp, $<string>4);
2833 strcat(temp, $<string>6);
2836 $<string>$ = CopyString(temp);
2841 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2842 | attrib { $$ = MkExtDeclAttrib($1);
2846 strcpy(temp, $<string>1);
2849 $$ = MkExtDeclString(CopyString(temp));
2851 | asm_start STRING_LITERAL { $$ = CopyString(yytext); } ')'
2854 strcpy(temp, $<string>1);
2856 strcat(temp, $<string>3);
2860 $$ = MkExtDeclString(CopyString(temp));
2866 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2867 | EXT_STORAGE { $$ = MkExtDeclString(CopyString(yytext)); }
2868 | attrib { $$ = MkExtDeclAttrib($1); }
2869 | ASM '(' string_literal ')'
2872 strcpy(temp, "__asm__(");
2875 $$ = MkExtDeclString(CopyString(temp));
2881 ATTRIB { $<i>$ = ATTRIB; }
2882 | ATTRIB_DEP { $<i>$ = ATTRIB_DEP; }
2883 | __ATTRIB { $<i>$ = __ATTRIB; }
2888 IDENTIFIER { $$ = CopyString(yytext); }
2889 | TYPE_NAME { $$ = CopyString(yytext); }
2890 | EXT_STORAGE { $$ = CopyString(yytext); }
2891 | EXT_DECL { $$ = CopyString(yytext); }
2892 | CONST { $$ = CopyString(yytext); }
2896 attribute_word { $$ = MkAttribute($1, null); $$.loc = @$; }
2897 | attribute_word '(' expression ')' { $$ = MkAttribute($1, MkExpBrackets($3)); $$.loc = @$; }
2901 attribute { $$ = MkListOne($1); }
2902 | attribs_list attribute { ListAdd($1, $2); $$ = $1; }
2903 | attribs_list ',' attribute { ListAdd($1, $3); $$ = $1; }
2907 _attrib '(' '(' attribs_list ')' ')' { $$ = MkAttrib($<i>1, $4); $$.loc = @$; }
2908 | _attrib '(' '(' ')' ')' { $$ = MkAttrib($<i>1, null); $$.loc = @$; }
2911 direct_abstract_declarator:
2912 '(' abstract_declarator ')' { $$ = MkDeclaratorBrackets($2); }
2913 | '(' ext_decl abstract_declarator ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2914 | '[' ']' { $$ = MkDeclaratorArray(null, null); }
2915 | '[' constant_expression ']' { $$ = MkDeclaratorArray(null, $2); }
2916 | '[' constant_expression_error ']' { $$ = MkDeclaratorArray(null, $2); }
2917 | '[' type ']' { $$ = MkDeclaratorEnumArray(null, $2); }
2918 | direct_abstract_declarator '[' ']' { $$ = MkDeclaratorArray($1, null); }
2919 | direct_abstract_declarator '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2920 | direct_abstract_declarator '[' type']' { $$ = MkDeclaratorEnumArray($1, $3); }
2921 | direct_abstract_declarator '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2922 | '(' ')' { $$ = MkDeclaratorFunction(null, null); }
2923 | '(' parameter_type_list ')' { $$ = MkDeclaratorFunction(null, $2); }
2924 | '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction(null, $2); }
2925 | direct_abstract_declarator '(' ')' { $$ = MkDeclaratorFunction($1, null); }
2926 | direct_abstract_declarator '(' parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $3); }
2927 | direct_abstract_declarator '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $3); }
2930 direct_abstract_declarator_noarray:
2931 '(' abstract_declarator_noarray ')' { $$ = MkDeclaratorBrackets($2); }
2932 | '(' ext_decl abstract_declarator_noarray ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2933 | '(' ')' { $$ = MkDeclaratorFunction(null, null); }
2934 | '(' parameter_type_list ')' { $$ = MkDeclaratorFunction(null, $2); }
2935 | '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction(null, $2); }
2936 | direct_abstract_declarator_noarray '(' ')' { $$ = MkDeclaratorFunction($1, null); }
2937 | direct_abstract_declarator_noarray '(' parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $3); }
2938 | direct_abstract_declarator_noarray '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $3); }
2942 '*' { $$ = MkPointer(null, null); }
2943 | '*' type_qualifier_list { $$ = MkPointer($2, null); }
2944 | '*' pointer { $$ = MkPointer(null, $2); }
2945 | '*' type_qualifier_list pointer { $$ = MkPointer($2, $3); }
2948 abstract_declarator:
2949 pointer { $$ = MkDeclaratorPointer($1, null); }
2950 | direct_abstract_declarator
2951 | pointer direct_abstract_declarator { $$ = MkDeclaratorPointer($1, $2); }
2952 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
2953 | ext_decl pointer direct_abstract_declarator { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2956 abstract_declarator_noarray:
2957 pointer { $$ = MkDeclaratorPointer($1, null); }
2958 | direct_abstract_declarator_noarray
2959 | pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorPointer($1, $2); }
2960 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
2961 | ext_decl pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2966 | pointer direct_declarator
2967 { $$ = MkDeclaratorPointer($1, $2); }
2968 | ext_decl pointer direct_declarator
2969 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2970 | declarator ext_decl
2971 { $$ = MkDeclaratorExtendedEnd($2, $1); }
2972 | declarator_nofunction_type_ok ext_decl
2973 { $$ = MkDeclaratorExtendedEnd($2, $1); }
2977 direct_declarator_type_ok
2978 | pointer direct_declarator_type_ok
2979 { $$ = MkDeclaratorPointer($1, $2); }
2980 | ext_decl pointer direct_declarator_type_ok
2981 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2982 | declarator_type_ok ext_decl
2983 { $$ = MkDeclaratorExtendedEnd($2, $1); }
2986 declarator_function:
2987 direct_declarator_function
2988 | pointer direct_declarator_function { $$ = MkDeclaratorPointer($1, $2); }
2989 | ext_decl pointer direct_declarator_function { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2990 | pointer ext_decl direct_declarator_function { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
2993 declarator_function_error:
2994 direct_declarator_function_error
2995 | pointer direct_declarator_function_error { $$ = MkDeclaratorPointer($1, $2); }
2996 | ext_decl pointer direct_declarator_function_error { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
2997 | pointer ext_decl direct_declarator_function_error { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3000 declarator_function_type_ok:
3001 direct_declarator_function_type_ok
3002 | pointer direct_declarator_function_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3003 | ext_decl pointer direct_declarator_function_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3004 | pointer ext_decl direct_declarator_function_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3007 declarator_function_error_type_ok:
3008 direct_declarator_function_error_type_ok
3009 | pointer direct_declarator_function_error_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3010 | ext_decl pointer direct_declarator_function_error_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3011 | pointer ext_decl direct_declarator_function_error_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3014 declarator_nofunction_type_ok:
3015 direct_declarator_nofunction_type_ok
3016 | pointer direct_declarator_nofunction_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3017 | ext_decl pointer direct_declarator_nofunction_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3018 | pointer ext_decl direct_declarator_nofunction_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3022 assignment_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3023 | '{' initializer_list '}' { $$ = MkInitializerList($2); $$.loc = @$; }
3024 | '{' initializer_list ',' '}'
3026 Compiler_Warning($"extra comma\n");
3027 $$ = MkInitializerList($2);
3031 Expression exp = MkExpDummy();
3032 Initializer init = MkInitializerAssignment(exp);
3041 assignment_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3042 | '{' initializer_list '}' error { $$ = MkInitializerList($2); $$.loc = @$; }
3043 | '{' initializer_list { yyerror(); $$ = MkInitializerList($2); $$.loc = @$; }
3044 | '{' initializer_list ',' '}' error
3046 $$ = MkInitializerList($2);
3050 Expression exp = MkExpDummy();
3051 Initializer init = MkInitializerAssignment(exp);
3057 | '{' initializer_list ','
3060 $$ = MkInitializerList($2);
3064 Expression exp = MkExpDummy();
3065 Initializer init = MkInitializerAssignment(exp);
3073 initializer_condition:
3074 conditional_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3075 | anon_instantiation_expression
3076 { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3079 initializer_condition_error:
3080 conditional_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3081 | anon_instantiation_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3085 initializer { $$ = MkList(); ListAdd($$, $1); }
3086 | initializer_error { $$ = MkList(); ListAdd($$, $1); }
3087 | initializer_list ',' initializer { $$ = $1; ListAdd($1, $3); }
3088 | initializer_list ',' initializer_error { $$ = $1; ListAdd($1, $3); }
3091 | initializer_list initializer { yyerror(); $$ = $1; ListAdd($1, $2); }
3092 | initializer_list initializer_error { $$ = $1; ListAdd($1, $2); }
3096 declarator { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3097 | declarator_type_ok { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3098 | declarator '=' initializer { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3101 init_declarator_error:
3102 declarator error { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3103 /* Useless rules due to conflicts
3104 | declarator '=' error { $$ = MkInitDeclarator($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.initializer.loc = @2; $$.initializer.exp.loc = @2; }
3106 | declarator '=' initializer_error { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3109 init_declarator_list:
3110 init_declarator { $$ = MkList(); ListAdd($$, $1); }
3111 | init_declarator_list ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3112 | UINT ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("uint")), null)); ListAdd($$, $3); }
3113 | INT64 ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("int64")), null)); ListAdd($$, $3); }
3114 | INT128 ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("__int128")), null)); ListAdd($$, $3); }
3115 | base_strict_type ',' init_declarator
3117 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
3118 String s = colon ? colon + 2 : $1.name;
3120 ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(s)), null));
3124 | init_declarator_list_error ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3125 /*| base_strict_type ',' init_declarator
3132 init_declarator_list_error:
3133 init_declarator_error { $$ = MkList(); ListAdd($$, $1); }
3134 | init_declarator error { $$ = MkList(); ListAdd($$, $1); }
3135 | init_declarator_list ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3136 | init_declarator_list_error ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3140 specifier_qualifier_list { $$ = MkTypeName($1, null); }
3141 | specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3145 guess_specifier_qualifier_list { $$ = MkTypeName($1, null); }
3146 | guess_specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3149 /*** PARAMETERS **********************************************************************/
3150 parameter_declaration:
3151 guess_declaration_specifiers declarator_type_ok { $$ = MkTypeName($1, $2); }
3152 | guess_declaration_specifiers abstract_declarator { $$ = MkTypeName($1, $2); }
3153 | guess_declaration_specifiers '&' { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), null)); }
3154 | guess_declaration_specifiers '&' declarator_type_ok { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), $3)); }
3155 | guess_declaration_specifiers { $$ = MkTypeNameGuessDecl($1, null); }
3157 { $$ = MkTypeName(MkListOne(MkSpecifier(CLASS)), null); }
3160 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), null); }
3162 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), null)); }
3163 | TYPED_OBJECT declarator
3164 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), $2); }
3165 | TYPED_OBJECT '&' declarator
3166 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), $3)); }
3168 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), null); }
3169 | ANY_OBJECT declarator
3170 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), $2); }
3174 parameter_declaration_error:
3175 guess_declaration_specifiers declarator_type_ok error { $$ = MkTypeName($1, $2); }
3176 | guess_declaration_specifiers abstract_declarator error { $$ = MkTypeName($1, $2); }
3180 parameter_declaration { $$ = MkList(); ListAdd($$, $1); }
3181 | parameter_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3182 | parameter_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3183 | parameter_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3184 | parameter_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3185 | error ',' parameter_declaration { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3187 | identifier_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3188 | identifier_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3189 | identifier_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3190 | identifier_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3193 parameter_list_error:
3194 parameter_declaration_error { $$ = MkList(); ListAdd($$, $1); }
3195 | parameter_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3196 | parameter_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3197 | parameter_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3198 | error ',' parameter_declaration_error { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3200 | identifier_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3201 | identifier_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3202 | identifier_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3205 parameter_type_list:
3207 | parameter_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3208 | parameter_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3209 | identifier_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3210 | identifier_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3211 | error ',' ELLIPSIS { $$ = MkList(); ListAdd($$, MkTypeName(null, null)); }
3214 parameter_type_list_error:
3215 parameter_list_error
3216 | parameter_list ',' error { $$ = $1; ListAdd($1, null); }
3217 | parameter_list_error error
3220 /****** STATEMENTS *******************************************************************/
3223 | attrib { $$ = MkExpressionStmt(null); FreeAttrib($1); } // Ignoring this for now... ( For __attribute__ ((__unused__)) )
3224 | compound_statement
3225 | ';' { $$ = MkExpressionStmt(null); }
3226 | ':' { $$ = MkExpressionStmt(null); }
3227 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3228 | selection_statement
3229 | iteration_statement
3234 | watch_definition ';'
3238 labeled_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3239 | iteration_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3240 | compound_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3241 | selection_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3242 | jump_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3243 | jump_statement error { $$ = $1; Compiler_Error($"syntax error\n"); }
3244 | expression_error { $$ = MkExpressionStmt($1); Compiler_Error($"syntax error\n"); $$.loc = @1; }
3248 string_literal { $$ = MkAsmField($1, null, null); $$.loc = @1; }
3249 | string_literal '(' assignment_expression ')' { $$ = MkAsmField($1, $3, null); $$.loc = @$; }
3250 | '[' identifier ']' string_literal '(' assignment_expression ')' { $$ = MkAsmField($4, $6, $2); $$.loc = @$; }
3254 asm_field { $$ = MkListOne($1); }
3255 | asm_field_list ',' asm_field { ListAdd($$, $3); }
3260 ASM type_qualifier '(' string_literal ')' ';' { $$ = MkAsmStmt($2, $4, null, null, null); $$.loc = @$; }
3261 | ASM type_qualifier '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, null); $$.loc = @$; }
3262 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, null); $$.loc = @$; }
3263 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, $10); $$.loc = @$; }
3265 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, null); $$.loc = @$; }
3266 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, $8); $$.loc = @$; }
3267 | ASM type_qualifier '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, $8); $$.loc = @$; }
3269 | ASM '(' string_literal ')' ';' { $$ = MkAsmStmt(null, $3, null, null, null); $$.loc = @$; }
3270 | ASM '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, null); $$.loc = @$; }
3271 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, null); $$.loc = @$; }
3272 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, $9); $$.loc = @$; }
3274 | ASM '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, null); $$.loc = @$; }
3275 | ASM '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, $7); $$.loc = @$; }
3276 | ASM '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, $7); $$.loc = @$; }
3280 identifier ':' statement { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3281 | CASE constant_expression ':' statement { /*if($4.type == labeledStmt) Compiler_Warning(CASE_LABELED_STMT_WARNING);*/ $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3282 | CASE constant_expression_error ':' statement { /*if($4.type == labeledStmt) Compiler_Warning(CASE_LABELED_STMT_WARNING);*/ $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3283 | 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; }
3284 | DEFAULT ':' statement { /*if($3.type == labeledStmt) Compiler_Warning(CASE_LABELED_STMT_WARNING);*/ $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3286 | identifier ':' declaration { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkLabeledStmt($1, stmt); $$.loc = @$; }
3287 | 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; }
3288 | 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; }
3289 | 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; }
3290 | DEFAULT ':' declaration { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt(null, stmt); $$.loc = @$; }
3293 labeled_statement_error:
3294 identifier ':' statement_error { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3295 | CASE constant_expression ':' statement_error { /*if($4.type == labeledStmt) Compiler_Warning(CASE_LABELED_STMT_WARNING);*/ $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3296 | 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; }
3297 | 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; }
3298 | CASE ':' { $$ = MkCaseStmt(MkExpDummy(), null); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3299 | DEFAULT ':' statement_error { /*if($3.type == labeledStmt) Compiler_Warning(CASE_LABELED_STMT_WARNING);*/ $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3300 | DEFAULT ':' { $$ = MkCaseStmt(null, null); $$.loc = @$; }
3302 | identifier ':' declaration_error { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkLabeledStmt($1, stmt); $$.loc = @$; }
3303 | 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; }
3304 | 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; }
3305 | 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; }
3306 | DEFAULT ':' declaration_error { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt(null, stmt); $$.loc = @$; }
3310 PUBLIC { $$ = structDeclMode = declMode = publicAccess; }
3311 | PRIVATE { $$ = structDeclMode = declMode = privateAccess; }
3312 | DEFAULT { $$ = structDeclMode = declMode = defaultAccess; }
3316 PUBLIC { $$ = publicAccess; }
3317 | PRIVATE { $$ = privateAccess; }
3321 declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; structDeclMode = defaultDeclMode; }
3322 | declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; structDeclMode = defaultDeclMode; }
3323 | instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; structDeclMode = defaultDeclMode; }
3324 | declaration_error ';' { $$ = $1; structDeclMode = defaultDeclMode; }
3327 external_guess_declaration:
3328 external_guess_declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3329 | external_guess_declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3330 | external_guess_declaration_specifiers_error init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3332 | external_guess_instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3333 | DEFINE identifier '=' conditional_expression ';' { $$ = MkDeclarationDefine($2, $4); $$.loc = @$; }
3334 | STATIC DEFINE identifier '=' conditional_expression ';' { structDeclMode = declMode = staticAccess; $$ = MkDeclarationDefine($3, $5); $$.loc = @$; }
3337 external_guess_declaration_error:
3338 external_guess_declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; yyerrok; }
3342 declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; structDeclMode = defaultDeclMode; }
3343 | declaration_error error { structDeclMode = defaultDeclMode; }
3345 | instantiation_named_error error { $$ = MkDeclarationInst($1); $$.loc = @$; structDeclMode = defaultDeclMode; }
3346 | instantiation_named error { $$ = MkDeclarationInst($1); $$.loc = @$; structDeclMode = defaultDeclMode; }
3347 | declaration_specifiers init_declarator_list_error { $$ = MkDeclaration($1, $2); $$.loc = @$; structDeclMode = defaultDeclMode; }
3351 declaration { $$ = MkList(); ListAdd($$, $1); /*declMode = defaultDeclMode;*/ }
3352 | declaration_list declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3353 | declaration_list_error declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3354 | declaration_list error ';' { $$ = $1; }
3357 declaration_list_error:
3358 declaration_error { $$ = MkList(); ListAdd($$, $1); }
3359 | declaration_list declaration_error { $$ = $1; ListAdd($1, $2); }
3363 statement { $$ = MkList(); ListAdd($$, $1); }
3364 | statement_list statement { $$ = $1; ListAdd($1, $2); }
3365 | statement_list_error statement { $$ = $1; ListAdd($1, $2); }
3368 statement_list_error:
3369 statement_error { $$ = MkList(); ListAdd($$, $1); }
3370 | statement_list statement_error { $$ = $1; ListAdd($1, $2); }
3371 | statement_list_error statement_error { $$ = $1; ListAdd($1, $2); }
3372 | statement_list declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3373 | statement_list_error declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3374 | statement_list declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3375 | statement_list_error declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3379 statement_list { $$ = MkCompoundStmt(null, $1); }
3380 | declaration_list { $$ = MkCompoundStmt($1, null); }
3381 | declaration_list statement_list { $$ = MkCompoundStmt($1, $2); }
3382 | declaration_list_error statement_list { $$ = MkCompoundStmt($1, $2); }
3385 compound_inside_error:
3386 statement_list_error { $$ = MkCompoundStmt(null, $1); }
3387 | declaration_list_error { $$ = MkCompoundStmt($1, null); }
3388 | declaration_list statement_list_error { $$ = MkCompoundStmt($1, $2); }
3389 | declaration_list_error statement_list_error { $$ = MkCompoundStmt($1, $2); }
3393 '{' { $<context>$ = PushContext(); }
3397 compound_statement_error '}' { $$ = $1; $$.loc = @$; }
3400 compound_statement_error:
3401 compound_start compound_inside_error
3402 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3404 { $$ = MkCompoundStmt(null, null); $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3406 | compound_start compound_inside
3407 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3411 expression_statement:
3412 ';' { $$ = MkExpressionStmt(null); $$.loc = @$; }
3413 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3414 | expression_error ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3417 selection_statement:
3418 IF '(' expression ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3419 | IF '(' expression_error ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3420 | IF '(' expression ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3421 | IF '(' expression_error ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3422 | SWITCH '(' expression ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3423 | SWITCH '(' expression_error ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3426 selection_statement_error:
3427 IF '(' expression_error { $$ = MkIfStmt($3, null, null); $$.loc = @$; }
3428 | selection_statement error
3431 iteration_statement:
3432 WHILE '(' expression ')' statement { $$ = MkWhileStmt($3, $5); $$.loc = @$; }
3433 | WHILE '(' expression_error statement { $$ = MkWhileStmt($3, $4); $$.loc = @$; }
3434 | WHILE '(' ')' statement { yyerror(); $$ = MkWhileStmt(null, $4); $$.loc = @$; }
3436 | DO statement WHILE '(' expression ')' ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3437 | DO statement WHILE '(' expression_error ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3439 | FOR '(' expression_statement expression_statement ')' statement { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; }
3440 | FOR '(' expression_statement ')' statement { yyerror(); $$ = MkForStmt($3, null, null, $5); $$.loc = @$; }
3441 | FOR '(' expression_statement expression_statement expression ')' statement { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; }
3442 | FOR '(' expression_statement expression_statement expression_error statement { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; }
3443 | FOR '(' ')' statement { yyerror(); $$ = MkForStmt(null, null, null, $4); $$.loc = @$; }
3445 | FOR '(' identifier ':' expression ')' statement { $$ = MkForEachStmt($3, $5, null, $7); $$.loc = @$; }
3446 | FOR '(' identifier ':' expression ';' expression ')' statement { $$ = MkForEachStmt($3, $5, $7, $9); $$.loc = @$; }
3449 iteration_statement_error:
3450 FOR '(' error { $$ = MkForStmt(null, null, null, null); $$.loc = @$; } |
3451 FOR '(' expression_error error { $$ = MkForStmt(MkExpressionStmt($3), null, null, null); $$.forStmt.init.loc = @3; $$.loc = @$; } |
3452 FOR '(' expression_statement error { $$ = MkForStmt($3, null, null, null); $$.loc = @$; } |
3453 FOR '(' expression_statement expression_error error { $$ = MkForStmt($3, MkExpressionStmt($4), null, null); $$.loc = @$; $$.forStmt.check.loc = @4; } |
3454 /* Useless rules due to conflicts
3455 FOR '(' expression_statement expression_statement error { $$ = MkForStmt($3, $4, null, null); $$.loc = @$; } |
3457 FOR '(' expression_statement expression_statement expression_error { $$ = MkForStmt($3, $4, $5, null); $$.loc = @$; } |
3458 FOR '(' expression_statement expression_statement ')' statement_error { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; } |
3459 FOR '(' expression_statement expression_statement expression ')' statement_error { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; } |
3460 FOR '(' expression_statement expression_statement expression_error statement_error { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; } |
3462 DO statement WHILE '(' expression ')' { yyerror(); $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3463 DO statement WHILE '(' expression { yyerror(); $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3464 DO statement WHILE '(' expression_error { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3465 DO statement WHILE '(' { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3466 DO statement WHILE { yyerror(); $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3467 DO statement { yyerror(); $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3468 DO { yyerror(); $$ = MkDoWhileStmt(null, null); $$.loc = @$; } |
3471 WHILE error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3472 /* Useless rules due to conflicts
3473 WHILE '(' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3475 WHILE '(' ')' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3476 WHILE '(' expression_error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3477 /* Useless rules due to conflicts
3478 WHILE '(' expression_error error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3480 WHILE '(' expression ')' statement_error { $$ = MkWhileStmt($3, $5); $$.loc = @$; } |
3481 WHILE '(' expression_error statement_error { $$ = MkWhileStmt($3, $4 ); $$.loc = @$; }
3485 GOTO identifier ';' { $$ = MkGotoStmt($2); $$.loc = @$; }
3486 | CONTINUE ';' { $$ = MkContinueStmt(); $$.loc = @$; }
3487 | BREAK ';' { $$ = MkBreakStmt(); $$.loc = @$; }
3488 | RETURN ';' { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc = @2; }
3489 | RETURN expression ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3490 | RETURN expression_error ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3491 | RETURN anon_instantiation_expression ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3492 | RETURN anon_instantiation_expression_error ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3495 jump_statement_error:
3496 RETURN expression_error { $$ = MkReturnStmt($2); $$.loc = @$; } |
3497 RETURN anon_instantiation_expression_error { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; } |
3498 RETURN { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc.start = exp.loc.end = @1.end; } |
3499 GOTO { $$ = MkGotoStmt(null); $$.loc = @$; }
3502 /*************************************************************************************/
3504 function_definition:
3505 external_guess_declaration_specifiers declarator_function declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3506 | external_guess_declaration_specifiers declarator_function compound_statement
3507 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3508 | external_guess_declaration_specifiers declarator_function_type_ok declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3509 | external_guess_declaration_specifiers declarator_function_type_ok compound_statement
3510 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3512 | declarator_function declaration_list compound_statement { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; }
3513 | declarator_function compound_statement { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$;}
3515 function_definition_error:
3516 external_guess_declaration_specifiers declarator_function declaration_list compound_statement_error { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; $$.loc.end = $4.loc.end; }
3517 | external_guess_declaration_specifiers declarator_function compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3518 | 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; }
3519 | external_guess_declaration_specifiers declarator_function_type_ok compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3520 | declarator_function declaration_list compound_statement_error { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3521 | declarator_function compound_statement_error { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
3525 STRING_LITERAL { $$ = CopyString(yytext); }
3526 | string_literal STRING_LITERAL
3528 int len1 = strlen($1);
3529 int len2 = strlen(yytext);
3530 $$ = new byte[len1-1 + len2-1 + 1];
3531 memcpy($$, $1, len1-1);
3532 memcpy($$ + len1-1, yytext+1, len2);
3537 external_declaration:
3538 function_definition { $$ = MkExternalFunction($1); $$.loc = @$; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3540 { $$ = MkExternalClass($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3542 | external_guess_declaration_specifiers class
3543 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; FreeList($1, FreeSpecifier); }
3545 | external_guess_declaration
3546 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3547 | IMPORT string_literal { $$ = MkExternalImport($2, normalImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3548 | IMPORT STATIC string_literal { $$ = MkExternalImport($3, staticImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3549 | IMPORT identifier string_literal
3551 bool isRemote = !strcmp($2.string, "remote");
3552 $$ = MkExternalImport($3, isRemote ? remoteImport : normalImport, (declMode != defaultAccess) ? declMode : privateAccess);
3559 | ';' { $$ = null; }
3561 | declaration_mode function_definition { $$ = MkExternalFunction($2); $$.loc = @$; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3562 | declaration_mode class
3563 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3564 | declaration_mode external_guess_declaration { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3565 | declaration_mode IMPORT string_literal { $$ = MkExternalImport($3, normalImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; structDeclMode = declMode = defaultDeclMode; }
3566 | declaration_mode IMPORT STATIC string_literal { $$ = MkExternalImport($4, staticImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; structDeclMode = declMode = defaultDeclMode; }
3567 | declaration_mode IMPORT identifier string_literal
3569 bool isRemote = !strcmp($3.string, "remote");
3570 $$ = MkExternalImport($4, isRemote ? remoteImport : normalImport, ($1 != defaultAccess) ? $1 : privateAccess);
3573 structDeclMode = declMode = defaultDeclMode;
3577 | declaration_mode ':' { defaultDeclMode = $1; $$ = null; }
3578 | STATIC ':' { defaultDeclMode = staticAccess; $$ = null; }
3579 | NAMESPACE identifier { $$ = MkExternalNameSpace($2); $$.loc = @$; }
3580 | NAMESPACE strict_type { $$ = MkExternalNameSpace(MkIdentifier($2.name)); FreeSpecifier($2); $$.loc = @$; }
3581 | dbtable_definition { $$ = MkExternalDBTable($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3582 | declaration_mode dbtable_definition { $$ = MkExternalDBTable($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3585 external_declaration_error:
3586 class_error { yyerror(); $$ = MkExternalClass($1); $$.loc = $1.loc; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3587 | external_guess_declaration_specifiers class_error
3590 FreeList($1, FreeSpecifier);
3591 $$ = MkExternalClass($2);
3593 $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess;
3594 structDeclMode = declMode = defaultDeclMode;
3596 | function_definition_error { yyerror(); $$ = MkExternalFunction($1); $$.loc = $1.loc; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3598 | declaration_mode class_error { yyerror(); $$ = MkExternalClass($2); $$.loc = $2.loc; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3599 | declaration_mode function_definition_error { yyerror(); $$ = MkExternalFunction($2); $$.loc = $2.loc; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3601 | external_guess_declaration_error
3602 { yyerror(); $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3603 | declaration_mode external_guess_declaration_error { yyerror(); $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3606 translation_unit_error:
3607 external_declaration_error { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3608 | translation_unit external_declaration_error { $$ = $1; ListAdd($1, $2); }
3609 | translation_unit_error external_declaration_error { $$ = $1; ListAdd($1, $2); }
3610 | translation_unit error
3611 | translation_unit_error error
3615 external_declaration { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3616 | translation_unit external_declaration { $$ = $1; ListAdd($1, $2); }
3617 | translation_unit_error class
3618 { External _class = MkExternalClass($2); $$ = $1; ListAdd($1, _class); _class.loc = @2; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3619 | translation_unit_error declaration_mode class
3620 { External _class = MkExternalClass($3); $$ = $1; ListAdd($1, _class); _class.loc = @3; $3.declMode = ($2 != defaultAccess) ? $2 : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3625 | translation_unit_error
3626 | { ast = MkList(); }
3630 DBTABLE string_literal identifier '{' dbfield_definition_list '}' { Symbol symbol = DeclClassAddNameSpace($3._class, $3.string); FreeIdentifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3631 | DBTABLE string_literal strict_type '{' dbfield_definition_list '}' { Symbol symbol = DeclClass($3.nsSpec, $3.name); FreeSpecifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3632 | DBTABLE string_literal '{' dbfield_definition_list '}' { $$ = MkDBTableDef($2, null, $4); }
3636 guess_declaration_specifiers identifier string_literal ';' { $$ = MkDBFieldEntry(MkTypeName($1, null), $2, $3); }
3640 identifier { $$ = MkDBIndexItem($1, ascending); }
3641 | '>' identifier { $$ = MkDBIndexItem($2, descending); }
3642 | '<' identifier { $$ = MkDBIndexItem($2, ascending); }
3646 dbindex_item { $$ = MkList(); ListAdd($$, $1); }
3647 | dbindex_item_list ',' dbindex_item { ListAdd($1, $3); }
3651 DBINDEX dbindex_item_list ';' { $$ = MkDBIndexEntry($2, null); }
3652 | DBINDEX dbindex_item_list identifier ';' { $$ = MkDBIndexEntry($2, $3); }
3655 dbfield_definition_list:
3656 dbfield_entry { $$ = MkList(); ListAdd($$, $1); }
3657 | dbindex_entry { $$ = MkList(); ListAdd($$, $1); }
3658 | dbfield_definition_list dbfield_entry { ListAdd($1, $2); }
3659 | dbfield_definition_list dbindex_entry { ListAdd($1, $2); }
3663 DATABASE_OPEN '(' assignment_expression ',' assignment_expression ')' { $$ = MkExpDBOpen($3, $5); }
3667 DBFIELD '(' string_literal ',' identifier ')' { $$ = MkExpDBField($3, $5); }
3671 DBINDEX '(' string_literal ',' identifier ')' { $$ = MkExpDBIndex($3, $5); }
3675 DBTABLE '(' string_literal ')' { $$ = MkExpDBTable($3); }