4 #define YYLTYPE Location
8 # define YYLLOC_DEFAULT(Current, Rhs, N) \
9 (Current).start = (Rhs)[1].start; \
10 (Current).end = (Rhs)[N].end;
14 extern File fileInput;
20 bool deleteWatchable = false;
22 #define MAX_STRUCT_LEVELS 256
23 AccessMode memberAccessStack[MAX_STRUCT_LEVELS];
24 int defaultMemberAccess = -1;
26 #define POP_DEFAULT_ACCESS if(defaultMemberAccess > -1) defaultMemberAccess--;
28 #define C89_DECL_WARNING "eC expects all declarations to precede statements in the block (C89 style)\n"
38 SpecifierType specifierType;
45 Enumerator enumerator;
46 Declarator declarator;
48 Initializer initializer;
49 InitDeclarator initDeclarator;
51 Declaration declaration;
53 FunctionDefinition function;
61 Instantiation instance;
62 MembersInit membersInit;
63 MemberInit memberInit;
64 ClassFunction classFunction;
65 ClassDefinition _class;
70 PropertyWatch propertyWatch;
71 TemplateParameter templateParameter;
72 TemplateArgument templateArgument;
73 TemplateDatatype templateDatatype;
75 DBTableEntry dbtableEntry;
76 DBIndexItem dbindexItem;
77 DBTableDef dbtableDef;
82 %type <symbol> class_decl
83 %type <specifierType> struct_or_union
84 %type <i> unary_operator assignment_operator
85 %type <declMode> member_access declaration_mode
86 %type <id> identifier enum_decl
87 %type <exp> primary_expression primary_expression_error postfix_expression unary_expression cast_expression
88 multiplicative_expression additive_expression shift_expression
89 relational_expression relational_expression_smaller_than equality_expression and_expression
90 exclusive_or_expression inclusive_or_expression logical_and_expression
91 logical_or_expression conditional_expression assignment_expression
92 constant_expression constant_expression_error
93 anon_instantiation_expression anon_instantiation_expression_error i18n_string
94 postfix_expression_error unary_expression_error cast_expression_error
95 multiplicative_expression_error additive_expression_error shift_expression_error
96 relational_expression_error equality_expression_error and_expression_error
97 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
98 logical_or_expression_error conditional_expression_error assignment_expression_error
99 simple_primary_expression constant
100 common_unary_expression common_unary_expression_error
101 database_open dbfield dbindex dbtable
103 //simple_unary_expression simple_unary_expression_error
104 // simple_postfix_expression simple_postfix_expression_error
106 %type <list> argument_expression_list expression expression_anon_inst expression_anon_inst_error enumerator_list type_qualifier_list
107 struct_declarator_list struct_declaration_list
108 declaration_specifiers identifier_list identifier_list_error initializer_list init_declarator_list
109 parameter_list parameter_list_error parameter_type_list parameter_type_list_error declaration_list declaration_list_error statement_list statement_list_error
110 translation_unit members_initialization_list members_initialization_list_coloned members_initialization_list_error data_member_initialization_list data_member_initialization_list_coloned
111 default_property_list data_member_initialization_list_error
112 expression_error init_declarator_list_error argument_expression_list_error default_property_list_error struct_declaration_list_error
113 translation_unit_error
114 guess_declaration_specifiers
115 external_guess_declaration_specifiers external_guess_declaration_specifiers_error
116 specifier_qualifier_list guess_specifier_qualifier_list
117 _inheritance_specifiers inheritance_specifiers property_specifiers
118 new_specifiers renew_specifiers asm_field_list
119 property_watch_list watch_property_list
120 dbindex_item_list dbfield_definition_list
121 template_arguments_list template_parameters_list attribs_list
123 %type <asmField> asm_field
124 %type <specifier> storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier class_specifier class_specifier_error
125 struct_or_union_specifier_compound struct_or_union_specifier_nocompound ext_storage type strict_type guess_type enum_class strict_type_specifier struct_class
126 struct_or_union_specifier_compound_error struct_class_error struct_decl
127 enum_specifier_compound_error enum_class_error external_storage_class_specifier
128 base_strict_type struct_head struct_entry
129 %type <enumerator> enumerator
130 %type <declarator> declarator direct_declarator direct_abstract_declarator abstract_declarator
131 direct_abstract_declarator_noarray abstract_declarator_noarray
132 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction
133 direct_declarator_function_type_ok declarator_nofunction_type_ok direct_declarator_nofunction_type_ok declarator_function_type_ok direct_declarator_function_error_type_ok
134 direct_declarator_function_start_type_ok direct_declarator_type_ok declarator_type_ok declarator_function_error_type_ok
135 %type <pointer> pointer
136 %type <initializer> initializer initializer_error initializer_condition initializer_condition_error
137 %type <initDeclarator> init_declarator init_declarator_error
138 %type <typeName> type_name guess_type_name parameter_declaration parameter_declaration_error
139 %type <stmt> statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
140 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
141 iteration_statement_error statement_error asm_statement
142 stopwatching watch_definition firewatchers
144 %type <declaration> declaration declaration_error external_guess_declaration external_guess_declaration_error
145 %type <function> function_definition function_definition_error
146 %type <external> external_declaration external_declaration_error
148 %type <instance> instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error guess_instantiation_named guess_instantiation_named_error external_guess_instantiation_named
149 instantiation_anon instantiation_anon_error
150 %type <memberInit> data_member_initialization data_member_initialization_error default_property default_property_error
151 %type <classFunction> class_function_definition class_function_definition_error class_function_definition_start
152 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
153 constructor_function_definition_start destructor_function_definition_start
154 %type <classFunction> instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
155 %type <_class> class class_error class_head
156 %type <classDef> struct_declaration struct_declaration_error
157 %type <string> string_literal base_strict_type_name attribute_word
158 %type <extDecl> ext_decl
159 %type <attrib> attrib
160 %type <attribute> attribute
161 %type <prop> property property_start property_body class_property class_property_start class_property_body
162 %type <propertyWatch> property_watch self_watch_definition
164 %type <templateParameter> template_parameter template_type_parameter template_identifier_parameter template_expression_parameter
165 %type <templateArgument> template_argument template_type_argument template_identifier_argument template_expression_argument
166 %type <templateDatatype> template_datatype
168 %type <dbtableEntry> dbindex_entry dbfield_entry
169 %type <dbindexItem> dbindex_item
170 %type <dbtableDef> dbtable_definition
171 %type <context> compound_start class_entry
173 %token IDENTIFIER CONSTANT STRING_LITERAL SIZEOF
174 %token PTR_OP INC_OP DEC_OP LEFT_OP RIGHT_OP LE_OP GE_OP EQ_OP NE_OP
175 %token AND_OP OR_OP MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN
176 %token SUB_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN
177 %token XOR_ASSIGN OR_ASSIGN TYPE_NAME
179 %token TYPEDEF EXTERN STATIC AUTO REGISTER
180 %token CHAR SHORT INT UINT INT64 LONG SIGNED UNSIGNED FLOAT DOUBLE CONST VOLATILE VOID VALIST
181 %token STRUCT UNION ENUM ELLIPSIS
183 %token CASE DEFAULT IF SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN
187 %token CLASS THISCLASS CLASS_NAME
188 %token PROPERTY SETPROP GETPROP NEWOP RENEW DELETE EXT_DECL EXT_STORAGE IMPORT DEFINE VIRTUAL ATTRIB
189 %token PUBLIC PRIVATE
190 %token TYPED_OBJECT ANY_OBJECT _INCREF EXTENSION ASM TYPEOF
191 %token WATCH STOPWATCHING FIREWATCHERS WATCHABLE CLASS_DESIGNER CLASS_NO_EXPANSION CLASS_FIXED ISPROPSET
192 %token CLASS_DEFAULT_PROPERTY PROPERTY_CATEGORY CLASS_DATA CLASS_PROPERTY SUBCLASS NAMESPACE
193 %token NEW0OP RENEW0 VAARG
194 %token DBTABLE DBFIELD DBINDEX DATABASE_OPEN
195 %token ALIGNOF ATTRIB_DEP __ATTRIB
196 %token BOOL _BOOL _COMPLEX _IMAGINARY RESTRICT THREAD
198 %destructor { FreeIdentifier($$); } identifier
199 %destructor { FreePointer($$); } pointer
200 %destructor { FreeExpression($$); } primary_expression primary_expression_error postfix_expression unary_expression cast_expression
201 multiplicative_expression additive_expression shift_expression
202 relational_expression equality_expression and_expression
203 exclusive_or_expression inclusive_or_expression logical_and_expression
204 logical_or_expression conditional_expression assignment_expression
205 constant_expression constant_expression_error
206 postfix_expression_error unary_expression_error cast_expression_error
207 multiplicative_expression_error additive_expression_error shift_expression_error
208 relational_expression_error equality_expression_error and_expression_error
209 exclusive_or_expression_error inclusive_or_expression_error logical_and_expression_error
210 logical_or_expression_error conditional_expression_error assignment_expression_error i18n_string
211 %destructor { FreeSpecifier($$); } storage_class_specifier enum_specifier_compound enum_specifier_nocompound type_qualifier type_specifier class_specifier class_specifier_error
212 struct_or_union_specifier_compound struct_or_union_specifier_nocompound ext_storage type strict_type guess_type enum_class strict_type_specifier struct_class
213 struct_or_union_specifier_compound_error struct_class_error struct_decl
214 enum_specifier_compound_error enum_class_error external_storage_class_specifier
215 base_strict_type struct_head struct_entry
216 %destructor { FreeEnumerator($$); } enumerator
217 %destructor { FreeDeclarator($$); } declarator direct_declarator direct_abstract_declarator abstract_declarator
218 direct_abstract_declarator_noarray abstract_declarator_noarray
219 struct_declarator direct_declarator_function direct_declarator_function_start declarator_function_error direct_declarator_function_error declarator_function direct_declarator_nofunction
220 direct_declarator_function_type_ok declarator_nofunction_type_ok direct_declarator_nofunction_type_ok declarator_function_type_ok direct_declarator_function_error_type_ok
221 direct_declarator_function_start_type_ok direct_declarator_type_ok declarator_type_ok declarator_function_error_type_ok
223 %destructor { FreeInitializer($$); } initializer initializer_error initializer_condition initializer_condition_error
224 %destructor { FreeInitDeclarator($$); } init_declarator init_declarator_error
225 %destructor { FreeTypeName($$); } type_name guess_type_name parameter_declaration parameter_declaration_error
226 %destructor { FreeStatement($$); } statement labeled_statement labeled_statement_error compound_statement compound_statement_error expression_statement
227 selection_statement selection_statement_error iteration_statement jump_statement jump_statement_error compound_inside compound_inside_error
228 iteration_statement_error statement_error
230 %destructor { FreeDeclaration($$); } declaration
231 %destructor { FreeFunction($$); } function_definition function_definition_error
232 %destructor { FreeExternal($$); } external_declaration external_declaration_error
234 %destructor { FreeInstance($$); } instantiation_named instantiation_named_error instantiation_unnamed instantiation_unnamed_error
236 %destructor { FreeMemberInit($$); } data_member_initialization data_member_initialization_error default_property default_property_error
238 %destructor { FreeClassFunction($$); } class_function_definition class_function_definition_error class_function_definition_start
239 class_function_definition_start_error virtual_class_function_definition_start virtual_class_function_definition_start_error
240 constructor_function_definition_start destructor_function_definition_start
241 instance_class_function_definition instance_class_function_definition_error instance_class_function_definition_start instance_class_function_definition_start_error
242 %destructor { Context ctx = curContext; PopContext(ctx); FreeContext(ctx); delete ctx; } class_entry
243 %destructor { Context ctx = curContext; PopContext(ctx); FreeContext(ctx); delete ctx; } class_decl
244 %destructor { FreeClass($$); } class class_error class_head
245 %destructor { FreeClassDef($$); } struct_declaration struct_declaration_error
246 %destructor { delete $$; } string_literal attribute_word base_strict_type_name
247 %destructor { FreeProperty($$); } property
249 %destructor { FreeList($$, FreeExpression); } argument_expression_list expression expression_error argument_expression_list_error
250 %destructor { FreeList($$, FreeEnumerator); } enumerator_list
251 %destructor { FreeList($$, FreeSpecifier); } type_qualifier_list specifier_qualifier_list declaration_specifiers inheritance_specifiers _inheritance_specifiers external_guess_declaration_specifiers external_guess_declaration_specifiers_error
252 guess_declaration_specifiers guess_specifier_qualifier_list
253 %destructor { FreeList($$, FreeDeclarator); } struct_declarator_list
254 %destructor { FreeList($$, FreeDeclaration); } declaration_list declaration_list_error
255 %destructor { FreeList($$, FreeInitializer); } initializer_list
256 %destructor { FreeList($$, FreeInitDeclarator); } init_declarator_list init_declarator_list_error
257 %destructor { FreeList($$, FreeTypeName); } parameter_list parameter_list_error parameter_type_list parameter_type_list_error identifier_list identifier_list_error
258 %destructor { FreeList($$, FreeStatement); } statement_list statement_list_error
259 %destructor { if($$ != ast) FreeList($$, FreeExternal); } translation_unit translation_unit_error
260 %destructor { FreeList($$, FreeClassDef); } struct_declaration_list struct_declaration_list_error
261 %destructor { FreeList($$, FreeMemberInit); } default_property_list default_property_list_error data_member_initialization_list data_member_initialization_list_coloned data_member_initialization_list_error
262 %destructor { FreeList($$, FreeMembersInit); } members_initialization_list members_initialization_list_coloned members_initialization_list_error
263 %destructor { PopContext($$); FreeContext($$); delete $$; } compound_start
264 %destructor { FreeTemplateParameter($$); } template_parameter template_type_parameter template_identifier_parameter template_expression_parameter
265 %destructor { FreeTemplateArgument($$); } template_argument template_type_argument template_identifier_argument template_expression_argument
266 %destructor { FreeTemplateDataType($$); } template_datatype
267 %destructor { FreeList($$, FreeTemplateParameter); } template_parameters_list
268 %destructor { FreeList($$, FreeTemplateArgument); } template_arguments_list
269 %destructor { } declaration_mode
270 %destructor { FreeAttrib($$); } attrib
271 %destructor { FreeExtDecl($$); } ext_decl
272 %destructor { FreeAttribute($$); } attribute
273 %destructor { FreeList($$, FreeAttribute); } attribs_list
283 // if($1._class && !$1._class.name)
287 strcpy(name, $1._class.name ? $1._class.name : "");
289 strcat(name, $1.string);
293 _DeclClass(0, $1.string);
297 fileInput.Seek(@1.start.pos, start);
298 resetScannerPos(&@1.start);
303 YY_STACK_PRINT (yyss, yyssp);
306 YY_STACK_PRINT (yyss, yyssp);
313 // if($1._class && !$1._class.name)
317 strcpy(name, $1._class.name ? $1._class.name : "");
319 strcat(name, $1.string);
323 _DeclClass(0, $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);
340 /* | identifier '*' '<' template_arguments_list '>'
342 //if($1._class && !$1._class.name)
346 strcpy(name, $1._class.name ? $1._class.name : "");
348 strcat(name, $1.string);
352 _DeclClass(0, $1.string);
353 fileInput.Seek(@1.start.pos, start);
354 resetScannerPos(&@1.start);
359 YY_STACK_PRINT (yyss, yyssp);
362 YY_STACK_PRINT (yyss, yyssp);
368 strict_type { $$ = $1; }
369 | identifier identifier
374 $$ = MkSpecifierName($1.string);
380 // if($1._class && !$1._class.name)
384 strcpy(name, $1._class.name ? $1._class.name : "");
386 strcat(name, $1.string);
390 _DeclClass(0, $1.string);
395 fileInput.Seek(@1.start.pos, start);
396 resetScannerPos(&@1.start);
401 YY_STACK_PRINT (yyss, yyssp);
404 YY_STACK_PRINT (yyss, yyssp);
407 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
408 Compiler_Error($"Not a type: %s\n", $1.string);
409 yylloc = tmpLoc; $2.badID = $1;
416 //if($1._class && !$1._class.name)
420 strcpy(name, $1._class.name ? $1._class.name : "");
422 strcat(name, $1.string);
426 _DeclClass(0, $1.string);
427 fileInput.Seek(@1.start.pos, start);
428 resetScannerPos(&@1.start);
433 YY_STACK_PRINT (yyss, yyssp);
436 YY_STACK_PRINT (yyss, yyssp);
440 /* | strict_type '<' template_arguments_list '>' { $$ = $1; }
441 | identifier identifier '<' template_arguments_list '>'
444 // if($1._class && !$1._class.name)
448 strcpy(name, $1._class.name ? $1._class.name : "");
450 strcat(name, $1.string);
454 _DeclClass(0, $1.string);
458 fileInput.Seek(@1.start.pos, start);
459 resetScannerPos(&@1.start);
464 YY_STACK_PRINT (yyss, yyssp);
467 YY_STACK_PRINT (yyss, yyssp);
470 Location tmpLoc = yylloc; $$ = $2; yylloc = @1;
471 Compiler_Error($"Not a type: %s\n", $1.string);
472 yylloc = tmpLoc; $2.badID = $1;
478 TYPE_NAME { $$ = MkSpecifierName(yytext); }
481 base_strict_type_name:
482 TYPE_NAME { $$ = CopyString(yytext); }
486 | base_strict_type '<' template_arguments_list '>' { $$ = $1; SetClassTemplateArgs($$, $3); $$.loc = @$; }
487 | base_strict_type '<' template_arguments_list RIGHT_OP
490 SetClassTemplateArgs($$, $3);
494 fileInput.Seek(@4.end.pos, start);
495 resetScannerPos(&@4.end);
499 /* | identifier '<' template_arguments_list '>' */
500 /*| identifier '<' error
502 // if($1._class && !$1._class.name)
506 strcpy(name, $1._class.name ? $1._class.name : "");
508 strcat(name, $1.string);
512 _DeclClass(0, $1.string);
516 fileInput.Seek(@1.start.pos, start);
517 resetScannerPos(&@1.start);
522 YY_STACK_PRINT (yyss, yyssp);
525 YY_STACK_PRINT (yyss, yyssp);
528 YY_STACK_PRINT (yyss, yyssp);
531 /* $$ = MkSpecifierNameArgs($1.string, $3); $$.loc = @$; FreeIdentifier($1); */
535 class_function_definition_start:
536 guess_declaration_specifiers declarator_function_type_ok
537 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
538 | declarator_function
539 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
542 constructor_function_definition_start:
543 guess_declaration_specifiers '(' ')'
544 { $$ = MkClassFunction(null, null, null, null); $$.isConstructor = true; $$.loc = @$; $$.id = ++globalContext.nextID; FreeList($1, FreeSpecifier); }
547 destructor_function_definition_start:
548 '~' guess_declaration_specifiers '(' ')'
549 { $$ = MkClassFunction(null, null, null, null); $$.isDestructor = true; $$.loc = @$; $$.id = ++globalContext.nextID; FreeList($2, FreeSpecifier) }
552 virtual_class_function_definition_start:
553 VIRTUAL guess_declaration_specifiers declarator_function_type_ok
554 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
555 | VIRTUAL declarator_function
556 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
559 class_function_definition_start_error:
560 guess_declaration_specifiers declarator_function_error_type_ok
561 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
562 | declarator_function_error
563 { $$ = MkClassFunction(null, null, $1, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
566 virtual_class_function_definition_start_error:
567 VIRTUAL guess_declaration_specifiers declarator_function_error_type_ok
568 { $$ = MkClassFunction($2, null, $3, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
569 | VIRTUAL declarator_function_error
570 { $$ = MkClassFunction(null, null, $2, null); $$.isVirtual = true; $$.loc = @$; $$.id = ++globalContext.nextID; }
573 class_function_definition:
574 class_function_definition_start compound_statement
575 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
576 | virtual_class_function_definition_start compound_statement
577 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
578 | virtual_class_function_definition_start ';'
579 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
580 | constructor_function_definition_start compound_statement
581 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
582 | destructor_function_definition_start compound_statement
583 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
586 | class_function_definition_start ';'
587 { ProcessClassFunctionBody($1, null); $$.loc = @$; }
589 // Added this to fix attrib not working after function pointer declarations
590 | class_function_definition_start attrib ';'
594 $1.declarator = MkStructDeclarator($1.declarator, null);
595 $1.declarator.structDecl.attrib = $2;
597 ProcessClassFunctionBody($1, null);
602 class_function_definition_error:
603 class_function_definition_start compound_statement_error
604 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
605 | class_function_definition_start_error
606 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
607 | virtual_class_function_definition_start compound_statement_error
608 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
609 | virtual_class_function_definition_start_error
610 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
611 | virtual_class_function_definition_start_error ';'
612 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
615 // In Instances, return type is required to distinguish from calling the function
616 instance_class_function_definition_start:
617 declaration_specifiers declarator_function_type_ok
618 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
619 | declaration_specifiers declarator_nofunction_type_ok
620 { $$ = MkClassFunction($1, null, MkDeclaratorFunction($2, null), null); $$.loc = @$; $$.id = ++globalContext.nextID; }
623 instance_class_function_definition_start_error:
624 declaration_specifiers declarator_function_error_type_ok
625 { $$ = MkClassFunction($1, null, $2, null); $$.loc = @$; $$.id = ++globalContext.nextID; }
628 instance_class_function_definition:
629 instance_class_function_definition_start compound_statement
630 { ProcessClassFunctionBody($1, $2); $$.loc = @$; }
633 instance_class_function_definition_error:
634 instance_class_function_definition_start compound_statement_error
635 { ProcessClassFunctionBody($1, $2); $$.loc = @$; $$.loc.end = $2.loc.end; $$.loc.end.charPos++; $$.loc.end.pos++;}
636 | instance_class_function_definition_start_error
637 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
638 | instance_class_function_definition_start
639 { ProcessClassFunctionBody($1, null); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++;}
642 data_member_initialization:
643 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
644 | initializer_condition { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
647 data_member_initialization_error:
648 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end;}
649 | postfix_expression '=' error
651 $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy()));
652 $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = $$.initializer.loc.end = @2.end;
654 fileInput.Seek(@2.end.pos, start);
656 resetScannerPos(&@2.end);
660 | initializer_condition_error { $$ = MkMemberInit(null, $1); $$.loc = @$; $$.realLoc = @$;}
663 data_member_initialization_list:
664 data_member_initialization { $$ = MkList(); ListAdd($$, $1); }
665 | data_member_initialization_list ',' data_member_initialization
666 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
667 | data_member_initialization_list_error ',' data_member_initialization
668 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
671 data_member_initialization_list_error:
672 data_member_initialization_error { $$ = MkList(); ListAdd($$, $1); }
673 | data_member_initialization_list ',' data_member_initialization_error
674 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
675 | data_member_initialization_list_error ',' data_member_initialization_error
676 { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
678 | data_member_initialization_list ',' error
679 { ((MemberInit)$1->last).loc.end = @2.end;
681 Initializer dummy = MkInitializerAssignment(MkExpDummy());
682 MemberInit memberInit = MkMemberInit(null, dummy);
683 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
684 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
685 ListAdd($1, memberInit);
690 data_member_initialization_list_error ',' error
691 { ((MemberInit)$1->last).loc.end = @2.end;
693 Initializer dummy = MkInitializerAssignment(MkExpDummy());
694 MemberInit memberInit = MkMemberInit(null, dummy);
695 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @2.end;
696 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @2.end;
697 ListAdd($1, memberInit);
703 Initializer dummy = MkInitializerAssignment(MkExpDummy());
704 MemberInit memberInit = MkMemberInit(null, dummy);
705 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.start;
706 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.start;
709 ListAdd($$, memberInit);
711 dummy = MkInitializerAssignment(MkExpDummy());
712 memberInit = MkMemberInit(null, dummy);
713 memberInit.realLoc.start = memberInit.loc.start = dummy.loc.start = @1.end;
714 memberInit.realLoc.end = memberInit.loc.end = dummy.loc.end = @1.end;
715 ListAdd($$, memberInit);
719 data_member_initialization_list_coloned:
720 data_member_initialization_list ';'
721 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; $$ = $1; }
722 | data_member_initialization_list_error ';'
723 { if($1->last) ((MemberInit)$1->last).loc.end = @2.end; $$ = $1; }
726 members_initialization_list_coloned:
727 data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($1); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
728 | instance_class_function_definition { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
729 | members_initialization_list_error data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; $$ = $1; }
730 | members_initialization_list_error instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
731 | members_initialization_list_coloned data_member_initialization_list_coloned { MembersInit members = MkMembersInitList($2); ListAdd($$, members); members.loc = @2; $$ = $1; }
732 | members_initialization_list_coloned instance_class_function_definition { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
733 | members_initialization_list_error ';'
734 | members_initialization_list_coloned ';'
736 MembersInit members = (MembersInit)$$->last;
737 if(members.type == dataMembersInit)
738 members.loc.end = @$.end;
741 MembersInit members = MkMembersInitList(MkList());
742 ListAdd($$, members);
747 | ';' { MembersInit members = MkMembersInitList(MkList()); $$ = MkList(); ListAdd($$, members); members.loc = @1; }
750 members_initialization_list:
751 members_initialization_list_coloned
752 | data_member_initialization_list { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
753 | members_initialization_list_coloned data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
754 | members_initialization_list_error data_member_initialization_list { ListAdd($1, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; }
757 members_initialization_list_error:
758 instance_class_function_definition_error { $$ = MkList(); ListAdd($$, MkMembersInitMethod($1)); ((MembersInit)$$->last).loc = @1; }
759 | members_initialization_list instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
760 | members_initialization_list_error instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
761 | members_initialization_list_coloned instance_class_function_definition_error { ListAdd($$, MkMembersInitMethod($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
762 | members_initialization_list_coloned data_member_initialization_list_error { ListAdd($$, MkMembersInitList($2)); ((MembersInit)$$->last).loc = @2; $$ = $1; }
763 | data_member_initialization_list_error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @1; }
764 | data_member_initialization_list error { $$ = MkList(); ListAdd($$, MkMembersInitList($1)); ((MembersInit)$$->last).loc = @2; }
768 instantiation_named_error '}'
769 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
770 | instantiation_named_error error '}'
771 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
774 instantiation_named_error:
775 declaration_specifiers identifier '{' members_initialization_list_error
776 { $$ = 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++; }
777 | declaration_specifiers identifier '{' members_initialization_list error
778 { $$ = 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++; }
779 | declaration_specifiers identifier '{' members_initialization_list
780 { $$ = 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++; }
781 | declaration_specifiers identifier '{'
782 { $$ = 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++; }
783 | declaration_specifiers identifier '{' error
784 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), null);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
789 declaration_specifiers identifier '{' members_initialization_list '}'
790 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
791 | declaration_specifiers identifier '{' members_initialization_list_error '}'
792 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
793 | declaration_specifiers identifier '{' '}'
794 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
797 instantiation_named_error:
798 declaration_specifiers identifier '{' members_initialization_list_error
799 { $$ = 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++; }
800 | declaration_specifiers identifier '{' members_initialization_list error
801 { $$ = 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++; }
802 | declaration_specifiers identifier '{' members_initialization_list
803 { $$ = 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++; }
804 | declaration_specifiers identifier '{'
805 { $$ = 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++; }
806 | declaration_specifiers identifier '{' error
807 { $$ = 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++; }
812 guess_instantiation_named:
813 guess_instantiation_named_error '}'
814 { $$.loc = @$; $$.insideLoc.end = @2.start; }
815 | guess_instantiation_named_error error '}'
816 { $$.loc = @$; $$.insideLoc.end = @2.start; }
819 guess_instantiation_named_error:
820 guess_declaration_specifiers identifier '{' members_initialization_list_error
821 { $$ = 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++; }
822 | guess_declaration_specifiers identifier '{' members_initialization_list error
823 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
824 | guess_declaration_specifiers identifier '{' members_initialization_list
825 { $$ = 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++; }
826 | guess_declaration_specifiers identifier '{'
827 { $$ = 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++; }
828 | guess_declaration_specifiers identifier '{' error
829 { $$ = 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++; }
833 guess_instantiation_named:
834 guess_declaration_specifiers identifier '{' members_initialization_list '}'
835 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4);$$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
836 | guess_declaration_specifiers identifier '{' members_initialization_list_error '}'
837 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
838 | guess_declaration_specifiers identifier '{' '}'
839 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
842 guess_instantiation_named_error:
843 guess_declaration_specifiers identifier '{' members_initialization_list_error
844 { $$ = 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++; }
845 | guess_declaration_specifiers identifier '{' members_initialization_list error
846 { $$ = 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++; }
847 | guess_declaration_specifiers identifier '{' members_initialization_list
848 { $$ = 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++; }
849 | guess_declaration_specifiers identifier '{'
850 { $$ = 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++; }
851 | guess_declaration_specifiers identifier '{' error
852 { $$ = 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++; }
856 external_guess_instantiation_named:
857 external_guess_declaration_specifiers identifier '{' members_initialization_list '}'
858 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
859 | external_guess_declaration_specifiers identifier '{' members_initialization_list_error '}'
860 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), $4); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @5.start;}
861 | external_guess_declaration_specifiers identifier '{' '}'
862 { $$ = MkInstantiationNamed($1, MkExpIdentifier($2), MkList()); $$.exp.loc = @2; $$.loc = @$; $$.nameLoc = @2; $$.insideLoc.start = @3.end; $$.insideLoc.end = @4.start;}
865 instantiation_unnamed:
866 instantiation_unnamed_error '}'
867 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
868 | instantiation_unnamed_error error '}'
869 { $$.loc = @$; $$.insideLoc.end = @2.start; $$ = $1; }
872 instantiation_unnamed_error:
873 strict_type '{' members_initialization_list
874 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
875 | identifier '{' members_initialization_list
876 { Location tmpLoc = yylloc; yylloc = @1;
877 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; FreeIdentifier($1); }
879 | strict_type '{' members_initialization_list_error
880 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
882 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
883 | strict_type '{' members_initialization_list error
884 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
885 | strict_type '{' error
886 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
890 | identifier '{' members_initialization_list_error
891 { Location tmpLoc = yylloc; yylloc = @1;
892 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; FreeIdentifier($1); }
894 { Location tmpLoc = yylloc; yylloc = @1;
895 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); }
896 | identifier '{' members_initialization_list error
897 { Location tmpLoc = yylloc; yylloc = @1;
898 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); }
899 | identifier '{' error
900 { Location tmpLoc = yylloc; yylloc = @1;
901 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); }
905 instantiation_unnamed:
906 strict_type '{' members_initialization_list '}'
907 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
908 | strict_type '{' members_initialization_list error '}'
909 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; }
910 | strict_type '{' members_initialization_list_error '}'
911 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; }
912 | strict_type '{' '}'
913 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start;}
914 | strict_type '{' error '}'
915 { $$ = MkInstantiation($1, null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start;}
918 | identifier '{' members_initialization_list '}'
919 { Location tmpLoc = yylloc; yylloc = @1;
920 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
921 | identifier '{' members_initialization_list_error '}'
922 { Location tmpLoc = yylloc; yylloc = @1;
923 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
924 | identifier '{' members_initialization_list error '}'
926 $$ = MkInstantiation(MkSpecifierName($1.string), null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @5.start; FreeIdentifier($1); }
928 { Location tmpLoc = yylloc; yylloc = @1;
929 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.start; FreeIdentifier($1);}
930 | identifier '{' error '}'
931 { Location tmpLoc = yylloc; yylloc = @1;
932 yylloc = tmpLoc; $$ = MkInstantiation(MkSpecifierName($1.string), null, MkList()); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @4.start; FreeIdentifier($1); }
936 instantiation_unnamed_error:
937 strict_type '{' members_initialization_list_error
938 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
940 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
941 | strict_type '{' members_initialization_list error
942 { $$ = MkInstantiation($1, null, $3); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @3.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
943 | strict_type '{' error
944 { $$ = MkInstantiation($1, null, null); $$.loc = @$; $$.insideLoc.start = @2.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
948 | identifier '{' members_initialization_list_error
949 { Location tmpLoc = yylloc; yylloc = @1;
950 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); }
952 { Location tmpLoc = yylloc; yylloc = @1;
953 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); }
954 | identifier '{' members_initialization_list error
955 { Location tmpLoc = yylloc; yylloc = @1;
956 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); }
957 | identifier '{' error
958 { Location tmpLoc = yylloc; yylloc = @1;
959 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); }
964 instantiation_anon_error '}'
965 { $$.loc = @$; $$.insideLoc.end = @2.start; }
966 | instantiation_anon_error error '}'
967 { $$.loc = @$; $$.insideLoc.end = @2.start; }
970 instantiation_anon_error:
971 '{' members_initialization_list_error
972 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
973 | '{' members_initialization_list error
974 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
976 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
978 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
979 | '{' members_initialization_list
980 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
985 '{' members_initialization_list '}'
986 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
987 | '{' members_initialization_list error '}'
988 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @4.start; }
989 | '{' members_initialization_list_error '}'
990 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start; }
992 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.start;}
994 { $$ = MkInstantiation(null, null, MkList()); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @3.start;}
997 instantiation_anon_error:
998 '{' members_initialization_list_error
999 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
1001 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
1002 | '{' members_initialization_list error
1003 { $$ = MkInstantiation(null, null, $2); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @2.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
1005 { $$ = MkInstantiation(null, null, null); $$.loc = @$; $$.insideLoc.start = @1.end; $$.insideLoc.end = @1.end; $$.loc.end.charPos++; $$.loc.end.pos++; }
1010 postfix_expression '=' initializer_condition { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; }
1013 default_property_error:
1014 postfix_expression '=' initializer_condition_error { $$ = MkMemberInitExp($1, $3); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; }
1015 | postfix_expression '=' error { $$ = MkMemberInitExp($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.realLoc = @$; $$.initializer.loc.start = @2.end; $$.initializer.loc.end = @2.end; }
1016 | postfix_expression error { $$ = MkMemberInitExp($1, null); $$.loc = @$; $$.realLoc = @$; }
1019 default_property_list:
1020 default_property { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
1021 | default_property_list ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
1022 | default_property_list_error ',' default_property { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
1025 default_property_list_error:
1026 default_property_error { $$ = MkList(); ListAdd($$, $1); ((MemberInit)$$->last).loc = @$; }
1027 | default_property_list ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
1028 | default_property_list_error ',' default_property_error { ((MemberInit)$1->last).loc.end = @3.start; ListAdd($1, $3); $$ = $1; }
1029 | default_property_list error
1033 PROPERTY property_specifiers identifier '{'
1034 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
1036 | PROPERTY property_specifiers abstract_declarator identifier '{'
1037 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
1039 | PROPERTY property_specifiers '{'
1040 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
1042 | PROPERTY property_specifiers abstract_declarator '{'
1043 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
1045 | PROPERTY error '{'
1046 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
1051 | property_body SETPROP compound_statement
1052 { $1.setStmt = $3; }
1053 | property_body GETPROP compound_statement
1054 { $1.getStmt = $3; }
1055 | property_body ISPROPSET compound_statement
1056 { $1.issetStmt = $3; }
1057 | property_body WATCHABLE
1058 { $1.isWatchable = true; }
1059 | property_body PROPERTY_CATEGORY i18n_string
1060 { $1.category = $3; }
1064 property_body '}' { $1.loc.end = @2.end; $$ = $1; }
1067 class_property_start:
1068 CLASS_PROPERTY property_specifiers identifier '{'
1069 { $$ = MkProperty($2, null, $3, null, null); $$.loc = @$; }
1071 | CLASS_PROPERTY property_specifiers abstract_declarator identifier '{'
1072 { $$ = MkProperty($2, $3, $4, null, null); $$.loc = @$; }
1074 | CLASS_PROPERTY property_specifiers '{'
1075 { $$ = MkProperty($2, null, null, null, null); $$.loc = @$; }
1077 | CLASS_PROPERTY property_specifiers abstract_declarator '{'
1078 { $$ = MkProperty($2, $3, null, null, null); $$.loc = @$; }
1080 | CLASS_PROPERTY error '{'
1081 { $$ = MkProperty(null, null, null, null, null); $$.loc = @$; }
1084 class_property_body:
1085 class_property_start
1086 | class_property_body SETPROP compound_statement
1087 { $1.setStmt = $3; }
1088 | class_property_body GETPROP compound_statement
1089 { $1.getStmt = $3; }
1093 class_property_body '}' { $1.loc.end = @2.end; }
1096 watch_property_list:
1098 { $$ = MkListOne($1); }
1099 | watch_property_list identifier
1100 { ListAdd($1, $2); }
1104 watch_property_list compound_statement
1105 { $$ = MkPropertyWatch($1, $2); }
1106 | DELETE compound_statement
1107 { $$ = MkDeleteWatch($2); }
1110 property_watch_list:
1112 { $$ = MkListOne($1); }
1113 | property_watch_list property_watch
1114 { ListAdd($1, $2); }
1117 self_watch_definition:
1118 WATCH '(' watch_property_list ')' compound_statement
1119 { $$ = MkPropertyWatch($3, $5); }
1123 WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1124 { $$ = MkWatchStmt(null, $3, $6); }
1125 | assignment_expression '.' WATCH '(' assignment_expression ')' '{' property_watch_list '}'
1126 { $$ = MkWatchStmt($1, $5, $8); }
1130 STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1131 { $$ = MkStopWatchingStmt(null, $3, $5); }
1132 | assignment_expression '.' STOPWATCHING '(' assignment_expression ',' watch_property_list ')'
1133 { $$ = MkStopWatchingStmt($1, $5, $7); }
1134 | STOPWATCHING '(' assignment_expression ')'
1135 { $$ = MkStopWatchingStmt(null, $3, null); }
1136 | assignment_expression '.' STOPWATCHING '(' assignment_expression ')'
1137 { $$ = MkStopWatchingStmt($1, $5, null); }
1142 { $$ = MkFireWatchersStmt(null, null); }
1143 | FIREWATCHERS watch_property_list
1144 { $$ = MkFireWatchersStmt(null, $2); }
1145 | postfix_expression '.' FIREWATCHERS
1146 { $$ = MkFireWatchersStmt($1, null); }
1147 | assignment_expression '.' FIREWATCHERS watch_property_list
1148 { $$ = MkFireWatchersStmt($1, $4); }
1152 struct_declaration_error ';' { $$ = $1; $$.loc.end = @2.end; }
1153 | default_property_list ';' { $$ = MkClassDefDefaultProperty($1); if($1->last) ((MemberInit)$1->last).loc.end = @2.start; $$.loc = @$; }
1154 | class_function_definition { $$ = MkClassDefFunction($1); $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1155 | property { $$ = MkClassDefProperty($1); $$.loc = @$; globalContext.nextID++; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1156 | member_access class_function_definition { $$ = MkClassDefFunction($2); $$.loc = @$; $$.memberAccess = $1; }
1157 | member_access property { $$ = MkClassDefProperty($2); $$.loc = @$; globalContext.nextID++; $$.memberAccess = $1; }
1158 | class_property { $$ = MkClassDefClassProperty($1); $$.loc = @$; globalContext.nextID++; }
1159 | WATCHABLE { $$ = null; deleteWatchable = true; }
1160 | CLASS_NO_EXPANSION { $$ = MkClassDefNoExpansion(); }
1161 | CLASS_FIXED { $$ = MkClassDefFixed(); }
1162 | CLASS_PROPERTY '(' identifier ')' '=' initializer_condition ';' { $$ = MkClassDefClassPropertyValue($3, $6); $$.loc = @$; }
1164 | ';' { $$ = null; }
1165 | member_access ':' { memberAccessStack[defaultMemberAccess] = $1; if(defaultMemberAccess == 0) { $$ = MkClassDefMemberAccess(); $$.memberAccess = $1; $$.loc = @$; } else $$ = null; }
1167 | member_access '(' identifier ')' { $$ = MkClassDefAccessOverride($1, $3); $$.loc = @$; }
1170 struct_declaration_error:
1171 class_function_definition_error { $$ = MkClassDefFunction($1); $$.loc = $1.loc; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1173 // Moved all these in here without the ';'
1174 | guess_declaration_specifiers { $$ = MkClassDefDeclaration(MkStructDeclaration($1, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1175 | guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefDeclaration(MkStructDeclaration($1, $2, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1176 | member_access guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefDeclaration(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1177 | member_access guess_declaration_specifiers { $$ = MkClassDefDeclaration(MkStructDeclaration($2, null, null)); $$.decl.loc = @$; $$.loc = @$; $$.memberAccess = $1; }
1178 | member_access instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1179 | member_access guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = $1; }
1180 | CLASS_DATA guess_declaration_specifiers struct_declarator_list { $$ = MkClassDefClassData(MkStructDeclaration($2, $3, null)); $$.decl.loc = @$; $$.loc = @$; }
1181 | self_watch_definition { $$ = MkClassDefPropertyWatch($1); $$.loc = @$; globalContext.nextID++; }
1182 | CLASS_DESIGNER identifier { $$ = MkClassDefDesigner($2.string); FreeIdentifier($2); }
1183 | CLASS_DESIGNER strict_type { $$ = MkClassDefDesigner($2.name); FreeSpecifier($2); }
1184 | CLASS_DEFAULT_PROPERTY identifier { $$ = MkClassDefDesignerDefaultProperty($2); }
1185 | instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1186 | guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = @$; $$.decl.loc = @$; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1187 | default_property_list { $$ = MkClassDefDefaultProperty($1); if($1->last) ((MemberInit)$1->last).loc.end = @1.end; $$.loc = @$; }
1189 | guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1190 | instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1191 // | guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1192 // | instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($1)); $$.loc = $1.loc; $$.decl.loc = $$.loc; $$.memberAccess = memberAccessStack[defaultMemberAccess]; }
1194 | member_access class_function_definition_error { $$ = MkClassDefFunction($2); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.memberAccess = $1; }
1195 | member_access guess_instantiation_named_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1196 | member_access instantiation_unnamed_error error { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1197 // | member_access guess_instantiation_named { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1198 // | member_access instantiation_unnamed { $$ = MkClassDefDeclaration(MkDeclarationClassInst($2)); $$.loc = @$; $$.decl.loc = $$.loc; $$.memberAccess = $1; }
1200 | default_property_list_error { $$ = MkClassDefDefaultProperty($1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
1203 struct_declaration_list:
1204 struct_declaration { $$ = MkList(); ListAdd($$, $1); }
1205 | struct_declaration_list struct_declaration { $$ = $1; ListAdd($1, $2); }
1206 | struct_declaration_list_error struct_declaration { $$ = $1; ListAdd($1, $2); }
1209 struct_declaration_list_error:
1210 struct_declaration_error { yyerror(); $$ = MkList(); ListAdd($$, $1); }
1211 | struct_declaration_list error
1212 | struct_declaration_list_error error
1213 | struct_declaration_list struct_declaration_error { yyerror(); $$ = $1; ListAdd($$, $2); }
1214 | struct_declaration_list_error struct_declaration_error { $$ = $1; ListAdd($$, $2); }
1218 guess_declaration_specifiers { $$ = MkTemplateDatatype($1, null); }
1219 | guess_declaration_specifiers abstract_declarator { $$ = MkTemplateDatatype($1, $2); }
1220 // | identifier { $$ = MkTemplateDatatype(MkListOne(MkSpecifierName($1.string)), null); FreeIdentifier($1); }
1223 template_type_argument:
1224 // template_datatype { $$ = MkTemplateTypeArgument($1); }
1226 // Explicitly copied the rules here to handle:
1227 // ast.ec: Map<List<Location>> intlStrings { };
1229 // LinkList.ec: class LinkList<bool circ = false>
1231 guess_declaration_specifiers { $$ = MkTemplateTypeArgument(MkTemplateDatatype($1, null)); }
1232 | guess_declaration_specifiers abstract_declarator { $$ = MkTemplateTypeArgument(MkTemplateDatatype($1, $2)); }
1235 template_type_parameter:
1236 CLASS identifier { $$ = MkTypeTemplateParameter($2, null, null); }
1237 | CLASS identifier '=' template_type_argument { $$ = MkTypeTemplateParameter($2, null, $4); }
1238 | CLASS identifier ':' template_datatype { $$ = MkTypeTemplateParameter($2, $4, null); }
1239 | CLASS identifier ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter($2, $4, $6); }
1240 | CLASS base_strict_type_name { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, null); delete $2; }
1241 | CLASS base_strict_type_name '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), null, $4); }
1242 | CLASS base_strict_type_name ':' template_datatype { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, null); }
1243 | CLASS base_strict_type_name ':' template_datatype '=' template_type_argument { $$ = MkTypeTemplateParameter(MkIdentifier($2), $4, $6); }
1246 template_identifier_argument:
1247 identifier { $$ = MkTemplateIdentifierArgument($1); }
1250 template_identifier_parameter:
1251 identifier { $$ = MkIdentifierTemplateParameter($1, dataMember, null); }
1252 | identifier '=' template_identifier_argument { $$ = MkIdentifierTemplateParameter($1, dataMember, $3); }
1255 template_expression_argument:
1256 shift_expression /*constant_expression*/ { $$ = MkTemplateExpressionArgument($1); }
1259 template_expression_parameter:
1261 template_datatype identifier { $$ = MkExpressionTemplateParameter($2, $1, null); }
1262 | template_datatype identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($2, $1, $4); }
1264 guess_declaration_specifiers identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($2, MkTemplateDatatype($1, null), $4); }
1265 | guess_declaration_specifiers abstract_declarator identifier '=' template_expression_argument { $$ = MkExpressionTemplateParameter($3, MkTemplateDatatype($1, $2), $5); }
1269 template_type_parameter
1270 | template_identifier_parameter
1271 | template_expression_parameter
1274 template_parameters_list:
1275 template_parameter { $$ = MkList(); ListAdd($$, $1); }
1276 | template_parameters_list ',' template_parameter { $$ = $1; ListAdd($1, $3); }
1280 template_expression_argument
1281 | template_identifier_argument
1282 | template_type_argument
1283 | identifier '=' template_expression_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1284 | identifier '=' template_identifier_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1285 | identifier '=' template_type_argument { $$ = $3; $$.name = $1; $$.loc = @$; }
1286 /*| template_datatype '=' template_expression_argument
1289 if($1.specifiers && $1.specifiers->first)
1291 Specifier spec = $1.specifiers->first;
1292 if(spec.type == nameSpecifier)
1293 $$.name = MkIdentifier(spec.name);
1295 FreeTemplateDataType($1);
1298 | template_datatype '=' template_identifier_argument
1301 if($1.specifiers && $1.specifiers->first)
1303 Specifier spec = $1.specifiers->first;
1304 if(spec.type == nameSpecifier)
1305 $$.name = MkIdentifier(spec.name);
1307 FreeTemplateDataType($1);
1310 | template_datatype '=' template_type_argument
1313 if($1.specifiers && $1.specifiers->first)
1315 Specifier spec = $1.specifiers->first;
1316 if(spec.type == nameSpecifier)
1317 $$.name = MkIdentifier(spec.name);
1319 FreeTemplateDataType($1);
1324 template_arguments_list:
1325 template_argument { $$ = MkList(); ListAdd($$, $1); }
1326 | template_arguments_list ',' template_argument { $$ = $1; ListAdd($1, $3); }
1332 if(curContext != globalContext)
1333 PopContext(curContext);
1338 class_entry identifier { $1; $$ = DeclClassAddNameSpace(globalContext.nextID++, $2.string); FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1339 | class_entry base_strict_type
1341 $1; $$ = DeclClass(globalContext.nextID++, $2.name);
1344 ++defaultMemberAccess;
1345 memberAccessStack[defaultMemberAccess] = privateAccess;
1347 | identifier class_entry identifier { $2; $$ = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($1); FreeIdentifier($3); $$.nameLoc = @3; $$.isRemote = true; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1348 | identifier class_entry base_strict_type { $2; $$ = DeclClass(globalContext.nextID++, $3.name); FreeIdentifier($1); $$.nameLoc = @3; $$.isRemote = true; FreeSpecifier($3); memberAccessStack[++defaultMemberAccess] = privateAccess; }
1350 | class_entry identifier '<' template_parameters_list '>' { $1; $$ = DeclClassAddNameSpace(globalContext.nextID++, $2.string); $$.templateParams = $4; FreeIdentifier($2); $$.nameLoc = @2; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1351 | class_entry base_strict_type '<' template_parameters_list '>'
1353 $1; $$ = DeclClass(globalContext.nextID++, $2.name);
1354 $$.templateParams = $4;
1357 ++defaultMemberAccess;
1358 memberAccessStack[defaultMemberAccess] = privateAccess;
1360 | identifier class_entry identifier '<' template_parameters_list '>' { $2; $$ = DeclClassAddNameSpace(globalContext.nextID++, $3.string); $$.templateParams = $5; FreeIdentifier($1); FreeIdentifier($3); $$.nameLoc = @3; $$.isRemote = true; memberAccessStack[++defaultMemberAccess] = privateAccess; }
1361 | identifier class_entry base_strict_type '<' template_parameters_list '>' { $2; $$ = DeclClass(globalContext.nextID++, $3.name); $$.templateParams = $5; FreeIdentifier($1); $$.nameLoc = @3; $$.isRemote = true; FreeSpecifier($3); memberAccessStack[++defaultMemberAccess] = privateAccess; }
1371 // Added this for unit classes...
1374 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1376 PopContext(curContext);
1379 | class_decl '{' '}'
1381 $$ = MkClass($1, null, MkList()); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1383 PopContext(curContext);
1385 | class_head '{' '}'
1387 $$ = $1; $$.definitions = MkList(); $$.blockStart = @2; $$.loc = @$; $$.endid = globalContext.nextID++;
1389 PopContext(curContext);
1392 | class_entry identifier ';'
1394 $1; $$ = MkClass(DeclClassAddNameSpace(0, $2.string), null, null); FreeIdentifier($2);
1396 PopContext(curContext);
1398 | class_entry type ';'
1400 $1; $$ = MkClass(DeclClass(0, $2.name), null, null); FreeSpecifier($2);
1402 PopContext(curContext);
1407 class_decl ':' inheritance_specifiers
1409 $$ = MkClass($1, $3, null);
1414 class_decl '{' struct_declaration_list_error
1416 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1418 PopContext(curContext);
1420 | class_head '{' struct_declaration_list_error
1422 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1424 PopContext(curContext);
1426 | class_decl '{' struct_declaration_list
1428 $$ = MkClass($1, null, $3); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1430 PopContext(curContext);
1432 | class_head '{' struct_declaration_list
1434 $$ = $1; $$.definitions = $3; $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1436 PopContext(curContext);
1438 | class_decl '{' error
1440 $$ = MkClass($1, null, MkList()); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1442 PopContext(curContext);
1444 | class_head '{' error
1446 $$ = $1; $$.definitions = MkList(); $$.deleteWatchable = deleteWatchable; deleteWatchable = false; $$.blockStart = @2; $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; $$.endid = globalContext.nextID++;
1448 PopContext(curContext);
1452 /**** EXPRESSIONS ********************************************************************/
1456 { $$ = MkIdentifier(yytext); $$.loc = @1; }
1460 simple_primary_expression
1461 | '(' expression ')'
1462 { $$ = MkExpBrackets($2); $$.loc = @$; }
1466 string_literal { $$ = MkExpString($1); delete $1; $$.loc = @$; }
1467 | '$' string_literal { $$ = MkExpIntlString($2, null); delete $2; $$.loc = @$; }
1468 | '$' string_literal '.' string_literal { $$ = MkExpIntlString($4, $2); delete $2; delete $4; $$.loc = @$; }
1472 CONSTANT { $$ = MkExpConstant(yytext); $$.loc = @$; }
1475 simple_primary_expression:
1476 identifier { $$ = MkExpIdentifier($1); $$.loc = @$; }
1477 | instantiation_unnamed { $$ = MkExpInstance($1); $$.loc = @$; }
1478 | EXTENSION '(' compound_statement ')' { $$ = MkExpExtensionCompound($3); $$.loc = @$; }
1479 | EXTENSION '(' expression ')' { $$ = MkExpExtensionExpression($3); $$.loc = @$; }
1480 | EXTENSION '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, $5); $$.loc = @$; }
1481 | EXTENSION '(' type_name ')' '(' type_name ')' initializer { $$ = MkExpExtensionInitializer($3, MkInitializerAssignment(MkExpExtensionInitializer($6, $8))); $$.loc = @$; }
1482 | constant identifier
1484 char * constant = $1.constant;
1485 int len = strlen(constant);
1486 if(constant[len-1] == '.')
1488 constant[len-1] = 0;
1489 $$ = MkExpMember($1, $2);
1495 | constant { $$ = $1; }
1497 | '(' ')' { Expression exp = MkExpDummy(); exp.loc.start = @1.end; exp.loc.end = @2.start; $$ = MkExpBrackets(MkListOne(exp)); $$.loc = @$; yyerror(); }
1498 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1499 | NEWOP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,$3), $5); $$.loc = @$; }
1500 | NEWOP new_specifiers '[' constant_expression ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1501 | NEWOP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew(MkTypeName($2,null), $4); $$.loc = @$; }
1502 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1503 | NEW0OP new_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,$3), $5); $$.loc = @$; }
1504 | NEW0OP new_specifiers '[' constant_expression ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1505 | NEW0OP new_specifiers '[' constant_expression_error ']' { $$ = MkExpNew0(MkTypeName($2,null), $4); $$.loc = @$; }
1506 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1507 | RENEW constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1508 | RENEW constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1509 | RENEW constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew($2, MkTypeName($3,null), $5); $$.loc = @$; }
1510 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1511 | RENEW0 constant_expression renew_specifiers abstract_declarator_noarray '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,$4), $6); $$.loc = @$; }
1512 | RENEW0 constant_expression renew_specifiers '[' constant_expression ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1513 | RENEW0 constant_expression renew_specifiers '[' constant_expression_error ']' { $$ = MkExpRenew0($2, MkTypeName($3,null), $5); $$.loc = @$; }
1514 | CLASS '(' declaration_specifiers ')' { $$ = MkExpClass($3, null); $$.loc = @$; }
1515 | CLASS '(' declaration_specifiers abstract_declarator ')' { $$ = MkExpClass($3, $4); $$.loc = @$; }
1516 | CLASS '(' identifier ')' { $$ = MkExpClass(MkListOne(MkSpecifierName($3.string)), null); FreeIdentifier($3); $$.loc = @$; }
1517 | VAARG '(' assignment_expression ',' type_name ')' { $$ = MkExpVaArg($3, $5); $$.loc = @$; }
1519 | CLASS_DATA '(' identifier ')' { $$ = MkExpClassData($3); $$.loc = @$; }
1525 | '[' argument_expression_list /*expression*/ ']' { $$ = MkExpArray($2); $$.loc = @$; }
1526 | '[' ']' { $$ = MkExpArray(null); $$.loc = @$; }
1529 anon_instantiation_expression:
1530 instantiation_anon { $$ = MkExpInstance($1); $$.loc = @$; }
1533 anon_instantiation_expression_error:
1534 instantiation_anon_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1537 primary_expression_error:
1538 '(' expression { yyerror(); $$ = MkExpBrackets($2); $$.loc = @$; }
1539 | '(' expression_error { $$ = MkExpBrackets($2); $$.loc = @$; }
1545 | postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1546 | postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1547 | postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1548 | postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1549 | 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; }
1550 | postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1551 | postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1552 | postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1553 | postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1555 | postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1556 | postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1557 | postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1558 | postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1559 | postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1560 | postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1561 | postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1562 | postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1565 /*simple_postfix_expression:
1566 simple_primary_expression
1568 | simple_postfix_expression '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1569 | simple_postfix_expression '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1570 | simple_postfix_expression '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1571 | simple_postfix_expression '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end; $$.loc = @$; }
1572 | 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; }
1573 | simple_postfix_expression '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1574 | simple_postfix_expression PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1575 | simple_postfix_expression INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1576 | simple_postfix_expression DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1578 | simple_postfix_expression_error '[' expression ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1579 | simple_postfix_expression_error '[' expression_error ']' { $$ = MkExpIndex($1, $3); $$.loc = @$; }
1580 | simple_postfix_expression_error '(' ')' { $$ = MkExpCall($1, MkList()); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; }
1581 | simple_postfix_expression_error '(' argument_expression_list ')' { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; }
1582 | simple_postfix_expression_error '.' identifier { $$ = MkExpMember($1, $3); $$.loc = @$; }
1583 | simple_postfix_expression_error PTR_OP identifier { $$ = MkExpPointer($1, $3); $$.loc = @$; }
1584 | simple_postfix_expression_error INC_OP { $$ = MkExpOp($1, INC_OP, null); $$.loc = @$; }
1585 | simple_postfix_expression_error DEC_OP { $$ = MkExpOp($1, DEC_OP, null); $$.loc = @$; }
1588 argument_expression_list:
1589 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1590 | anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1591 | argument_expression_list ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1592 | argument_expression_list ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1595 argument_expression_list_error:
1596 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
1597 | anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
1598 | argument_expression_list ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
1599 | argument_expression_list ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
1600 | argument_expression_list ',' { Expression exp = MkExpDummy(); yyerror(); exp.loc.start = @2.end; exp.loc.end = @2.end; $$ = $1; ListAdd($1, exp); }
1603 common_unary_expression:
1604 INC_OP unary_expression { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1605 | DEC_OP unary_expression { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1606 | unary_operator cast_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1607 | unary_operator anon_instantiation_expression { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1608 //| SIZEOF '(' unary_expression ')' { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1609 | SIZEOF unary_expression { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1610 | SIZEOF '(' guess_type_name ')' { $$ = MkExpTypeSize($3); $$.loc = @$; }
1611 | SIZEOF '(' CLASS type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1612 | SIZEOF '(' CLASS guess_type ')' { $$ = MkExpClassSize($4); $$.loc = @$; }
1614 //| ALIGNOF '(' unary_expression ')' { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1615 | ALIGNOF unary_expression { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1616 | ALIGNOF '(' guess_type_name ')' { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1620 common_unary_expression
1621 | postfix_expression
1625 common_unary_expression
1626 | simple_postfix_expression
1636 | DELETE { $$ = DELETE; }
1637 | _INCREF { $$ = _INCREF; }
1642 | '(' type_name ')' cast_expression { $$ = MkExpCast($2, $4); $$.loc = @$; }
1645 multiplicative_expression:
1647 | multiplicative_expression '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1648 | multiplicative_expression '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1649 | multiplicative_expression '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1650 | multiplicative_expression_error '*' cast_expression { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1651 | multiplicative_expression_error '/' cast_expression { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1652 | multiplicative_expression_error '%' cast_expression { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1655 additive_expression:
1656 multiplicative_expression
1657 | additive_expression '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1658 | additive_expression '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1659 | additive_expression_error '+' multiplicative_expression { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1660 | additive_expression_error '-' multiplicative_expression { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1665 | shift_expression LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1666 | shift_expression RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1667 | shift_expression_error LEFT_OP additive_expression { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1668 | shift_expression_error RIGHT_OP additive_expression { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1671 relational_expression_smaller_than:
1672 relational_expression '<'
1679 relational_expression:
1681 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression { skipErrors = false; $$ = MkExpOp($1, '<', $2/*$3*/); $$.loc = @$; }
1682 | relational_expression '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1683 | relational_expression LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1684 | relational_expression GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1685 | relational_expression_error '<' shift_expression { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1686 | relational_expression_error '>' shift_expression { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1687 | relational_expression_error LE_OP shift_expression { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1688 | relational_expression_error GE_OP shift_expression { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1692 : relational_expression
1693 | equality_expression EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1694 | equality_expression NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1695 | equality_expression_error EQ_OP relational_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1696 | equality_expression_error NE_OP relational_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1698 | equality_expression EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1699 | equality_expression NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1700 | equality_expression_error EQ_OP anon_instantiation_expression { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1701 | equality_expression_error NE_OP anon_instantiation_expression { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1705 : equality_expression
1706 | and_expression '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1707 | and_expression_error '&' equality_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1709 | and_expression '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1710 | and_expression_error '&' anon_instantiation_expression { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
1713 exclusive_or_expression
1715 | exclusive_or_expression '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1716 | exclusive_or_expression_error '^' and_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1718 | exclusive_or_expression '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1719 | exclusive_or_expression_error '^' anon_instantiation_expression { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
1722 inclusive_or_expression
1723 : exclusive_or_expression
1724 | inclusive_or_expression '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1725 | inclusive_or_expression_error '|' exclusive_or_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1727 | inclusive_or_expression '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1728 | inclusive_or_expression_error '|' anon_instantiation_expression { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
1731 logical_and_expression
1732 : inclusive_or_expression
1733 | logical_and_expression AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1734 | logical_and_expression_error AND_OP inclusive_or_expression { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
1737 logical_or_expression
1738 : logical_and_expression
1739 | logical_or_expression OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1740 | logical_or_expression_error OR_OP logical_and_expression { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
1743 conditional_expression
1744 : logical_or_expression
1745 | logical_or_expression '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1746 | logical_or_expression '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1747 | logical_or_expression_error '?' expression ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1748 | logical_or_expression_error '?' expression_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1750 | logical_or_expression '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1751 | logical_or_expression '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1752 | logical_or_expression_error '?' expression_anon_inst ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1753 | logical_or_expression_error '?' expression_anon_inst_error ':' conditional_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1755 | logical_or_expression '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1756 | logical_or_expression '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1757 | logical_or_expression_error '?' expression ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1758 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1760 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1761 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1762 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1763 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
1766 assignment_expression:
1767 conditional_expression
1768 | unary_expression assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1769 | unary_expression_error assignment_operator assignment_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1770 | conditional_expression assignment_operator assignment_expression { Compiler_Error($"l-value expected\n"); $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1771 | conditional_expression_error assignment_operator assignment_expression { Compiler_Error($"l-value expected\n"); $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1773 | unary_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1774 | unary_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1775 | conditional_expression assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1776 | conditional_expression_error assignment_operator anon_instantiation_expression { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
1779 assignment_operator:
1781 | MUL_ASSIGN { $$ = MUL_ASSIGN; }
1782 | DIV_ASSIGN { $$ = DIV_ASSIGN; }
1783 | MOD_ASSIGN { $$ = MOD_ASSIGN; }
1784 | ADD_ASSIGN { $$ = ADD_ASSIGN; }
1785 | SUB_ASSIGN { $$ = SUB_ASSIGN; }
1786 | LEFT_ASSIGN { $$ = LEFT_ASSIGN; }
1787 | RIGHT_ASSIGN { $$ = RIGHT_ASSIGN; }
1788 | AND_ASSIGN { $$ = AND_ASSIGN; }
1789 | XOR_ASSIGN { $$ = XOR_ASSIGN; }
1790 | OR_ASSIGN { $$ = OR_ASSIGN; }
1794 assignment_expression { $$ = MkList(); ListAdd($$, $1); }
1795 | expression ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1796 | expression_error ',' assignment_expression { $$ = $1; ListAdd($1, $3); }
1797 | expression_error ')'
1800 expression_anon_inst:
1801 anon_instantiation_expression { $$ = MkList(); ListAdd($$, $1); }
1802 | expression ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1803 | expression_error ',' anon_instantiation_expression { $$ = $1; ListAdd($1, $3); }
1806 postfix_expression_error:
1807 primary_expression_error
1808 | error { $$ = MkExpDummy(); $$.loc = @$; /*printf("Sorry, didn't mean that syntax error\n");*/ }
1809 | postfix_expression error
1810 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1812 | postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1813 | postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1815 | postfix_expression '(' argument_expression_list { yyerror(); $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1816 | postfix_expression '(' argument_expression_list_error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @3.end; $$.loc = @$; $$.call.argLoc.end.charPos++;}
1817 /* Useless rules due to conflicts
1818 | postfix_expression '(' argument_expression_list ',' error { $$ = MkExpCall($1, $3); $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @4.end;$$.loc = @$; $$.call.argLoc.end.charPos++;}
1819 | postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1821 | postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1823 | 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++;}
1824 /* Useless rules due to conflicts
1825 | 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++;}
1826 | postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1828 | postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1831 /*simple_postfix_expression_error:
1832 error { $$ = MkExpDummy(); $$.loc = @$; }
1833 | simple_postfix_expression error
1834 | instantiation_unnamed_error error { $$ = MkExpInstance($1); $$.loc = @$; }
1836 | simple_postfix_expression PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1837 | simple_postfix_expression_error PTR_OP error { $$ = MkExpPointer($1, null); $$.loc = @$; }
1839 | 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++;}
1840 | 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++;}
1841 // Useless rules due to conflicts
1842 //| 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++;}
1843 //| simple_postfix_expression '(' error { $$ = MkExpCall($1, MkList() ); @$.end = yylloc.start; $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = yylloc.start; }
1845 | simple_postfix_expression '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1847 | 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++;}
1848 // Useless rules due to conflicts
1849 //| 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++;}
1850 //| simple_postfix_expression_error '(' error { $$ = MkExpCall($1, MkList() ); $$.loc = @$; $$.call.argLoc.start = @2.start; $$.call.argLoc.end = @2.end; $$.call.argLoc.end.charPos++;}
1851 | simple_postfix_expression_error '.' error { $$ = MkExpMember($1, null); $$.loc = @$; }
1855 common_unary_expression_error:
1856 INC_OP unary_expression_error { $$ = MkExpOp(null, INC_OP, $2); $$.loc = @$; }
1857 | DEC_OP unary_expression_error { $$ = MkExpOp(null, DEC_OP, $2); $$.loc = @$; }
1858 | unary_operator cast_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1859 | unary_operator anon_instantiation_expression_error { $$ = MkExpOp(null, $1, $2); $$.loc = @$; }
1860 //| SIZEOF '(' unary_expression_error { $$ = MkExpOp(null, SIZEOF, $3); $$.loc = @$; }
1861 | SIZEOF unary_expression_error { $$ = MkExpOp(null, SIZEOF, $2); $$.loc = @$; }
1862 | SIZEOF '(' guess_type_name ')' error { $$ = MkExpTypeSize($3); $$.loc = @$; }
1863 | SIZEOF '(' CLASS type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1864 | SIZEOF '(' CLASS guess_type ')' error { $$ = MkExpClassSize($4); $$.loc = @$; }
1865 //| ALIGNOF '(' unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $3); $$.loc = @$; }
1866 | ALIGNOF unary_expression_error { $$ = MkExpOp(null, ALIGNOF, $2); $$.loc = @$; }
1867 | ALIGNOF '(' guess_type_name ')' error { $$ = MkExpTypeAlign($3); $$.loc = @$; }
1870 unary_expression_error:
1871 common_unary_expression_error
1872 | postfix_expression_error
1875 /*simple_unary_expression_error:
1876 common_unary_expression_error
1877 | simple_postfix_expression_error
1880 cast_expression_error:
1881 unary_expression_error
1882 | '(' type_name ')' cast_expression_error { $$ = MkExpCast($2, $4); $$.loc = @$; }
1885 multiplicative_expression_error:
1886 cast_expression_error
1887 | multiplicative_expression '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1888 | multiplicative_expression '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1889 | multiplicative_expression '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1890 | multiplicative_expression_error '*' cast_expression_error { $$ = MkExpOp($1, '*', $3); $$.loc = @$; }
1891 | multiplicative_expression_error '/' cast_expression_error { $$ = MkExpOp($1, '/', $3); $$.loc = @$; }
1892 | multiplicative_expression_error '%' cast_expression_error { $$ = MkExpOp($1, '%', $3); $$.loc = @$; }
1895 additive_expression_error:
1896 multiplicative_expression_error
1897 | additive_expression '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1898 /* Useless rules due to conflicts
1899 | additive_expression '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1901 | additive_expression '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1902 /* Useless rules due to conflicts
1903 | additive_expression '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1905 | additive_expression_error '+' multiplicative_expression_error { $$ = MkExpOp($1, '+', $3); $$.loc = @$; }
1906 /* Useless rules due to conflicts
1907 | additive_expression_error '+' error { $$ = MkExpOp($1, '+', null); $$.loc = @$; }
1909 | additive_expression_error '-' multiplicative_expression_error { $$ = MkExpOp($1, '-', $3); $$.loc = @$; }
1910 /* Useless rules due to conflicts
1911 | additive_expression_error '-' error { $$ = MkExpOp($1, '-', null); $$.loc = @$; }
1915 shift_expression_error:
1916 additive_expression_error
1917 | shift_expression LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1918 | shift_expression RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1919 | shift_expression_error LEFT_OP additive_expression_error { $$ = MkExpOp($1, LEFT_OP, $3); $$.loc = @$; }
1920 | shift_expression_error RIGHT_OP additive_expression_error { $$ = MkExpOp($1, RIGHT_OP, $3); $$.loc = @$; }
1923 relational_expression_error:
1924 shift_expression_error
1925 | relational_expression_smaller_than /*relational_expression '<' */ shift_expression_error
1927 if($1.type == identifierExp)
1929 if($1.identifier._class && !$1.identifier._class.name)
1933 strcat(name, $1.identifier.string);
1934 _DeclClass(0, name);
1937 _DeclClass(0, $1.identifier.string);
1939 // printf("Declaring Class %s\n", $1.identifier.string);
1945 fileInput.Seek(@1.start.pos, start);
1946 resetScannerPos(&@1.start);
1951 YY_STACK_PRINT (yyss, yyssp);
1955 YY_STACK_PRINT (yyss, yyssp);
1959 YY_STACK_PRINT (yyss, yyssp);
1963 YY_STACK_PRINT (yyss, yyssp);
1971 $$ = MkExpOp($1, '<', $2);
1976 | relational_expression '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1977 | relational_expression LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1978 | relational_expression GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1979 | relational_expression_error '<' shift_expression_error { $$ = MkExpOp($1, '<', $3); $$.loc = @$; }
1980 | relational_expression_error '>' shift_expression_error { $$ = MkExpOp($1, '>', $3); $$.loc = @$; }
1981 | relational_expression_error LE_OP shift_expression_error { $$ = MkExpOp($1, LE_OP, $3); $$.loc = @$; }
1982 | relational_expression_error GE_OP shift_expression_error { $$ = MkExpOp($1, GE_OP, $3); $$.loc = @$; }
1985 equality_expression_error:
1986 relational_expression_error
1987 | equality_expression EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1988 | equality_expression NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1989 | equality_expression_error EQ_OP relational_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1990 | equality_expression_error NE_OP relational_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1991 /* Useless rules due to conflicts
1992 | equality_expression EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1993 | equality_expression NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1994 | equality_expression_error EQ_OP error { $$ = MkExpOp($1, EQ_OP, MkExpDummy()); $$.loc = @$; }
1995 | equality_expression_error NE_OP error { $$ = MkExpOp($1, NE_OP, MkExpDummy()); $$.loc = @$; }
1997 | equality_expression EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
1998 | equality_expression NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
1999 | equality_expression_error EQ_OP anon_instantiation_expression_error { $$ = MkExpOp($1, EQ_OP, $3); $$.loc = @$; }
2000 | equality_expression_error NE_OP anon_instantiation_expression_error { $$ = MkExpOp($1, NE_OP, $3); $$.loc = @$; }
2003 and_expression_error:
2004 equality_expression_error
2005 | and_expression '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
2006 | and_expression_error '&' equality_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
2008 | and_expression '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
2009 | and_expression_error '&' anon_instantiation_expression_error { $$ = MkExpOp($1, '&', $3); $$.loc = @$; }
2012 exclusive_or_expression_error:
2013 and_expression_error
2014 | exclusive_or_expression '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
2015 | exclusive_or_expression_error '^' and_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
2017 | exclusive_or_expression '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
2018 | exclusive_or_expression_error '^' anon_instantiation_expression_error { $$ = MkExpOp($1, '^', $3); $$.loc = @$; }
2021 inclusive_or_expression_error:
2022 exclusive_or_expression_error
2023 | inclusive_or_expression '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
2024 | inclusive_or_expression_error '|' exclusive_or_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
2026 | inclusive_or_expression '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
2027 | inclusive_or_expression_error '|' anon_instantiation_expression_error { $$ = MkExpOp($1, '|', $3); $$.loc = @$; }
2030 logical_and_expression_error:
2031 inclusive_or_expression_error
2032 | logical_and_expression AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
2033 | logical_and_expression_error AND_OP inclusive_or_expression_error { $$ = MkExpOp($1, AND_OP, $3); $$.loc = @$; }
2036 logical_or_expression_error:
2037 logical_and_expression_error
2038 | logical_or_expression OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
2039 | logical_or_expression_error OR_OP logical_and_expression_error { $$ = MkExpOp($1, OR_OP, $3); $$.loc = @$; }
2042 conditional_expression_error:
2043 logical_or_expression_error
2044 | logical_or_expression '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2045 | logical_or_expression '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2046 | logical_or_expression_error '?' expression ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2047 | logical_or_expression_error '?' expression_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2048 | logical_or_expression '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2049 | logical_or_expression '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2050 | logical_or_expression_error '?' expression ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2051 | logical_or_expression_error '?' expression_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2053 | logical_or_expression '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2054 | logical_or_expression '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2055 | logical_or_expression_error '?' expression_anon_inst ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2056 | logical_or_expression_error '?' expression_anon_inst_error ':' logical_or_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2057 | logical_or_expression '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2058 | logical_or_expression '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2059 | logical_or_expression_error '?' expression_anon_inst ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2060 | logical_or_expression_error '?' expression_anon_inst_error ':' { $$ = MkExpCondition($1, $3, MkExpDummy()); $$.loc = @$; $$.cond.elseExp.loc = @3; }
2062 | logical_or_expression '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2063 | logical_or_expression '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2064 | logical_or_expression_error '?' expression ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2065 | logical_or_expression_error '?' expression_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2067 | logical_or_expression '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2068 | logical_or_expression '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2069 | logical_or_expression_error '?' expression_anon_inst ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2070 | logical_or_expression_error '?' expression_anon_inst_error ':' anon_instantiation_expression_error { $$ = MkExpCondition($1, $3, $5); $$.loc = @$; }
2072 | logical_or_expression '?' ':'
2075 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy());
2077 ((Expression)$$.cond.exp->last).loc = @2;
2078 $$.cond.elseExp.loc = @3;
2080 | logical_or_expression_error '?' ':'
2082 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @3;
2084 | logical_or_expression '?'
2087 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2089 | logical_or_expression_error '?'
2091 $$ = MkExpCondition($1, MkListOne(MkExpDummy()), MkExpDummy()); $$.loc = @$; ((Expression)$$.cond.exp->last).loc = @2; $$.cond.elseExp.loc = @2;
2095 assignment_expression_error:
2096 conditional_expression_error
2097 | unary_expression assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2098 /* Useless rules due to conflicts
2099 | unary_expression assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2101 | unary_expression_error assignment_operator assignment_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2102 /* Useless rules due to conflicts
2103 | unary_expression_error assignment_operator error { $$ = MkExpOp($1, $2, MkExpDummy()); $$.loc = @$; $$.op.exp2.loc = @2; }
2106 | unary_expression assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2107 | unary_expression_error assignment_operator anon_instantiation_expression_error { $$ = MkExpOp($1, $2, $3); $$.loc = @$; }
2111 assignment_expression_error { $$ = MkList(); ListAdd($$, $1); }
2112 | assignment_expression error { $$ = MkList(); ListAdd($$, $1); }
2113 | expression ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2114 | expression_error ',' assignment_expression_error { $$ = $1; ListAdd($1, $3); }
2115 /* Useless rules due to conflicts
2116 | expression ',' error
2117 | expression_error ',' error
2120 | expression expression { yyerror(); $$ = $1; FreeList($2, FreeExpression); }
2121 | expression_error expression { $$ = $1; FreeList($2, FreeExpression); }
2122 | expression expression_error { $$ = $1; FreeList($2, FreeExpression); }
2125 expression_anon_inst_error:
2126 anon_instantiation_expression_error { $$ = MkList(); ListAdd($$, $1); }
2127 | anon_instantiation_expression error { $$ = MkList(); ListAdd($$, $1); }
2128 | expression ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2129 | expression_error ',' anon_instantiation_expression_error { $$ = $1; ListAdd($1, $3); }
2133 constant_expression: conditional_expression;
2135 constant_expression_error: conditional_expression_error;
2137 /**** TYPES **************************************************************************/
2138 storage_class_specifier:
2139 TYPEDEF { $$ = MkSpecifier(TYPEDEF); }
2140 | EXTERN { $$ = MkSpecifier(EXTERN); }
2141 | STATIC { $$ = MkSpecifier(STATIC); }
2142 | THREAD { $$ = MkSpecifier(THREAD); }
2143 | AUTO { $$ = MkSpecifier(AUTO); }
2144 | REGISTER { $$ = MkSpecifier(REGISTER); }
2145 | RESTRICT { $$ = MkSpecifier(RESTRICT); }
2148 external_storage_class_specifier:
2149 TYPEDEF { $$ = MkSpecifier(TYPEDEF); structDeclMode = declMode = defaultAccess; }
2150 | EXTERN { $$ = MkSpecifier(EXTERN); }
2151 | STATIC { $$ = MkSpecifier(STATIC); structDeclMode = declMode = staticAccess; }
2152 | THREAD { $$ = MkSpecifier(THREAD); }
2153 | AUTO { $$ = MkSpecifier(AUTO); }
2154 | REGISTER { $$ = MkSpecifier(REGISTER); }
2155 | RESTRICT { $$ = MkSpecifier(RESTRICT); }
2159 identifier { $$ = MkEnumerator($1, null); }
2160 | identifier '=' constant_expression { $$ = MkEnumerator($1, $3); }
2161 | identifier '=' constant_expression_error { $$ = MkEnumerator($1, $3); }
2165 enumerator { $$ = MkList(); ListAdd($$, $1); }
2166 | enumerator_list ',' enumerator { $$ = $1; ListAdd($1, $3); }
2167 | enumerator_list ','
2171 ENUM { memberAccessStack[++defaultMemberAccess] = publicAccess; }
2174 enum_specifier_nocompound:
2175 enum_specifier identifier { $$ = MkEnum($2, null); POP_DEFAULT_ACCESS }
2176 | enum_specifier strict_type { $$ = MkEnum(MkIdentifier($2.name), null); POP_DEFAULT_ACCESS }
2179 enum_specifier_compound:
2180 enum_specifier_compound_error '}' { $$.loc = @$; POP_DEFAULT_ACCESS $$ = $1; }
2181 | enum_specifier identifier '{' '}' { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2182 | enum_specifier strict_type '{' '}' { $$ = MkEnum(MkIdentifier($2.name), null); FreeSpecifier($2); $$.loc = @$; POP_DEFAULT_ACCESS }
2185 enum_specifier_compound_error:
2186 enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2187 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2189 | enum_specifier identifier '{' enumerator_list { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2190 | enum_specifier identifier '{' enumerator_list error { $$ = MkEnum($2, $4); $$.loc = @$; POP_DEFAULT_ACCESS }
2191 | enum_specifier identifier '{' error { $$ = MkEnum($2, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2192 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2193 | enum_specifier identifier '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($2, $4); $$.loc = @$; $$.definitions = $6; POP_DEFAULT_ACCESS }
2195 | enum_specifier strict_type '{' enumerator_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2196 | enum_specifier strict_type '{' enumerator_list error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2197 | enum_specifier strict_type '{' error { $$ = MkEnum(MkIdentifier($2.name), null); $$.loc = @$; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2198 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2199 | enum_specifier strict_type '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum(MkIdentifier($2.name), $4); $$.loc = @$; $$.definitions = $6; FreeSpecifier($2); POP_DEFAULT_ACCESS }
2203 enum_specifier identifier { $$ = $2; if(declMode) DeclClassAddNameSpace(globalContext.nextID++, $2.string); }
2204 | enum_specifier strict_type { $$ = MkIdentifier($2.name); if(declMode) DeclClass(globalContext.nextID++, $2.name); FreeSpecifier($2); }
2208 enum_class_error '}' { $$ = $1; $$.loc = @$; }
2209 | enum_decl ':' inheritance_specifiers '{' '}' { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2210 | enum_decl '{' '}' { $$ = MkEnum($1, null); POP_DEFAULT_ACCESS }
2214 enum_decl ':' inheritance_specifiers '{' enumerator_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2215 | enum_decl ':' inheritance_specifiers '{' enumerator_list error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2216 | enum_decl ':' inheritance_specifiers '{' error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.loc = @$; POP_DEFAULT_ACCESS }
2217 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2218 | enum_decl ':' inheritance_specifiers '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2219 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2220 | enum_decl ':' inheritance_specifiers '{' enumerator_list error ';' struct_declaration_list_error { $$ = MkEnum($1, $5); $$.baseSpecs = $3; $$.definitions = $8; $$.loc = @$; POP_DEFAULT_ACCESS }
2221 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2222 | enum_decl ':' inheritance_specifiers '{' error ';' struct_declaration_list_error { $$ = MkEnum($1, null); $$.baseSpecs = $3; $$.definitions = $7; $$.loc = @$; POP_DEFAULT_ACCESS }
2224 | enum_specifier '{' enumerator_list { $$ = MkEnum(null, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2225 | enum_specifier '{' error { $$ = MkEnum(null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2227 | enum_decl '{' enumerator_list { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2228 | enum_decl '{' enumerator_list error { $$ = MkEnum($1, $3); $$.loc = @$; POP_DEFAULT_ACCESS }
2229 | enum_decl '{' error { $$ = MkEnum($1, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2230 | enum_decl '{' enumerator_list ';' struct_declaration_list { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2231 | enum_decl '{' enumerator_list ';' struct_declaration_list_error { $$ = MkEnum($1, $3); $$.definitions = $5; $$.loc = @$; POP_DEFAULT_ACCESS }
2239 class_specifier_error:
2241 | struct_class_error
2245 ext_decl { $$ = MkSpecifierExtended($1); }
2249 CONST { $$ = MkSpecifier(CONST); }
2250 | VOLATILE { $$ = MkSpecifier(VOLATILE); }
2251 | ext_storage { $$ = $1; }
2255 type_qualifier_list:
2256 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2257 | type_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2261 VOID { $$ = MkSpecifier(VOID); }
2262 | CHAR { $$ = MkSpecifier(CHAR); }
2263 | SHORT { $$ = MkSpecifier(SHORT); }
2264 | INT { $$ = MkSpecifier(INT); }
2265 | UINT { $$ = MkSpecifier(UINT); }
2266 | INT64 { $$ = MkSpecifier(INT64); }
2267 | VALIST { $$ = MkSpecifier(VALIST); }
2268 | LONG { $$ = MkSpecifier(LONG); }
2269 | FLOAT { $$ = MkSpecifier(FLOAT); }
2270 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2271 | SIGNED { $$ = MkSpecifier(SIGNED); }
2272 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2273 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2274 | struct_or_union_specifier_nocompound
2275 | enum_specifier_nocompound
2277 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2278 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2279 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2280 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2281 | TYPED_OBJECT { $$ = MkSpecifier(TYPED_OBJECT); }
2282 | ANY_OBJECT { $$ = MkSpecifier(ANY_OBJECT); }
2283 | _BOOL { $$ = MkSpecifier(_BOOL); }
2284 | BOOL { $$ = MkSpecifier(BOOL); }
2285 | _COMPLEX { $$ = MkSpecifier(_COMPLEX); }
2286 | _IMAGINARY { $$ = MkSpecifier(_IMAGINARY); }
2289 strict_type_specifier:
2290 VOID { $$ = MkSpecifier(VOID); }
2291 | CHAR { $$ = MkSpecifier(CHAR); }
2292 | SHORT { $$ = MkSpecifier(SHORT); }
2293 | INT { $$ = MkSpecifier(INT); }
2294 | UINT { $$ = MkSpecifier(UINT); }
2295 | INT64 { $$ = MkSpecifier(INT64); }
2296 | VALIST { $$ = MkSpecifier(VALIST); }
2297 | LONG { $$ = MkSpecifier(LONG); }
2298 | FLOAT { $$ = MkSpecifier(FLOAT); }
2299 | DOUBLE { $$ = MkSpecifier(DOUBLE); }
2300 | SIGNED { $$ = MkSpecifier(SIGNED); }
2301 | UNSIGNED { $$ = MkSpecifier(UNSIGNED); }
2302 | EXTENSION { $$ = MkSpecifier(EXTENSION); }
2303 | struct_or_union_specifier_nocompound
2304 | enum_specifier_nocompound
2306 | _BOOL { $$ = MkSpecifier(_BOOL); }
2307 | BOOL { $$ = MkSpecifier(BOOL); }
2308 | _COMPLEX { $$ = MkSpecifier(_COMPLEX); }
2309 | _IMAGINARY { $$ = MkSpecifier(_IMAGINARY); }
2310 | TYPEOF '(' assignment_expression ')' { $$ = MkSpecifierTypeOf($3); }
2311 | SUBCLASS '(' type ')' { $$ = MkSpecifierSubClass($3); }
2312 | SUBCLASS '(' identifier ')' { _DeclClass(0, $3.string); $$ = MkSpecifierSubClass(MkSpecifierName($3.string)); FreeIdentifier($3); }
2313 | THISCLASS { $$ = MkSpecifier(THISCLASS); }
2316 // TESTING declarator_nofunction here... For function declarations
2319 declarator_nofunction_type_ok
2320 { $$ = MkStructDeclarator($1, null); $$.loc = @$; }
2321 | declarator_nofunction_type_ok attrib
2322 { $$ = MkStructDeclarator($1, null); $$.structDecl.attrib = $2; $$.loc = @$; }
2323 | ':' constant_expression
2324 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2325 | declarator_nofunction_type_ok ':' constant_expression
2326 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2327 | declarator_nofunction_type_ok ':' constant_expression ':' constant_expression
2328 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2329 | ':' constant_expression_error
2330 { $$ = MkStructDeclarator(null, $2); $$.loc = @$; }
2331 | declarator_nofunction_type_ok ':' constant_expression_error
2332 { $$ = MkStructDeclarator($1, $3); $$.loc = @$; }
2333 | declarator_nofunction_type_ok ':' constant_expression ':' constant_expression_error
2334 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2335 | declarator_nofunction_type_ok ':' constant_expression_error ':' constant_expression_error
2336 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2337 | declarator_nofunction_type_ok ':' constant_expression_error ':' constant_expression
2338 { $$ = MkStructDeclarator($1, $3); $$.structDecl.posExp = $5; $$.loc = @$; }
2341 struct_declarator_list:
2342 struct_declarator { $$ = MkList(); ListAdd($$, $1); }
2343 | struct_declarator_list ',' struct_declarator { $$ = $1; ListAdd($1, $3); }
2347 struct_or_union identifier
2349 $$ = MkStructOrUnion($1, $2, null);
2350 $$.addNameSpace = true;
2351 $$.ctx = PushContext();
2353 | struct_or_union base_strict_type
2355 $$ = MkStructOrUnion($1, MkIdentifier($2.name), null);
2356 $$.ctx = PushContext();
2359 | struct_or_union ext_decl identifier
2361 $$ = MkStructOrUnion($1, $3, null);
2362 $$.extDeclStruct = $2;
2363 $$.addNameSpace = true;
2364 $$.ctx = PushContext();
2366 | struct_or_union ext_decl base_strict_type
2368 $$ = MkStructOrUnion($1, MkIdentifier($3.name), null);
2369 $$.extDeclStruct = $2;
2370 $$.ctx = PushContext();
2375 struct_or_union_specifier_compound:
2376 struct_or_union_specifier_compound_error '}' { $$ = $1; $$.loc = @$; }
2377 | struct_entry '{' '}' { $$ = $1; $$.loc = @$; POP_DEFAULT_ACCESS PopContext(curContext); }
2378 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.loc = @$; POP_DEFAULT_ACCESS }
2379 | struct_or_union ext_decl '{' '}' { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; $$.loc = @$; POP_DEFAULT_ACCESS }
2382 struct_or_union_specifier_compound_error:
2383 struct_entry '{' struct_declaration_list { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2384 | struct_entry '{' struct_declaration_list_error { $$ = $1; AddStructDefinitions($1, $3); POP_DEFAULT_ACCESS PopContext(curContext); }
2385 | struct_entry '{' error { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2387 | struct_or_union '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2388 | struct_or_union '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2389 | struct_or_union '{' error { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2391 | struct_or_union ext_decl '{' struct_declaration_list { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2392 | struct_or_union ext_decl '{' struct_declaration_list_error { $$ = MkStructOrUnion($1, null, $4); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2393 | struct_or_union ext_decl '{' error { $$ = MkStructOrUnion($1, null, null); $$.extDeclStruct = $2; POP_DEFAULT_ACCESS }
2396 struct_or_union_specifier_nocompound:
2397 struct_entry { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2406 ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2409 | struct_entry '<' template_parameters_list '>'
2411 Symbol symbol = ($1.addNameSpace ? DeclClassAddNameSpace : DeclClass)(globalContext.nextID++, $1.id.string);
2413 symbol.templateParams = $3;
2418 struct_decl ':' inheritance_specifiers
2422 SetupBaseSpecs(null, $3);
2427 struct_class_error '}' { $$ = $1; $$.loc = @$; }
2428 | struct_head '{' '}'
2429 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2430 | struct_decl '{' '}' { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2431 | struct_or_union '{' '}' { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2435 struct_head '{' struct_declaration_list
2438 $$.definitions = $3;
2440 PopContext(curContext);
2442 | struct_head '{' struct_declaration_list_error
2445 $$.definitions = $3;
2447 PopContext(curContext);
2449 | struct_head '{' error
2450 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext);}
2452 | struct_decl '{' struct_declaration_list
2454 PopContext(curContext);
2457 $$ = MkStructOrUnion($1.type, $1.id, $3);
2462 $$.definitions = $3;
2465 | struct_decl '{' struct_declaration_list_error
2467 PopContext(curContext);
2471 $$ = MkStructOrUnion($1.type, $1.id, $3);
2476 $$.definitions = $3;
2479 | struct_decl '{' error
2480 { $$ = $1; POP_DEFAULT_ACCESS PopContext(curContext); }
2482 | struct_or_union '{' struct_declaration_list
2483 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2484 | struct_or_union '{' struct_declaration_list_error
2485 { $$ = MkStructOrUnion($1, null, $3); POP_DEFAULT_ACCESS }
2486 | struct_or_union '{' error
2487 { $$ = MkStructOrUnion($1, null, null); POP_DEFAULT_ACCESS }
2491 STRUCT { $$ = structSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2492 | UNION { $$ = unionSpecifier; memberAccessStack[++defaultMemberAccess] = publicAccess; }
2495 specifier_qualifier_list:
2496 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2497 | specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2498 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2499 | specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2500 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2501 | specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2502 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2503 | specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2506 guess_specifier_qualifier_list:
2507 type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2508 | guess_specifier_qualifier_list type_qualifier { $$ = $1; ListAdd($1, $2); }
2509 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2510 | guess_specifier_qualifier_list type_specifier { $$ = $1; ListAdd($1, $2); }
2511 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2512 | guess_specifier_qualifier_list guess_type { $$ = $1; ListAdd($1, $2); }
2513 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2514 | guess_specifier_qualifier_list enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2515 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2516 | guess_specifier_qualifier_list struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2519 declaration_specifiers:
2520 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2521 | declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2522 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2523 | declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2524 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2525 | declaration_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2526 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2527 | declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2528 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2529 | declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2532 guess_declaration_specifiers:
2533 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2534 | guess_declaration_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2535 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2536 | guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2537 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2538 | guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2539 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2540 | guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2541 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2542 | guess_declaration_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2543 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2544 | guess_declaration_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2547 external_guess_declaration_specifiers:
2548 external_storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2549 | external_guess_declaration_specifiers external_storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2550 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2551 | external_guess_declaration_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2552 | type_specifier { $$ = MkList(); ListAdd($$, $1); }
2553 | external_guess_declaration_specifiers type_specifier { $$ = $1; ListAdd($1, $2); }
2554 | guess_type { $$ = MkList(); ListAdd($$, $1); }
2555 | external_guess_declaration_specifiers guess_type { $$ = $1; ListAdd($1, $2); }
2556 | class_specifier { $$ = MkList(); ListAdd($$, $1); }
2557 | external_guess_declaration_specifiers class_specifier { $$ = $1; ListAdd($1, $2); }
2560 external_guess_declaration_specifiers_error:
2561 class_specifier_error { $$ = MkList(); ListAdd($$, $1); }
2562 | external_guess_declaration_specifiers class_specifier_error { $$ = $1; ListAdd($1, $2); }
2565 _inheritance_specifiers:
2566 PRIVATE { $$ = MkList(); ListAdd($$, MkSpecifier(PRIVATE)); }
2567 | PUBLIC { $$ = MkList(); ListAdd($$, MkSpecifier(PUBLIC)); }
2568 | storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2569 | _inheritance_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2570 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2571 | _inheritance_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2572 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2573 | _inheritance_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2575 { _DeclClass(0, $1.string); $$ = MkListOne(MkSpecifierName($1.string)); FreeIdentifier($1); }
2576 | _inheritance_specifiers identifier { $$ = $1; _DeclClass(0, $2.string); ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2); }
2578 | identifier '<' template_arguments_list '>'
2580 // if($1._class && !$1._class.name)
2584 strcpy(name, $1._class.name ? $1._class.name : "");
2586 strcat(name, $1.string);
2587 _DeclClass(0, name);
2590 _DeclClass(0, $1.string);
2593 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2596 | _inheritance_specifiers identifier '<' template_arguments_list '>'
2599 if($2._class && !$2._class.name)
2603 strcat(name, $2.string);
2604 _DeclClass(0, name);
2607 _DeclClass(0, $2.string);
2608 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2613 inheritance_specifiers:
2614 _inheritance_specifiers
2615 | struct_or_union { $$ = MkListOne(MkStructOrUnion($1, null, null)); POP_DEFAULT_ACCESS }
2618 property_specifiers:
2619 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2620 | property_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2621 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2622 | property_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2623 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2624 | property_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2625 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2626 | property_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2627 | identifier '<' template_arguments_list '>'
2629 // if($1._class && !$1._class.name)
2633 strcpy(name, $1._class.name ? $1._class.name : "");
2635 strcat(name, $1.string);
2636 _DeclClass(0, name);
2639 _DeclClass(0, $1.string);
2642 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2645 | property_specifiers identifier '<' template_arguments_list '>'
2647 if($2._class && !$2._class.name)
2651 strcat(name, $2.string);
2652 _DeclClass(0, name);
2655 _DeclClass(0, $2.string);
2656 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2662 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2663 | renew_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2664 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2665 | renew_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2666 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2667 | renew_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2668 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2669 | renew_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2670 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2671 | renew_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2672 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2673 | renew_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2674 | identifier '<' template_arguments_list '>'
2676 // if($1._class && !$1._class.name)
2680 strcpy(name, $1._class.name ? $1._class.name : "");
2682 strcat(name, $1.string);
2683 _DeclClass(0, name);
2686 _DeclClass(0, $1.string);
2689 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2692 | renew_specifiers identifier '<' template_arguments_list '>'
2694 if($2._class && !$2._class.name)
2698 strcat(name, $2.string);
2699 _DeclClass(0, name);
2702 _DeclClass(0, $2.string);
2703 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2709 storage_class_specifier { $$ = MkList(); ListAdd($$, $1); }
2710 | new_specifiers storage_class_specifier { $$ = $1; ListAdd($1, $2); }
2711 | type_qualifier { $$ = MkList(); ListAdd($$, $1); }
2712 | new_specifiers type_qualifier { $$ = $1; ListAdd($1, $2); }
2713 | strict_type_specifier { $$ = MkList(); ListAdd($$, $1); }
2714 | new_specifiers strict_type_specifier { $$ = $1; ListAdd($1, $2); }
2715 | struct_or_union_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2716 | new_specifiers struct_or_union_specifier_compound { $$ = $1; ListAdd($1, $2); }
2717 | enum_specifier_compound { $$ = MkList(); ListAdd($$, $1); }
2718 | new_specifiers enum_specifier_compound { $$ = $1; ListAdd($1, $2); }
2719 | identifier { $$ = MkList(); ListAdd($$, MkSpecifierName($1.string)); FreeIdentifier($1)}
2720 | new_specifiers identifier { $$ = $1; ListAdd($1, MkSpecifierName($2.string)); FreeIdentifier($2)}
2721 | identifier '<' template_arguments_list '>'
2723 // if($1._class && !$1._class.name)
2727 strcpy(name, $1._class.name ? $1._class.name : "");
2729 strcat(name, $1.string);
2730 _DeclClass(0, name);
2733 _DeclClass(0, $1.string);
2736 ListAdd($$, MkSpecifierNameArgs($1.string, $3));
2739 | new_specifiers identifier '<' template_arguments_list '>'
2741 if($2._class && !$2._class.name)
2745 strcat(name, $2.string);
2746 _DeclClass(0, name);
2749 _DeclClass(0, $2.string);
2750 ListAdd($1, MkSpecifierNameArgs($2.string, $4));
2755 identifier_list_error:
2756 identifier_list ',' error { $$ = $1; ListAdd($1, null); }
2757 | identifier_list_error ',' error { $$ = $1; ListAdd($1, null); }
2761 identifier { $$ = MkList(); ListAdd($$, MkTypeName(null, MkDeclaratorIdentifier($1))); }
2762 | identifier_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2763 | identifier_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2764 | parameter_list ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2765 | parameter_list_error ',' identifier { $$ = $1; ListAdd($1, MkTypeName(null, MkDeclaratorIdentifier($3))); }
2768 direct_declarator_nofunction_type_ok:
2769 direct_declarator_nofunction
2772 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2773 String s = colon ? colon + 2 : $1.name;
2774 $$ = MkDeclaratorIdentifier(MkIdentifier(s));
2777 | UINT { $$ = MkDeclaratorIdentifier(MkIdentifier("uint")); }
2778 // These rules need to be reviewed in lights of prototypes with types only...
2779 | base_strict_type '[' constant_expression ']'
2782 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2783 String s = colon ? colon + 2 : $1.name;
2784 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2786 $$ = MkDeclaratorArray(decl, $3);
2788 | base_strict_type '[' constant_expression_error ']'
2791 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2792 String s = colon ? colon + 2 : $1.name;
2793 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2795 $$ = MkDeclaratorArray(decl, $3);
2797 | base_strict_type '[' type ']'
2800 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2801 String s = colon ? colon + 2 : $1.name;
2802 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2804 $$ = MkDeclaratorEnumArray(decl, $3);
2806 | base_strict_type '[' ']'
2809 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
2810 String s = colon ? colon + 2 : $1.name;
2811 decl = MkDeclaratorIdentifier(MkIdentifier(s));
2813 $$ = MkDeclaratorEnumArray(decl, null);
2815 | direct_declarator_nofunction_type_ok '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2816 | direct_declarator_nofunction_type_ok '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2817 | direct_declarator_nofunction_type_ok '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2818 | direct_declarator_nofunction_type_ok '[' ']' { $$ = MkDeclaratorArray($1, null); }
2821 direct_declarator_nofunction:
2822 identifier { $$ = MkDeclaratorIdentifier($1); }
2823 | '(' declarator ')' { $$ = MkDeclaratorBrackets($2); }
2824 | '(' ext_decl declarator ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2825 | '(' declarator_type_ok ')' { $$ = MkDeclaratorBrackets($2); }
2826 | '(' ext_decl declarator_type_ok ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
2827 | direct_declarator_nofunction '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
2828 | direct_declarator_nofunction '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
2829 | direct_declarator_nofunction '[' type ']' { $$ = MkDeclaratorEnumArray($1, $3); }
2830 | direct_declarator_nofunction '[' ']' { $$ = MkDeclaratorArray($1, null); }
2833 direct_declarator_function_start:
2834 direct_declarator_nofunction '('
2837 direct_declarator_function:
2838 direct_declarator_function_start parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2839 | direct_declarator_function_start parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2840 | direct_declarator_function_start identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2841 | direct_declarator_function_start identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2842 | direct_declarator_function_start ')' { $$ = MkDeclaratorFunction($1, null); }
2845 // Tricky stuff here for overriding...
2846 direct_declarator_function_error:
2847 direct_declarator_function_start identifier_list_error
2849 $$ = MkDeclaratorFunction($1, $2);
2850 fileInput.Seek(@1.end.pos, start);
2852 resetScannerPos(&@1.end);
2853 @$.start = @1.start;
2856 | direct_declarator_function_start error
2858 $$ = MkDeclaratorFunction($1, null);
2859 fileInput.Seek(@1.end.pos, start);
2861 resetScannerPos(&@1.end);
2862 @$.start = @1.start;
2865 | direct_declarator_function_start parameter_list '('
2867 $$ = MkDeclaratorFunction($1, $2);
2868 fileInput.Seek(@1.end.pos, start);
2870 resetScannerPos(&@1.end);
2871 @$.start = @1.start;
2874 | direct_declarator_function_start guess_declaration_specifiers identifier '('
2876 $$ = MkDeclaratorFunction($1, null);
2877 fileInput.Seek(@1.end.pos, start);
2879 resetScannerPos(&@1.end);
2880 @$.start = @1.start;
2882 FreeList($2, FreeSpecifier);
2888 direct_declarator_function
2889 | direct_declarator_nofunction
2893 direct_declarator_function_start_type_ok:
2894 direct_declarator_nofunction_type_ok '('
2897 direct_declarator_function_type_ok:
2898 direct_declarator_function_start_type_ok parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2899 | direct_declarator_function_start_type_ok parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2900 | direct_declarator_function_start_type_ok identifier_list ')' { $$ = MkDeclaratorFunction($1, $2); }
2901 | direct_declarator_function_start_type_ok identifier_list_error ')' { $$ = MkDeclaratorFunction($1, $2); }
2902 | direct_declarator_function_start_type_ok ')' { $$ = MkDeclaratorFunction($1, null); }
2905 // Tricky stuff here for overriding...
2906 direct_declarator_function_error_type_ok:
2907 direct_declarator_function_start_type_ok identifier_list_error
2909 $$ = MkDeclaratorFunction($1, $2);
2910 fileInput.Seek(@1.end.pos, start);
2912 resetScannerPos(&@1.end);
2913 @$.start = @1.start;
2916 | direct_declarator_function_start_type_ok error
2918 $$ = MkDeclaratorFunction($1, null);
2919 fileInput.Seek(@1.end.pos, start);
2921 resetScannerPos(&@1.end);
2922 @$.start = @1.start;
2925 | direct_declarator_function_start_type_ok parameter_list '('
2927 $$ = MkDeclaratorFunction($1, $2);
2928 fileInput.Seek(@1.end.pos, start);
2930 resetScannerPos(&@1.end);
2931 @$.start = @1.start;
2934 | direct_declarator_function_start_type_ok guess_declaration_specifiers identifier '('
2936 $$ = MkDeclaratorFunction($1, null);
2937 fileInput.Seek(@1.end.pos, start);
2939 resetScannerPos(&@1.end);
2940 @$.start = @1.start;
2942 FreeList($2, FreeSpecifier);
2947 direct_declarator_type_ok:
2948 direct_declarator_function_type_ok
2949 | direct_declarator_nofunction_type_ok
2951 | ext_decl direct_declarator_function_type_ok
2952 { $$ = MkDeclaratorExtended($1, $2); }
2953 | ext_decl direct_declarator_nofunction_type_ok
2954 { $$ = MkDeclaratorExtended($1, $2); }
2959 ASM '(' STRING_LITERAL { $<string>$ = CopyString(yytext); } STRING_LITERAL { $<string>$ = CopyString(yytext); }
2962 strcpy(temp, "__asm__(");
2963 strcat(temp, $<string>4);
2965 strcat(temp, $<string>6);
2968 $<string>$ = CopyString(temp);
2973 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2974 | attrib { $$ = MkExtDeclAttrib($1);
2978 strcpy(temp, $<string>1);
2981 $$ = MkExtDeclString(CopyString(temp));
2983 | asm_start STRING_LITERAL { $$ = CopyString(yytext); } ')'
2986 strcpy(temp, $<string>1);
2988 strcat(temp, $<string>3);
2992 $$ = MkExtDeclString(CopyString(temp));
2998 EXT_DECL { $$ = MkExtDeclString(CopyString(yytext)); }
2999 | EXT_STORAGE { $$ = MkExtDeclString(CopyString(yytext)); }
3000 | attrib { $$ = MkExtDeclAttrib($1); }
3001 | ASM '(' string_literal ')'
3004 strcpy(temp, "__asm__(");
3007 $$ = MkExtDeclString(CopyString(temp));
3013 ATTRIB { $<i>$ = ATTRIB; }
3014 | ATTRIB_DEP { $<i>$ = ATTRIB_DEP; }
3015 | __ATTRIB { $<i>$ = __ATTRIB; }
3020 IDENTIFIER { $$ = CopyString(yytext); }
3021 | TYPE_NAME { $$ = CopyString(yytext); }
3022 | EXT_STORAGE { $$ = CopyString(yytext); }
3023 | EXT_DECL { $$ = CopyString(yytext); }
3024 | CONST { $$ = CopyString(yytext); }
3028 attribute_word { $$ = MkAttribute($1, null); $$.loc = @$; }
3029 | attribute_word '(' expression ')' { $$ = MkAttribute($1, MkExpBrackets($3)); $$.loc = @$; }
3033 attribute { $$ = MkListOne($1); }
3034 | attribs_list attribute { ListAdd($1, $2); $$ = $1; }
3035 | attribs_list ',' attribute { ListAdd($1, $3); $$ = $1; }
3039 _attrib '(' '(' attribs_list ')' ')' { $$ = MkAttrib($<i>1, $4); $$.loc = @$; }
3040 | _attrib '(' '(' ')' ')' { $$ = MkAttrib($<i>1, null); $$.loc = @$; }
3043 direct_abstract_declarator:
3044 '(' abstract_declarator ')' { $$ = MkDeclaratorBrackets($2); }
3045 | '(' ext_decl abstract_declarator ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
3046 | '[' ']' { $$ = MkDeclaratorArray(null, null); }
3047 | '[' constant_expression ']' { $$ = MkDeclaratorArray(null, $2); }
3048 | '[' constant_expression_error ']' { $$ = MkDeclaratorArray(null, $2); }
3049 | '[' type ']' { $$ = MkDeclaratorEnumArray(null, $2); }
3050 | direct_abstract_declarator '[' ']' { $$ = MkDeclaratorArray($1, null); }
3051 | direct_abstract_declarator '[' constant_expression ']' { $$ = MkDeclaratorArray($1, $3); }
3052 | direct_abstract_declarator '[' type']' { $$ = MkDeclaratorEnumArray($1, $3); }
3053 | direct_abstract_declarator '[' constant_expression_error ']' { $$ = MkDeclaratorArray($1, $3); }
3054 | '(' ')' { $$ = MkDeclaratorFunction(null, null); }
3055 | '(' parameter_type_list ')' { $$ = MkDeclaratorFunction(null, $2); }
3056 | '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction(null, $2); }
3057 | direct_abstract_declarator '(' ')' { $$ = MkDeclaratorFunction($1, null); }
3058 | direct_abstract_declarator '(' parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $3); }
3059 | direct_abstract_declarator '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $3); }
3062 direct_abstract_declarator_noarray:
3063 '(' abstract_declarator_noarray ')' { $$ = MkDeclaratorBrackets($2); }
3064 | '(' ext_decl abstract_declarator_noarray ')' { $$ = MkDeclaratorBrackets(MkDeclaratorExtended($2, $3)); }
3065 | '(' ')' { $$ = MkDeclaratorFunction(null, null); }
3066 | '(' parameter_type_list ')' { $$ = MkDeclaratorFunction(null, $2); }
3067 | '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction(null, $2); }
3068 | direct_abstract_declarator_noarray '(' ')' { $$ = MkDeclaratorFunction($1, null); }
3069 | direct_abstract_declarator_noarray '(' parameter_type_list ')' { $$ = MkDeclaratorFunction($1, $3); }
3070 | direct_abstract_declarator_noarray '(' parameter_type_list_error ')' { $$ = MkDeclaratorFunction($1, $3); }
3074 '*' { $$ = MkPointer(null, null); }
3075 | '*' type_qualifier_list { $$ = MkPointer($2, null); }
3076 | '*' pointer { $$ = MkPointer(null, $2); }
3077 | '*' type_qualifier_list pointer { $$ = MkPointer($2, $3); }
3080 abstract_declarator:
3081 pointer { $$ = MkDeclaratorPointer($1, null); }
3082 | direct_abstract_declarator
3083 | pointer direct_abstract_declarator { $$ = MkDeclaratorPointer($1, $2); }
3084 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
3085 | ext_decl pointer direct_abstract_declarator { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3088 abstract_declarator_noarray:
3089 pointer { $$ = MkDeclaratorPointer($1, null); }
3090 | direct_abstract_declarator_noarray
3091 | pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorPointer($1, $2); }
3092 | ext_decl pointer { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, null)); }
3093 | ext_decl pointer direct_abstract_declarator_noarray { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3098 | pointer direct_declarator
3099 { $$ = MkDeclaratorPointer($1, $2); }
3100 | ext_decl pointer direct_declarator
3101 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3102 | declarator ext_decl
3103 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3104 | declarator_nofunction_type_ok ext_decl
3105 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3109 direct_declarator_type_ok
3110 | pointer direct_declarator_type_ok
3111 { $$ = MkDeclaratorPointer($1, $2); }
3112 | ext_decl pointer direct_declarator_type_ok
3113 { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3114 | declarator_type_ok ext_decl
3115 { $$ = MkDeclaratorExtendedEnd($2, $1); }
3118 declarator_function:
3119 direct_declarator_function
3120 | pointer direct_declarator_function { $$ = MkDeclaratorPointer($1, $2); }
3121 | ext_decl pointer direct_declarator_function { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3122 | pointer ext_decl direct_declarator_function { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3125 declarator_function_error:
3126 direct_declarator_function_error
3127 | pointer direct_declarator_function_error { $$ = MkDeclaratorPointer($1, $2); }
3128 | ext_decl pointer direct_declarator_function_error { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3129 | pointer ext_decl direct_declarator_function_error { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3132 declarator_function_type_ok:
3133 direct_declarator_function_type_ok
3134 | pointer direct_declarator_function_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3135 | ext_decl pointer direct_declarator_function_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3136 | pointer ext_decl direct_declarator_function_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3139 declarator_function_error_type_ok:
3140 direct_declarator_function_error_type_ok
3141 | pointer direct_declarator_function_error_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3142 | ext_decl pointer direct_declarator_function_error_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3143 | pointer ext_decl direct_declarator_function_error_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3146 declarator_nofunction_type_ok:
3147 direct_declarator_nofunction_type_ok
3148 | pointer direct_declarator_nofunction_type_ok { $$ = MkDeclaratorPointer($1, $2); }
3149 | ext_decl pointer direct_declarator_nofunction_type_ok { $$ = MkDeclaratorExtended($1, MkDeclaratorPointer($2, $3)); }
3150 | pointer ext_decl direct_declarator_nofunction_type_ok { $$ = MkDeclaratorPointer($1, MkDeclaratorExtended($2, $3)); }
3154 assignment_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3155 | '{' initializer_list '}' { $$ = MkInitializerList($2); $$.loc = @$; }
3156 | '{' initializer_list ',' '}'
3158 Compiler_Warning($"Extra comma\n");
3159 $$ = MkInitializerList($2);
3163 Expression exp = MkExpDummy();
3164 Initializer init = MkInitializerAssignment(exp);
3173 assignment_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3174 | '{' initializer_list '}' error { $$ = MkInitializerList($2); $$.loc = @$; }
3175 | '{' initializer_list { yyerror(); $$ = MkInitializerList($2); $$.loc = @$; }
3176 | '{' initializer_list ',' '}' error
3178 $$ = MkInitializerList($2);
3182 Expression exp = MkExpDummy();
3183 Initializer init = MkInitializerAssignment(exp);
3189 | '{' initializer_list ','
3192 $$ = MkInitializerList($2);
3196 Expression exp = MkExpDummy();
3197 Initializer init = MkInitializerAssignment(exp);
3205 initializer_condition:
3206 conditional_expression { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3207 | anon_instantiation_expression
3208 { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3211 initializer_condition_error:
3212 conditional_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3213 | anon_instantiation_expression_error { $$ = MkInitializerAssignment($1); $$.loc = @$; }
3217 initializer { $$ = MkList(); ListAdd($$, $1); }
3218 | initializer_error { $$ = MkList(); ListAdd($$, $1); }
3219 | initializer_list ',' initializer { $$ = $1; ListAdd($1, $3); }
3220 | initializer_list ',' initializer_error { $$ = $1; ListAdd($1, $3); }
3223 | initializer_list initializer { yyerror(); $$ = $1; ListAdd($1, $2); }
3224 | initializer_list initializer_error { $$ = $1; ListAdd($1, $2); }
3228 declarator { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3229 | declarator_type_ok { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3230 | declarator '=' initializer { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3233 init_declarator_error:
3234 declarator error { $$ = MkInitDeclarator($1, null); $$.loc = @$; }
3235 /* Useless rules due to conflicts
3236 | declarator '=' error { $$ = MkInitDeclarator($1, MkInitializerAssignment(MkExpDummy())); $$.loc = @$; $$.initializer.loc = @2; $$.initializer.exp.loc = @2; }
3238 | declarator '=' initializer_error { $$ = MkInitDeclarator($1, $3); $$.loc = @$; $$.initializer.loc.start = @2.end; }
3241 init_declarator_list:
3242 init_declarator { $$ = MkList(); ListAdd($$, $1); }
3243 | init_declarator_list ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3244 | UINT ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("uint")), null)); ListAdd($$, $3); }
3245 | INT64 ',' init_declarator { $$ = MkList(); ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier("int64")), null)); ListAdd($$, $3); }
3246 | base_strict_type ',' init_declarator
3248 char * colon = RSearchString($1.name, "::", strlen($1.name), true, false);
3249 String s = colon ? colon + 2 : $1.name;
3251 ListAdd($$, MkInitDeclarator(MkDeclaratorIdentifier(MkIdentifier(s)), null));
3255 | init_declarator_list_error ',' init_declarator { $$ = $1; ListAdd($1, $3); }
3256 /*| base_strict_type ',' init_declarator
3263 init_declarator_list_error:
3264 init_declarator_error { $$ = MkList(); ListAdd($$, $1); }
3265 | init_declarator error { $$ = MkList(); ListAdd($$, $1); }
3266 | init_declarator_list ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3267 | init_declarator_list_error ',' init_declarator_error { $$ = $1; ListAdd($1, $3); }
3271 specifier_qualifier_list { $$ = MkTypeName($1, null); }
3272 | specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3276 guess_specifier_qualifier_list { $$ = MkTypeName($1, null); }
3277 | guess_specifier_qualifier_list abstract_declarator { $$ = MkTypeName($1, $2); }
3280 /*** PARAMETERS **********************************************************************/
3281 parameter_declaration:
3282 guess_declaration_specifiers declarator_type_ok { $$ = MkTypeName($1, $2); }
3283 | guess_declaration_specifiers abstract_declarator { $$ = MkTypeName($1, $2); }
3284 | guess_declaration_specifiers '&' { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), null)); }
3285 | guess_declaration_specifiers '&' declarator_type_ok { $$ = MkTypeName($1, MkDeclaratorPointer(MkPointer(null,null), $3)); }
3286 | guess_declaration_specifiers { $$ = MkTypeNameGuessDecl($1, null); }
3288 { $$ = MkTypeName(MkListOne(MkSpecifier(CLASS)), null); }
3291 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), null); }
3293 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), null)); }
3294 | TYPED_OBJECT declarator
3295 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), $2); }
3296 | TYPED_OBJECT '&' declarator
3297 { $$ = MkTypeName(MkListOne(MkSpecifier(TYPED_OBJECT)), MkDeclaratorPointer(MkPointer(null,null), $3)); }
3299 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), null); }
3300 | ANY_OBJECT declarator
3301 { $$ = MkTypeName(MkListOne(MkSpecifier(ANY_OBJECT)), $2); }
3305 parameter_declaration_error:
3306 guess_declaration_specifiers declarator_type_ok error { $$ = MkTypeName($1, $2); }
3307 | guess_declaration_specifiers abstract_declarator error { $$ = MkTypeName($1, $2); }
3311 parameter_declaration { $$ = MkList(); ListAdd($$, $1); }
3312 | parameter_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3313 | parameter_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3314 | parameter_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3315 | parameter_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3316 | error ',' parameter_declaration { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3318 | identifier_list ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3319 | identifier_list error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3320 | identifier_list_error ',' parameter_declaration { $$ = $1; ListAdd($1, $3); }
3321 | identifier_list_error error ',' parameter_declaration { $$ = $1; ListAdd($1, $4); }
3324 parameter_list_error:
3325 parameter_declaration_error { $$ = MkList(); ListAdd($$, $1); }
3326 | parameter_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3327 | parameter_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3328 | parameter_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3329 | error ',' parameter_declaration_error { $$ = MkList(); ListAdd($$, MkTypeName(MkList(), null)); ListAdd($$, $3); }
3331 | identifier_list ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3332 | identifier_list_error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $3); }
3333 | identifier_list_error error ',' parameter_declaration_error { $$ = $1; ListAdd($1, $4); }
3336 parameter_type_list:
3338 | parameter_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3339 | parameter_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3340 | identifier_list ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3341 | identifier_list_error ',' ELLIPSIS { $$ = $1; ListAdd($1, MkTypeName(null, null)); }
3342 | error ',' ELLIPSIS { $$ = MkList(); ListAdd($$, MkTypeName(null, null)); }
3345 parameter_type_list_error:
3346 parameter_list_error
3347 | parameter_list ',' error { $$ = $1; ListAdd($1, null); }
3348 | parameter_list_error error
3351 /****** STATEMENTS *******************************************************************/
3354 | attrib { $$ = MkExpressionStmt(null); FreeAttrib($1); } // Ignoring this for now... ( For __attribute__ ((__unused__)) )
3355 | compound_statement
3356 | ';' { $$ = MkExpressionStmt(null); }
3357 | ':' { $$ = MkExpressionStmt(null); }
3358 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3359 | selection_statement
3360 | iteration_statement
3365 | watch_definition ';'
3369 labeled_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3370 | iteration_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3371 | compound_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3372 | selection_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3373 | jump_statement_error { $$ = $1; Compiler_Error($"syntax error\n"); }
3374 | jump_statement error { $$ = $1; Compiler_Error($"syntax error\n"); }
3375 | expression_error { $$ = MkExpressionStmt($1); Compiler_Error($"syntax error\n"); $$.loc = @1; }
3379 string_literal { $$ = MkAsmField($1, null, null); $$.loc = @1; }
3380 | string_literal '(' assignment_expression ')' { $$ = MkAsmField($1, $3, null); $$.loc = @$; }
3381 | '[' identifier ']' string_literal '(' assignment_expression ')' { $$ = MkAsmField($4, $6, $2); $$.loc = @$; }
3385 asm_field { $$ = MkListOne($1); }
3386 | asm_field_list ',' asm_field { ListAdd($$, $3); }
3391 ASM type_qualifier '(' string_literal ')' ';' { $$ = MkAsmStmt($2, $4, null, null, null); $$.loc = @$; }
3392 | ASM type_qualifier '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, null); $$.loc = @$; }
3393 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, null); $$.loc = @$; }
3394 | ASM type_qualifier '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, $8, $10); $$.loc = @$; }
3396 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, null); $$.loc = @$; }
3397 | ASM type_qualifier '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, null, $6, $8); $$.loc = @$; }
3398 | ASM type_qualifier '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt($2, $4, $6, null, $8); $$.loc = @$; }
3400 | ASM '(' string_literal ')' ';' { $$ = MkAsmStmt(null, $3, null, null, null); $$.loc = @$; }
3401 | ASM '(' string_literal ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, null); $$.loc = @$; }
3402 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, null); $$.loc = @$; }
3403 | ASM '(' string_literal ':' asm_field_list ':' asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, $7, $9); $$.loc = @$; }
3405 | ASM '(' string_literal IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, null); $$.loc = @$; }
3406 | ASM '(' string_literal IDENTIFIER asm_field_list ':' asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, null, $5, $7); $$.loc = @$; }
3407 | ASM '(' string_literal ':' asm_field_list IDENTIFIER asm_field_list ')' ';' { $$ = MkAsmStmt(null, $3, $5, null, $7); $$.loc = @$; }
3411 identifier ':' statement { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3412 | CASE constant_expression ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3413 | CASE constant_expression_error ':' statement { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3414 | CASE ':' statement { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3415 | DEFAULT ':' statement { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3417 | identifier ':' declaration { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkLabeledStmt($1, stmt); $$.loc = @$; }
3418 | 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; }
3419 | 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; }
3420 | 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; }
3421 | DEFAULT ':' declaration { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt(null, stmt); $$.loc = @$; }
3424 labeled_statement_error:
3425 identifier ':' statement_error { $$ = MkLabeledStmt($1, $3); $$.loc = @$; }
3426 | CASE constant_expression ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3427 | CASE constant_expression_error ':' statement_error { $$ = MkCaseStmt($2, $4); $$.loc = @$; $2.loc.start = @1.end; }
3428 | CASE ':' statement_error { $$ = MkCaseStmt(MkExpDummy(), $3); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3429 | CASE ':' { $$ = MkCaseStmt(MkExpDummy(), null); $$.caseStmt.exp.loc = @2; $$.loc = @$; $$.caseStmt.exp.loc.start = @1.end; }
3430 | DEFAULT ':' statement_error { $$ = MkCaseStmt(null, $3); $$.loc = @$; }
3431 | DEFAULT ':' { $$ = MkCaseStmt(null, null); $$.loc = @$; }
3433 | identifier ':' declaration_error { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkLabeledStmt($1, stmt); $$.loc = @$; }
3434 | 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; }
3435 | 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; }
3436 | 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; }
3437 | DEFAULT ':' declaration_error { Statement stmt = MkBadDeclStmt($3); stmt.loc = @3; Compiler_Warning(C89_DECL_WARNING); $$ = MkCaseStmt(null, stmt); $$.loc = @$; }
3441 PUBLIC { $$ = structDeclMode = declMode = publicAccess; }
3442 | PRIVATE { $$ = structDeclMode = declMode = privateAccess; }
3443 | DEFAULT { $$ = structDeclMode = declMode = defaultAccess; }
3447 PUBLIC { $$ = publicAccess; }
3448 | PRIVATE { $$ = privateAccess; }
3452 declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; structDeclMode = defaultDeclMode; }
3453 | declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; structDeclMode = defaultDeclMode; }
3454 | instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; structDeclMode = defaultDeclMode; }
3455 | declaration_error ';' { $$ = $1; structDeclMode = defaultDeclMode; }
3458 external_guess_declaration:
3459 external_guess_declaration_specifiers ';' { $$ = MkDeclaration($1, null); $$.loc = @$; }
3460 | external_guess_declaration_specifiers init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3461 | external_guess_declaration_specifiers_error init_declarator_list ';' { $$ = MkDeclaration($1, $2); $$.loc = @$; }
3463 | external_guess_instantiation_named ';' { $$ = MkDeclarationInst($1); $$.loc = @$; }
3464 | DEFINE identifier '=' conditional_expression ';' { $$ = MkDeclarationDefine($2, $4); $$.loc = @$; }
3465 | STATIC DEFINE identifier '=' conditional_expression ';' { structDeclMode = declMode = staticAccess; $$ = MkDeclarationDefine($3, $5); $$.loc = @$; }
3468 external_guess_declaration_error:
3469 external_guess_declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; yyerrok; }
3473 declaration_specifiers error { $$ = MkDeclaration($1, null); $$.loc = @$; structDeclMode = defaultDeclMode; }
3474 | declaration_error error { structDeclMode = defaultDeclMode; }
3476 | instantiation_named_error error { $$ = MkDeclarationInst($1); $$.loc = @$; structDeclMode = defaultDeclMode; }
3477 | instantiation_named error { $$ = MkDeclarationInst($1); $$.loc = @$; structDeclMode = defaultDeclMode; }
3478 | declaration_specifiers init_declarator_list_error { $$ = MkDeclaration($1, $2); $$.loc = @$; structDeclMode = defaultDeclMode; }
3482 declaration { $$ = MkList(); ListAdd($$, $1); /*declMode = defaultDeclMode;*/ }
3483 | declaration_list declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3484 | declaration_list_error declaration { $$ = $1; ListAdd($1, $2); /*declMode = defaultDeclMode; */}
3485 | declaration_list error ';' { $$ = $1; }
3488 declaration_list_error:
3489 declaration_error { $$ = MkList(); ListAdd($$, $1); }
3490 | declaration_list declaration_error { $$ = $1; ListAdd($1, $2); }
3494 statement { $$ = MkList(); ListAdd($$, $1); }
3495 | statement_list statement { $$ = $1; ListAdd($1, $2); }
3496 | statement_list_error statement { $$ = $1; ListAdd($1, $2); }
3499 statement_list_error:
3500 statement_error { $$ = MkList(); ListAdd($$, $1); }
3501 | statement_list statement_error { $$ = $1; ListAdd($1, $2); }
3502 | statement_list_error statement_error { $$ = $1; ListAdd($1, $2); }
3503 | statement_list declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3504 | statement_list_error declaration { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3505 | statement_list declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3506 | statement_list_error declaration_error { Statement stmt = MkBadDeclStmt($2); stmt.loc = @2; Compiler_Warning(C89_DECL_WARNING); $$ = $1; ListAdd($1, stmt); /*declMode = defaultDeclMode;*/ }
3510 statement_list { $$ = MkCompoundStmt(null, $1); }
3511 | declaration_list { $$ = MkCompoundStmt($1, null); }
3512 | declaration_list statement_list { $$ = MkCompoundStmt($1, $2); }
3513 | declaration_list_error statement_list { $$ = MkCompoundStmt($1, $2); }
3516 compound_inside_error:
3517 statement_list_error { $$ = MkCompoundStmt(null, $1); }
3518 | declaration_list_error { $$ = MkCompoundStmt($1, null); }
3519 | declaration_list statement_list_error { $$ = MkCompoundStmt($1, $2); }
3520 | declaration_list_error statement_list_error { $$ = MkCompoundStmt($1, $2); }
3524 '{' { $<context>$ = PushContext(); }
3528 compound_statement_error '}' { $$ = $1; $$.loc = @$; }
3531 compound_statement_error:
3532 compound_start compound_inside_error
3533 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3535 { $$ = MkCompoundStmt(null, null); $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3537 | compound_start compound_inside
3538 { $$ = $2; $$.compound.context = $<context>1; PopContext($<context>1); $$.loc = @$; $$.loc.end.charPos++; $$.loc.end.pos++; }
3542 expression_statement:
3543 ';' { $$ = MkExpressionStmt(null); $$.loc = @$; }
3544 | expression ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3545 | expression_error ';' { $$ = MkExpressionStmt($1); $$.loc = @$; }
3548 selection_statement:
3549 IF '(' expression ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3550 | IF '(' expression_error ')' statement %prec IFX { $$ = MkIfStmt($3, $5, null); $$.loc = @$; }
3551 | IF '(' expression ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3552 | IF '(' expression_error ')' statement ELSE statement { $$ = MkIfStmt($3, $5, $7); $$.loc = @$; }
3553 | SWITCH '(' expression ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3554 | SWITCH '(' expression_error ')' statement { $$ = MkSwitchStmt($3, $5); $$.loc = @$; }
3557 selection_statement_error:
3558 IF '(' expression_error { $$ = MkIfStmt($3, null, null); $$.loc = @$; }
3559 | selection_statement error
3562 iteration_statement:
3563 WHILE '(' expression ')' statement { $$ = MkWhileStmt($3, $5); $$.loc = @$; }
3564 | WHILE '(' expression_error statement { $$ = MkWhileStmt($3, $4); $$.loc = @$; }
3565 | WHILE '(' ')' statement { yyerror(); $$ = MkWhileStmt(null, $4); $$.loc = @$; }
3567 | DO statement WHILE '(' expression ')' ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3568 | DO statement WHILE '(' expression_error ';' { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; }
3570 | FOR '(' expression_statement expression_statement ')' statement { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; }
3571 | FOR '(' expression_statement ')' statement { yyerror(); $$ = MkForStmt($3, null, null, $5); $$.loc = @$; }
3572 | FOR '(' expression_statement expression_statement expression ')' statement { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; }
3573 | FOR '(' expression_statement expression_statement expression_error statement { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; }
3574 | FOR '(' ')' statement { yyerror(); $$ = MkForStmt(null, null, null, $4); $$.loc = @$; }
3576 | FOR '(' identifier ':' expression ')' statement { $$ = MkForEachStmt($3, $5, null, $7); $$.loc = @$; }
3577 | FOR '(' identifier ':' expression ';' expression ')' statement { $$ = MkForEachStmt($3, $5, $7, $9); $$.loc = @$; }
3580 iteration_statement_error:
3581 FOR '(' error { $$ = MkForStmt(null, null, null, null); $$.loc = @$; } |
3582 FOR '(' expression_error error { $$ = MkForStmt(MkExpressionStmt($3), null, null, null); $$.forStmt.init.loc = @3; $$.loc = @$; } |
3583 FOR '(' expression_statement error { $$ = MkForStmt($3, null, null, null); $$.loc = @$; } |
3584 FOR '(' expression_statement expression_error error { $$ = MkForStmt($3, MkExpressionStmt($4), null, null); $$.loc = @$; $$.forStmt.check.loc = @4; } |
3585 /* Useless rules due to conflicts
3586 FOR '(' expression_statement expression_statement error { $$ = MkForStmt($3, $4, null, null); $$.loc = @$; } |
3588 FOR '(' expression_statement expression_statement expression_error { $$ = MkForStmt($3, $4, $5, null); $$.loc = @$; } |
3589 FOR '(' expression_statement expression_statement ')' statement_error { $$ = MkForStmt($3, $4, null, $6); $$.loc = @$; } |
3590 FOR '(' expression_statement expression_statement expression ')' statement_error { $$ = MkForStmt($3, $4, $5, $7); $$.loc = @$; } |
3591 FOR '(' expression_statement expression_statement expression_error statement_error { $$ = MkForStmt($3, $4, $5, $6 ); $$.loc = @$; } |
3593 DO statement WHILE '(' expression ')' { yyerror(); $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3594 DO statement WHILE '(' expression { yyerror(); $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3595 DO statement WHILE '(' expression_error { $$ = MkDoWhileStmt($2, $5); $$.loc = @$; } |
3596 DO statement WHILE '(' { $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3597 DO statement WHILE { yyerror(); $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3598 DO statement { yyerror(); $$ = MkDoWhileStmt($2, null); $$.loc = @$; } |
3599 DO { yyerror(); $$ = MkDoWhileStmt(null, null); $$.loc = @$; } |
3602 WHILE error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3603 /* Useless rules due to conflicts
3604 WHILE '(' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3606 WHILE '(' ')' error { $$ = MkWhileStmt(null, null); $$.loc = @$; } |
3607 WHILE '(' expression_error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3608 /* Useless rules due to conflicts
3609 WHILE '(' expression_error error { $$ = MkWhileStmt($3, null); $$.loc = @$; } |
3611 WHILE '(' expression ')' statement_error { $$ = MkWhileStmt($3, $5); $$.loc = @$; } |
3612 WHILE '(' expression_error statement_error { $$ = MkWhileStmt($3, $4 ); $$.loc = @$; }
3616 GOTO identifier ';' { $$ = MkGotoStmt($2); $$.loc = @$; }
3617 | CONTINUE ';' { $$ = MkContinueStmt(); $$.loc = @$; }
3618 | BREAK ';' { $$ = MkBreakStmt(); $$.loc = @$; }
3619 | RETURN ';' { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc = @2; }
3620 | RETURN expression ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3621 | RETURN expression_error ';' { $$ = MkReturnStmt($2); $$.loc = @$; }
3622 | RETURN anon_instantiation_expression ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3623 | RETURN anon_instantiation_expression_error ';' { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; }
3626 jump_statement_error:
3627 RETURN expression_error { $$ = MkReturnStmt($2); $$.loc = @$; } |
3628 RETURN anon_instantiation_expression_error { $$ = MkReturnStmt(MkListOne($2)); $$.loc = @$; } |
3629 RETURN { Expression exp = MkExpDummy(); $$ = MkReturnStmt(MkListOne(exp)); $$.loc = @$; exp.loc.start = exp.loc.end = @1.end; } |
3630 GOTO { $$ = MkGotoStmt(null); $$.loc = @$; }
3633 /*************************************************************************************/
3635 function_definition:
3636 external_guess_declaration_specifiers declarator_function declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3637 | external_guess_declaration_specifiers declarator_function compound_statement
3638 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3639 | external_guess_declaration_specifiers declarator_function_type_ok declaration_list compound_statement { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; }
3640 | external_guess_declaration_specifiers declarator_function_type_ok compound_statement
3641 { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; }
3643 | declarator_function declaration_list compound_statement { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; }
3644 | declarator_function compound_statement { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$;}
3646 function_definition_error:
3647 external_guess_declaration_specifiers declarator_function declaration_list compound_statement_error { $$ = MkFunction($1, $2, $3); ProcessFunctionBody($$, $4); $$.loc = @$; $$.loc.end = $4.loc.end; }
3648 | external_guess_declaration_specifiers declarator_function compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3649 | 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; }
3650 | external_guess_declaration_specifiers declarator_function_type_ok compound_statement_error { $$ = MkFunction($1, $2, null); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3651 | declarator_function declaration_list compound_statement_error { $$ = MkFunction(null, $1, $2); ProcessFunctionBody($$, $3); $$.loc = @$; $$.loc.end = $3.loc.end; }
3652 | declarator_function compound_statement_error { $$ = MkFunction(null, $1, null); ProcessFunctionBody($$, $2); $$.loc = @$; $$.loc.end = $2.loc.end; }
3656 STRING_LITERAL { $$ = CopyString(yytext); }
3657 | string_literal STRING_LITERAL
3659 int len1 = strlen($1);
3660 int len2 = strlen(yytext);
3661 $$ = new byte[len1-1 + len2-1 + 1];
3662 memcpy($$, $1, len1-1);
3663 memcpy($$ + len1-1, yytext+1, len2);
3668 external_declaration:
3669 function_definition { $$ = MkExternalFunction($1); $$.loc = @$; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3671 { $$ = MkExternalClass($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3673 | external_guess_declaration_specifiers class
3674 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; FreeList($1, FreeSpecifier); }
3676 | external_guess_declaration
3677 { $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3678 | IMPORT string_literal { $$ = MkExternalImport($2, normalImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3679 | IMPORT STATIC string_literal { $$ = MkExternalImport($3, staticImport, (declMode != defaultAccess) ? declMode : privateAccess); $$.loc = @$; }
3680 | IMPORT identifier string_literal
3682 bool isRemote = !strcmp($2.string, "remote");
3683 $$ = MkExternalImport($3, isRemote ? remoteImport : normalImport, (declMode != defaultAccess) ? declMode : privateAccess);
3690 | ';' { $$ = null; }
3692 | declaration_mode function_definition { $$ = MkExternalFunction($2); $$.loc = @$; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3693 | declaration_mode class
3694 { $$ = MkExternalClass($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3695 | declaration_mode external_guess_declaration { $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3696 | declaration_mode IMPORT string_literal { $$ = MkExternalImport($3, normalImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; structDeclMode = declMode = defaultDeclMode; }
3697 | declaration_mode IMPORT STATIC string_literal { $$ = MkExternalImport($4, staticImport, ($1 != defaultAccess) ? $1 : privateAccess); $$.loc = @$; structDeclMode = declMode = defaultDeclMode; }
3698 | declaration_mode IMPORT identifier string_literal
3700 bool isRemote = !strcmp($3.string, "remote");
3701 $$ = MkExternalImport($4, isRemote ? remoteImport : normalImport, ($1 != defaultAccess) ? $1 : privateAccess);
3704 structDeclMode = declMode = defaultDeclMode;
3708 | declaration_mode ':' { defaultDeclMode = $1; $$ = null; }
3709 | STATIC ':' { defaultDeclMode = staticAccess; $$ = null; }
3710 | NAMESPACE identifier { $$ = MkExternalNameSpace($2); $$.loc = @$; }
3711 | NAMESPACE strict_type { $$ = MkExternalNameSpace(MkIdentifier($2.name)); FreeSpecifier($2); $$.loc = @$; }
3712 | dbtable_definition { $$ = MkExternalDBTable($1); $$.loc = @$; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3713 | declaration_mode dbtable_definition { $$ = MkExternalDBTable($2); $$.loc = @$; $2.declMode = ($1 != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3716 external_declaration_error:
3717 class_error { yyerror(); $$ = MkExternalClass($1); $$.loc = $1.loc; $1.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3718 | external_guess_declaration_specifiers class_error
3721 FreeList($1, FreeSpecifier);
3722 $$ = MkExternalClass($2);
3724 $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess;
3725 structDeclMode = declMode = defaultDeclMode;
3727 | function_definition_error { yyerror(); $$ = MkExternalFunction($1); $$.loc = $1.loc; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3729 | declaration_mode class_error { yyerror(); $$ = MkExternalClass($2); $$.loc = $2.loc; $2.declMode = ($1 != defaultAccess) ? $1 : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3730 | declaration_mode function_definition_error { yyerror(); $$ = MkExternalFunction($2); $$.loc = $2.loc; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3732 | external_guess_declaration_error
3733 { yyerror(); $$ = MkExternalDeclaration($1); $$.loc = @$; $1.declMode = declMode; structDeclMode = declMode = defaultDeclMode; }
3734 | declaration_mode external_guess_declaration_error { yyerror(); $$ = MkExternalDeclaration($2); $$.loc = @$; $2.declMode = $1; structDeclMode = declMode = defaultDeclMode; }
3737 translation_unit_error:
3738 external_declaration_error { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3739 | translation_unit external_declaration_error { $$ = $1; ListAdd($1, $2); }
3740 | translation_unit_error external_declaration_error { $$ = $1; ListAdd($1, $2); }
3741 | translation_unit error
3742 | translation_unit_error error
3746 external_declaration { $$ = MkList(); ListAdd($$, $1); ast = $$; }
3747 | translation_unit external_declaration { $$ = $1; ListAdd($1, $2); }
3748 | translation_unit_error class
3749 { External _class = MkExternalClass($2); $$ = $1; ListAdd($1, _class); _class.loc = @2; $2.declMode = (declMode != defaultAccess) ? declMode : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3750 | translation_unit_error declaration_mode class
3751 { External _class = MkExternalClass($3); $$ = $1; ListAdd($1, _class); _class.loc = @3; $3.declMode = ($2 != defaultAccess) ? $2 : privateAccess; structDeclMode = declMode = defaultDeclMode; }
3756 | translation_unit_error
3757 | { ast = MkList(); }
3761 DBTABLE string_literal identifier '{' dbfield_definition_list '}' { Symbol symbol = DeclClassAddNameSpace(globalContext.nextID++, $3.string); FreeIdentifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3762 | DBTABLE string_literal strict_type '{' dbfield_definition_list '}' { Symbol symbol = DeclClass(globalContext.nextID++, $3.name); FreeSpecifier($3); $$ = MkDBTableDef($2, symbol, $5); }
3763 | DBTABLE string_literal '{' dbfield_definition_list '}' { $$ = MkDBTableDef($2, null, $4); }
3767 guess_declaration_specifiers identifier string_literal ';' { $$ = MkDBFieldEntry(MkTypeName($1, null), $2, $3); }
3771 identifier { $$ = MkDBIndexItem($1, ascending); }
3772 | '>' identifier { $$ = MkDBIndexItem($2, descending); }
3773 | '<' identifier { $$ = MkDBIndexItem($2, ascending); }
3777 dbindex_item { $$ = MkList(); ListAdd($$, $1); }
3778 | dbindex_item_list ',' dbindex_item { ListAdd($1, $3); }
3782 DBINDEX dbindex_item_list ';' { $$ = MkDBIndexEntry($2, null); }
3783 | DBINDEX dbindex_item_list identifier ';' { $$ = MkDBIndexEntry($2, $3); }
3786 dbfield_definition_list:
3787 dbfield_entry { $$ = MkList(); ListAdd($$, $1); }
3788 | dbindex_entry { $$ = MkList(); ListAdd($$, $1); }
3789 | dbfield_definition_list dbfield_entry { ListAdd($1, $2); }
3790 | dbfield_definition_list dbindex_entry { ListAdd($1, $2); }
3794 DATABASE_OPEN '(' assignment_expression ',' assignment_expression ')' { $$ = MkExpDBOpen($3, $5); }
3798 DBFIELD '(' string_literal ',' identifier ')' { $$ = MkExpDBField($3, $5); }
3802 DBINDEX '(' string_literal ',' identifier ')' { $$ = MkExpDBIndex($3, $5); }
3806 DBTABLE '(' string_literal ')' { $$ = MkExpDBTable($3); }